:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: rgba(37, 99, 235, 0.1);
    --bg-main: #f8f9fa;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --text-main: #000000;
    --text-muted: #475569;
    --border: #e2e8f0;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
}

#webgl-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

.hidden { display: none !important; }

/* --- Global Elements --- */
button {
    cursor: pointer;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: var(--transition);
}

.primary-btn {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.primary-btn.lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.secondary-btn {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.secondary-btn.lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.ghost-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
}

.ghost-btn:hover {
    color: var(--text-main);
}

.icon-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 50%;
}

.icon-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* --- Glass Nav --- */
.glass-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: transparent;
    backdrop-filter: none;
    border-bottom: none;
}

.nav-container {
    width: 100%;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5%;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-nav {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Hero Section --- */
.hero-section {
    padding: 140px 2.5% 80px;
    max-width: 1760px;
    width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    background: transparent;
}

.hero-content {
    animation: fadeInUp 0.8s ease-out;
}

.badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.hero-content h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-family: 'Outfit', sans-serif;
}

.hero-content h1 span {
    color: var(--primary);
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 600px;
}

.hero-actions {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.hero-trust {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hero-trust span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.trust-icons {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.hero-preview {
    position: relative;
    animation: fadeInRight 1s ease-out;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 680px;
    padding-bottom: 60px;
}

.preview-card {
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.08);
    padding: 12px;
    position: absolute;
    width: 340px;
    bottom: 60px;
    transform-origin: bottom center;
    transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 16px 50px rgba(0,0,0,0.2);
}

/* Fan from bottom-center pivot — like playing cards held in a hand */
.preview-card:nth-child(1) { transform: rotate(-30deg); z-index: 1; }
.preview-card:nth-child(2) { transform: rotate(-10deg); z-index: 2; }
.preview-card:nth-child(3) { transform: rotate(10deg);  z-index: 3; }
.preview-card:nth-child(4) { transform: rotate(28deg);  z-index: 4; box-shadow: 0 20px 55px rgba(0,0,0,0.25); }

/* On hover — fan spreads wider */
.hero-preview:hover .preview-card:nth-child(1) { transform: rotate(-38deg); }
.hero-preview:hover .preview-card:nth-child(2) { transform: rotate(-14deg); }
.hero-preview:hover .preview-card:nth-child(3) { transform: rotate(14deg); }
.hero-preview:hover .preview-card:nth-child(4) { transform: rotate(36deg); }

.preview-mockup {
    background: linear-gradient(to bottom, #e2e8f0, #cbd5e1);
    aspect-ratio: 1/1.4;
    border-radius: var(--radius-md);
}

.floating-stat {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: #fff;
    color: #0f172a;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
    z-index: 20;
}

/* --- Templates View --- */
.templates-grid-container {
    padding: 100px 2.5% 50px;
    max-width: 1760px;
    margin: 0 auto;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.template-card {
    background: #ffffff;
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: var(--transition);
}

.template-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-light);
}

.template-thumb {
    aspect-ratio: 1/1.4;
    background: var(--bg-main);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.template-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.template-card:hover .template-thumb img {
    transform: scale(1.05) rotate(-1deg);
}

.template-thumb::after {
    content: 'Use Template';
    position: absolute;
    inset: 0;
    background: rgba(99, 102, 241, 0.9);
    color: white;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    z-index: 2;
}

.template-card:hover .template-thumb::after {
    opacity: 1;
}

.template-info {
    padding: 1.25rem;
}

.template-info h4 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.template-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --- Editor Layout (FlowCV Style) --- */
#editor-view {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.editor-nav {
    height: 60px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: var(--bg-card);
}

.editor-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr 1fr;
    overflow: hidden;
}

.editor-sidebar {
    background: #f8f9fa;
    backdrop-filter: blur(8px);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
}

.section-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.section-nav-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    justify-content: flex-start;
    background: transparent;
    color: var(--text-muted);
}

.section-nav-btn:hover, .section-nav-btn.active {
    background: var(--primary-light);
    color: var(--primary);
}

.editor-form-container {
    padding: 2.5rem;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: #ffffff;
    backdrop-filter: blur(4px);
}

.section-form h2 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 2rem;
    font-size: 1.75rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group.full { grid-column: span 2; }

.input-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input-group input, .input-group textarea, .input-group select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    color: var(--text-main);
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--primary);
    background: #ffffff;
}

