/* Global Variables and Design System */
:root {
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.45);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-indigo: #6366f1;
    --accent-indigo-glow: rgba(99, 102, 241, 0.15);
    --accent-violet: #8b5cf6;
    --accent-violet-glow: rgba(139, 92, 246, 0.15);
    --color-success: #10b981;
    --color-success-bg: rgba(16, 185, 129, 0.1);
    --color-error: #ef4444;
    --color-error-bg: rgba(239, 68, 68, 0.1);
    --color-warning: #f59e0b;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.2);
}

/* Reset and Core Layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
}

/* Ambient Glowing Background Orbs */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -10;
    background: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #0f172a 100%);
}

.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -5;
    pointer-events: none;
    opacity: 0.5;
    animation: orbFloat 20s infinite alternate ease-in-out;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-indigo) 0%, rgba(99, 102, 241, 0) 70%);
    top: -10%;
    left: -10%;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-violet) 0%, rgba(139, 92, 246, 0) 70%);
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

@keyframes orbFloat {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(80px, 50px) scale(1.15); }
}

/* Main Container */
.app-container {
    width: 100%;
    max-width: 1400px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 1rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 3.5rem;
    height: 3.5rem;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: var(--shadow-glow);
}

.logo-text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #ffffff, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Workspace Layout */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

/* Settings Panel (Glassmorphism) */
.settings-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-premium);
}

.settings-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.settings-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-right: 0.5rem;
    border-right: 1px solid var(--card-border);
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-item label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.setting-item input[type="text"],
.setting-item select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    outline: none;
    transition: var(--transition-smooth);
}

.setting-item input[type="text"]:focus,
.setting-item select:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 2px var(--accent-indigo-glow);
}

.setting-item input[type="text"] {
    width: 80px;
    text-align: center;
}

.setting-item select {
    cursor: pointer;
    padding-right: 1.5rem;
}

.checkbox-item {
    cursor: pointer;
    user-select: none;
}

.checkbox-item input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--accent-indigo);
    width: 16px;
    height: 16px;
}

/* Editors Split Screen */
.editors-split {
    display: flex;
    flex: 1;
    gap: 1rem;
    min-height: 0;
}

.editor-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    transition: var(--transition-smooth);
    min-height: 0;
}

.editor-card:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: var(--shadow-premium), 0 0 20px rgba(99, 102, 241, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(15, 23, 42, 0.3);
    border-bottom: 1px solid var(--card-border);
}

.pane-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.json-color { color: #f59e0b; }
.xml-color { color: #38bdf8; }

.card-body {
    flex: 1;
    display: flex;
    position: relative;
    background: rgba(15, 23, 42, 0.2);
    min-height: 0;
}

.editor-wrapper {
    display: flex;
    flex: 1;
    position: relative;
    min-height: 0;
}

.line-numbers {
    padding: 1.25rem 0.5rem 1.25rem 1rem;
    background: rgba(15, 23, 42, 0.4);
    border-right: 1px solid var(--card-border);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: #475569;
    text-align: right;
    user-select: none;
    line-height: 1.5;
    min-width: 3rem;
    height: 100%;
    overflow: hidden;
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 1.25rem;
    resize: none;
    tab-size: 4;
    overflow-y: auto;
    height: 100%;
}

/* Custom Scrollbars */
textarea::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

textarea::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

textarea::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1.25rem;
    background: rgba(15, 23, 42, 0.3);
    border-top: 1px solid var(--card-border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
}

.status-indicator.success { color: var(--color-success); }
.status-indicator.error { color: var(--color-error); }
.status-indicator.pending { color: var(--color-warning); }

/* Indicators & Controls */
.conversion-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem;
}

.arrow-container {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
    box-shadow: var(--shadow-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    cursor: default;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.55rem 1.25rem;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(to right, var(--accent-indigo), var(--accent-violet));
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--card-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.btn-icon:active {
    transform: scale(0.95);
}

/* Modal Drawer */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    display: flex;
    justify-content: flex-end;
    transition: var(--transition-smooth);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    height: 100%;
    background: rgba(20, 30, 50, 0.95);
    border-left: 1px solid var(--card-border);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.active .modal-content {
    transform: translateX(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-smooth);
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1.5rem;
}

.modal-body p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* API Spec CSS styling */
.api-endpoint {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.endpoint-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.method {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    color: white;
}

.method.post { background-color: var(--accent-indigo); }

.path {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.endpoint-desc {
    font-size: 0.85rem !important;
    margin-bottom: 1rem !important;
}

.api-endpoint h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.api-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.api-table th,
.api-table td {
    padding: 0.5rem;
    text-align: left;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--card-border);
}

.api-table th {
    color: var(--text-primary);
    font-weight: 600;
}

.api-table td {
    color: var(--text-secondary);
}

.api-endpoint pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--card-border);
    padding: 0.75rem;
    border-radius: 8px;
    overflow-x: auto;
}

.api-endpoint code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #a5b4fc;
}

/* Footer styling */
.app-footer {
    text-align: center;
    padding: 1rem 0 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--card-border);
    margin-top: 1rem;
}

.app-footer i {
    color: #f43f5e;
    margin: 0 0.15rem;
}

/* Responsiveness */
.mobile-only { display: none; }
.desktop-only { display: flex; }

@media (max-width: 900px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .app-container {
        padding: 1rem;
        height: auto;
        max-height: none;
        overflow: visible;
    }
    
    .editors-split {
        flex-direction: column;
        min-height: auto;
    }
    
    .editor-card {
        min-height: 350px;
    }

    .conversion-indicator {
        padding: 0.5rem 0;
    }

    .mobile-only { display: flex; }
    .desktop-only { display: none; }

    .settings-group {
        gap: 0.75rem;
    }
    
    .settings-title {
        border-right: none;
        width: 100%;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--card-border);
    }
}