.editor-preview {
    background: #cbd5e1;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
}

.preview-frame-container {
    width: 100%;
    min-height: 1200px;
    background: #cbd5e1;
    overflow: visible;
    position: relative;
    flex-shrink: 0;
}

#resume-preview-iframe {
    width: 100%;
    height: 1200px;
    border: none;
    display: block;
    overflow: hidden;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- Toast --- */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 2000;
}

.toast {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.15rem;
    animation: slideInRight 0.3s ease-out;
    pointer-events: none;
}

.toast.error {
    color: #ef4444;
}

.toast.info {
    color: var(--primary);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 992px) {
    .glass-nav .nav-container {
        flex-direction: row;
        height: 60px;
        padding: 0 1rem;
    }

    .logo-text { font-size: 1.1rem; }
    .logo-icon { width: 24px; height: 24px; }

    .hero-section {
        grid-template-columns: 1fr;
        padding: 120px 1.5rem 60px;
        text-align: center;
    }

    .hero-content h1 { font-size: 2.5rem; }
    .hero-content p { font-size: 1rem; }

    .hero-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-actions button { width: 100%; justify-content: center; }

    .hero-preview { display: none; } /* Hide heavy 3D preview on mobile for performance */

    .editor-layout {
        display: block;
        height: auto;
        overflow-y: visible;
    }

    .editor-nav {
        flex-direction: column;
        height: auto;
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .editor-nav .nav-left, .editor-nav .nav-right {
        width: 100%;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .resume-title-edit { flex: 1; margin: 0 0.5rem; }
    #resume-title-input { width: 100%; font-size: 0.9rem; }

    .editor-sidebar {
        width: 100%;
        padding: 0.5rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        background: var(--bg-card);
        overflow-x: auto; /* Enable horizontal scroll for the container */
    }

    .section-list {
        display: grid;
        grid-template-rows: repeat(3, auto); /* 3 Lines/Rows */
        grid-auto-flow: column; /* Flow into columns to enable horizontal scroll */
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .section-nav-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        min-width: 120px; /* Ensure enough width for labels */
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
    }


    .editor-form-container {
        padding: 1.5rem 1rem;
        min-height: auto;
    }

    .form-grid { grid-template-columns: 1fr; gap: 1rem; }
    .input-group.full { grid-column: 1; }

    .editor-preview {
        flex-direction: column;
        align-items: center;
        padding: 1rem;
        background: #1e293b;
        min-height: auto;
    }

    #zoom-check-trigger-btn {
        display: inline-flex !important;
    }

    .preview-frame-container {
        position: relative !important;
        overflow: hidden !important;
        background: #1e293b !important;
        border-radius: var(--radius-sm) !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        width: 100% !important;
        height: 600px; /* fallback */
    }

    .templates-grid-container { padding: 80px 1rem 40px; }
    .template-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}


/* --- Modals --- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

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

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

/* --- ATS Score Circle --- */
.ats-score-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2.5rem;
}

.score-circle {
    position: relative;
    width: 160px;
    height: 160px;
}

.score-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: var(--bg-main);
    stroke-width: 2.8;
}

.circle {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2.8;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease-in-out;
}

.score-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#ats-percentage {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

#ats-grade {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 600;
}

.modal-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.modal-tab-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
}

.modal-tab-btn:hover {
    color: var(--text-main);
}

.modal-tab-btn.active {
    background: var(--primary-light);
    color: var(--primary);
}

.tab-pane.hidden {
    display: none;
}

/* --- Spinner & Loading --- */
.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-ats-loading {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.feedback-item.passed {
    border-left: 4px solid #22c55e;
}

.feedback-item.failed {
    border-left: 4px solid #ef4444;
}

/* --- Sidebar Tabs --- */
.sidebar-tabs {
    display: flex;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    margin-bottom: 1.5rem;
    gap: 0.25rem;
}

.sidebar-tab-btn {
    flex: 1;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    justify-content: center;
}

.sidebar-tab-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-md);
}

.sidebar-panels {
    position: relative;
    height: calc(100% - 60px);
}

.panel {
    display: none;
    height: 100%;
}

.panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.sidebar-ats-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.mini-score {
    text-align: center;
    margin-bottom: 1.5rem;
}

.mini-score span {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}

.mini-score label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mini-feedback {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mini-feedback p {
    font-size: 0.85rem;
    padding: 0.75rem;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.primary-btn.sm.full {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.85rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Resume Title Editor */
.resume-title-edit {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    padding: 0.2rem 0;
    border: none;
    transition: var(--transition);
}

#resume-title-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    outline: none;
    color: #0f172a;
    font-size: 1.05rem;
    font-weight: 600;
    width: 180px;
    font-family: 'Outfit', sans-serif;
    transition: var(--transition);
    padding: 0.1rem 0;
}

#resume-title-input:focus {
    border-bottom-color: var(--primary);
}

.save-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 100px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.save-status i {
    width: 13px;
    height: 13px;
    stroke-width: 3;
}

/* Save status state badges */
.save-status.saved {
    color: #10b981;
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.15);
}

.save-status.saving {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.15);
}

.save-status.failed {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
}

.save-status.info {
    color: var(--primary);
    background: var(--primary-light);
    border-color: rgba(37, 99, 235, 0.15);
}

/* Editor Navigation */
.editor-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #ffffff;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    height: 64px;
}

.editor-nav .nav-left, .editor-nav .nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Category Filters */
.category-filters {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.3rem;
    border-radius: 100px;
    border: 1px solid var(--border);
}

.filter-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem 1.2rem;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    outline: none;
}

.filter-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
}

.section-nav-btn {
    cursor: grab;
}

.section-nav-btn:active {
    cursor: grabbing;
}

.section-nav-btn.dragging {
    opacity: 0.5;
    background: var(--primary);
    color: white;
}

.drag-handle {
    opacity: 0.5;
    margin-right: 0.5rem;
}

.sidebar-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 0.5rem;
    font-style: italic;
}

/* Mobile Download FAB */
.mobile-only-btn {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.mobile-only-btn:hover {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.mobile-only-btn i {
    width: 28px;
    height: 28px;
}

@media (max-width: 992px) {
    .mobile-only-btn {
        display: flex;
    }
}



/* Mobile Footer Action (At the end of page) */
.mobile-footer-action {
    display: none;
    padding: 2rem 1rem 4rem;
    background: var(--bg-main);
    text-align: center;
}

.mobile-footer-action .primary-btn.full.beautiful-btn {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1.2rem;
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    border-radius: var(--radius-lg);
    box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 992px) {
    .mobile-footer-action {
        display: block;
    }
    .mobile-bottom-bar {
        display: none !important;
    }
    .editor-layout {
        padding-bottom: 0;
    }
}

/* PERFORMANCE OPTIMIZATION: Disable expensive glassmorphism effects on mobile */
@media (max-width: 768px) {
    * {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

}

/* --- OTP Auth Modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #ffffff;
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal.hidden .modal-content {
    transform: translateY(20px);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-modal:hover {
    background: #f1f5f9;
    color: #0f172a;
    transform: rotate(90deg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-header h2 {
    font-size: 2rem;
    color: #0f172a;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: #64748b;
    font-size: 1.1rem;
}

.auth-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
}

.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.auth-tab:hover {
    color: #3b82f6;
}

.auth-tab.active {
    color: #3b82f6;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: #3b82f6;
    border-radius: 3px 3px 0 0;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.primary-btn.w-100 {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    margin-top: 1rem;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    box-shadow: 0 4px 15px -3px rgba(59, 130, 246, 0.4);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.primary-btn.w-100:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(59, 130, 246, 0.5);
}

.text-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.text-btn:hover {
    color: #3b82f6;
    text-decoration: underline;
}

/* --- Mobile Responsiveness for Auth Modal --- */
@media (max-width: 500px) {
    .modal {
        padding: 1rem;
    }

    .modal-content {
        padding: 2rem 1.5rem;
        border-radius: 20px;
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .auth-header h2 {
        font-size: 1.5rem;
    }
    
    .auth-header p {
        font-size: 0.95rem;
    }

    .auth-tab {
        padding: 0.75rem;
        font-size: 1rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-group input {
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
    }
    
    .primary-btn.w-100 {
        padding: 0.85rem;
        font-size: 1rem;
    }
}
