/* Variables & Base Styles */
:root {
    --bg-main: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-input: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent: #4f46e5;
    --accent-glow: rgba(79, 70, 229, 0.15);
    --border: rgba(15, 23, 42, 0.08);
    --font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 15px var(--accent-glow);
}

.logo-text h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Workspace */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    position: relative;
    padding: 0;
    overflow: hidden;
}

/* Hide Utility */
.hide {
    display: none !important;
}

/* Upload Zone */
.upload-zone {
    width: 100%;
    max-width: 600px;
    background: var(--bg-card);
    border: 2px dashed rgba(15, 23, 42, 0.12);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(12px);
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.08);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(79, 70, 229, 0.04);
    box-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.15);
}

.upload-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.upload-icon-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
    position: relative;
}

.upload-icon-wrapper i {
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.upload-icon-wrapper .file-icon {
    transform: translateX(10px) scale(0.9);
}

.upload-icon-wrapper .book-icon {
    transform: translateX(-10px) scale(0.9);
    color: var(--accent);
}

.upload-icon-wrapper .loop-icon {
    width: 24px;
    height: 24px;
    color: var(--accent);
    opacity: 0.8;
}

.upload-zone:hover .file-icon {
    transform: translateX(-5px) scale(1.05);
}

.upload-zone:hover .book-icon {
    transform: translateX(5px) scale(1.05);
}

.upload-card h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.upload-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 320px;
    line-height: 1.5;
    margin-bottom: 8px;
}

/* Loader Screen */
.loader-screen {
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 40px 60px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.06);
    max-width: 450px;
    width: 100%;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(15, 23, 42, 0.08);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0 10px;
    border: 1px solid var(--border);
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a855f7);
    transition: width 0.2s ease;
}

.loader-screen p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

/* Interactive Flipbook Workspace (Fullscreen Popup Modal) */
.flipbook-workspace {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.workspace-modal {
    width: 96vw;
    height: 94vh;
    background: #f8fafc;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
}

.modal-header {
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.modal-header-left, .modal-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 150px;
}

.modal-header-right {
    justify-content: flex-end;
}

.modal-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f5f9;
    background-image: radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.04) 1px, transparent 0);
    background-size: 24px 24px;
}

.modal-body .customizer-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 220px;
}

/* 3D Book Layout - StPageFlip */
.book-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    flex: 1;
    overflow: visible;   /* allow flip animation to extend beyond book bounds */
    margin-top: 10px;
    margin-bottom: 20px;
    position: relative;
}

/* StPageFlip renders into #book */
#book {
    position: relative;
}

/* Force StPageFlip internal wrappers transparent */
.stf__parent,
.stf__wrapper {
    background: transparent !important;
}

/* Each .page div loaded by StPageFlip */
.page {
    background: #ffffff;
    overflow: hidden;
}

.page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #fff;
}


/* Navigation Controls Bar - Moved to the right side */
.controls-bar {
    position: relative;
    margin: 20px auto 10px auto;
    width: fit-content;
    z-index: 10;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.page-indicator {
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 90px;
    text-align: center;
    color: var(--text-primary);
}

.control-divider {
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 4px;
}

/* Side Navigation Page Turn Arrows */
.side-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    transition: var(--transition);
    z-index: 10;
}
.side-nav-arrow:hover {
    background: #fff;
    color: var(--accent);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.15);
    transform: translateY(-50%) scale(1.06);
}
.side-nav-arrow.left {
    left: 260px; /* offset from theme customizer panel */
}
.side-nav-arrow.right {
    right: 30px;
}
.side-nav-arrow i {
    width: 20px;
    height: 20px;
}

/* Buttons */
.primary-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.primary-btn:hover {
    transform: translateY(-1px);
    opacity: 0.95;
    box-shadow: 0 6px 16px var(--accent-glow);
}

.secondary-btn {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.secondary-btn:hover {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.15);
}

.icon-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--text-primary);
    border-color: rgba(15, 23, 42, 0.15);
    background: rgba(15, 23, 42, 0.04);
}

.icon-btn i {
    width: 15px;
    height: 15px;
}

/* Modal overlays for custom alerts/confirm dialogs */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.15);
    backdrop-filter: blur(16px);
}

/* User Display in Header */
.user-email-display {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 8px;
}

/* Authentication Screen Layout */
.auth-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: url('bg.jpg') center/cover no-repeat, radial-gradient(circle at 10% 20%, #a2f2e5 0%, transparent 60%), radial-gradient(circle at 80% 90%, #d4f7de 0%, transparent 60%), radial-gradient(circle at 50% 50%, #b3f0e8 0%, transparent 70%), #d1f4ec;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
    overflow: hidden;
}

/* Subtle dot-grid overlay to look like Linear/Vercel/Stripe */
.auth-screen::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(rgba(99, 102, 241, 0.08) 1.5px, transparent 1.5px);
    background-size: 28px 28px;
    z-index: 1;
    pointer-events: none;
}

/* Glowing Mesh Background Blobs (Vibrant colors to be clearly visible) */
.auth-bg-blob {
    position: absolute;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.55;
    z-index: 0;
    animation: blob-drift 25s infinite alternate ease-in-out;
}

.blob-1 {
    background: radial-gradient(circle, rgba(129, 140, 248, 0.8) 0%, rgba(199, 210, 254, 0) 70%);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.blob-2 {
    background: radial-gradient(circle, rgba(167, 139, 250, 0.8) 0%, rgba(221, 214, 254, 0) 70%);
    bottom: -250px;
    right: -150px;
    animation-delay: 4s;
    animation-duration: 32s;
}

.blob-3 {
    background: radial-gradient(circle, rgba(253, 164, 175, 0.6) 0%, rgba(254, 205, 211, 0) 70%);
    top: 20%;
    left: 40%;
    width: 500px;
    height: 500px;
    opacity: 0.35;
    animation-delay: 8s;
    animation-duration: 20s;
}

@keyframes blob-drift {
    0% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(140px, -100px) scale(1.15);
    }
    66% {
        transform: translate(-80px, 120px) scale(0.9);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}

/* Solar System Background */
.solar-system {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0; left: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12vw;
    z-index: 1;
    overflow: hidden;
}

/* Starry space background */
.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.45) 1px, transparent 40px),
        radial-gradient(rgba(255, 255, 255, 0.3) 1.5px, transparent 30px),
        radial-gradient(rgba(255, 255, 255, 0.2) 2px, transparent 50px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    opacity: 0.5;
    z-index: 0;
}

/* Central glowing sun (placed behind card) */
.sun {
    position: absolute;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, #fef08a 0%, #f59e0b 50%, rgba(245, 158, 11, 0) 100%);
    border-radius: 50%;
    box-shadow: 0 0 100px rgba(245, 158, 11, 0.55);
    filter: blur(2px);
    z-index: 1;
}

/* Concentric orbital paths */
.orbit {
    position: absolute;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: orbit-spin linear infinite;
    z-index: 1;
}

/* Planet element base */
.planet {
    position: absolute;
    border-radius: 50%;
}

/* Define orbits & planet elements */
.mercury-orbit {
    width: 320px;
    height: 320px;
    animation-duration: 10s;
}
.mercury {
    width: 8px; height: 8px;
    background: #94a3b8;
    top: -4px; left: calc(50% - 4px);
    box-shadow: 0 0 8px #94a3b8;
}

.venus-orbit {
    width: 440px;
    height: 440px;
    animation-duration: 18s;
}
.venus {
    width: 14px; height: 14px;
    background: #f59e0b;
    top: -7px; left: calc(50% - 7px);
    box-shadow: 0 0 10px #f59e0b;
}

.earth-orbit {
    width: 580px;
    height: 580px;
    animation-duration: 25s;
}
.earth {
    width: 18px; height: 18px;
    background: #3b82f6;
    top: -9px; left: calc(50% - 9px);
    box-shadow: 0 0 12px #3b82f6;
}

.mars-orbit {
    width: 720px;
    height: 720px;
    animation-duration: 35s;
}
.mars {
    width: 12px; height: 12px;
    background: #ef4444;
    top: -6px; left: calc(50% - 6px);
    box-shadow: 0 0 10px #ef4444;
}

.jupiter-orbit {
    width: 900px;
    height: 900px;
    animation-duration: 60s;
}
.jupiter {
    width: 28px; height: 28px;
    background: #d97706;
    top: -14px; left: calc(50% - 14px);
    box-shadow: 0 0 16px #d97706;
}

.auth-card {
    position: relative;
    z-index: 2;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    width: 100%;
    max-width: 400px;
}

@keyframes orbit-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.auth-logo {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.auth-logo h2 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-logo span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.auth-tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: calc(var(--radius-md) - 3px);
    transition: var(--transition);
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 10px var(--accent-glow);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    padding: 12px 14px 12px 42px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.auth-submit-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    margin-top: 10px;
}

.auth-error-box {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #b91c1c;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    text-align: left;
    line-height: 1.4;
}

.auth-error-box.success {
    background: rgba(16, 185, 129, 0.08) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    color: #047857 !important;
}

.auth-link:hover {
    color: var(--accent) !important;
    text-decoration: underline !important;
}

/* Sidebar Navigation Layout */
.app-sidebar {
    width: 70px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 0;
    gap: 20px;
    z-index: 10;
    flex-shrink: 0;
}
.sidebar-nav-item {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    border: none;
    background: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.sidebar-nav-item:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}
.sidebar-nav-item.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px var(--accent-glow);
}
.sidebar-nav-item i {
    width: 20px;
    height: 20px;
}

/* Tab Content View Containers */
.view-studio, .view-analytics {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow-y: auto;
    height: calc(100vh - 70px);
    position: relative;
}

.view-studio {
    background-color: var(--bg-app);
    background-image: radial-gradient(circle at 1px 1px, rgba(15, 23, 42, 0.05) 1px, transparent 0);
    background-size: 32px 32px;
    transition: background 0.4s ease;
}

/* Theme Customizer Overlay Panel */

.customizer-panel h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.customizer-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.customizer-section label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.theme-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.theme-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition);
    width: 100%;
    text-align: left;
}
.theme-opt:hover {
    background: #fff;
    border-color: rgba(79, 70, 229, 0.25);
}
.theme-opt.active {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.06);
}
.preview-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Background Theme States */
.modal-body.theme-sunset {
    background: linear-gradient(135deg, #fecdd3 0%, #ffedd5 50%, #fef08a 100%) !important;
    background-image: radial-gradient(circle at 10% 20%, rgba(244, 63, 94, 0.05) 0%, transparent 40%),
                      linear-gradient(135deg, #fecdd3 0%, #ffedd5 50%, #fef08a 100%) !important;
}
.modal-body.theme-cosmic {
    background: radial-gradient(circle at top right, #311042, #1e1b4b 50%, #090514 100%) !important;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
                      radial-gradient(circle at top right, #311042, #1e1b4b 50%, #090514 100%) !important;
    background-size: 24px 24px, 100% 100% !important;
}
.modal-body.theme-botanical {
    background: linear-gradient(135deg, #d1fae5 0%, #f0fdf4 100%) !important;
    background-image: radial-gradient(circle at 50% 50%, rgba(5, 150, 105, 0.03) 1px, transparent 0),
                      linear-gradient(135deg, #d1fae5 0%, #f0fdf4 100%) !important;
    background-size: 20px 20px, 100% 100% !important;
}
.modal-body.theme-lavender {
    background: linear-gradient(135deg, #ddd6fe 0%, #f3e8ff 100%) !important;
    background-image: radial-gradient(circle at 1px 1px, rgba(124, 58, 237, 0.04) 1px, transparent 0),
                      linear-gradient(135deg, #ddd6fe 0%, #f3e8ff 100%) !important;
    background-size: 32px 32px, 100% 100% !important;
}

/* Analytics Dashboard Styles */
.view-analytics {
    align-items: flex-start;
    justify-content: flex-start;
    background: var(--bg-app);
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.analytics-header {
    margin-bottom: 30px;
}
.analytics-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.analytics-header p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
    margin-bottom: 30px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.01);
}
.stat-icon {
    width: 44px;
    height: 44px;
    background: rgba(79, 70, 229, 0.08);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}
.stat-icon i {
    width: 20px;
    height: 20px;
}
.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.stat-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
}
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    flex: 1;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.01);
}
.analytics-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.8rem;
}
.analytics-table th {
    background: var(--bg-input);
    padding: 12px 18px;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.analytics-table td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}
.analytics-table tbody tr:last-child td {
    border-bottom: none;
}
.analytics-table tr:hover td {
    background: rgba(79, 70, 229, 0.01);
}
.empty-row td {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px !important;
}

/* SaaS Plan Badges and Lock Overlays */
.plan-badge-free {
    background: rgba(15, 23, 42, 0.05) !important;
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: var(--text-primary) !important;
}
.plan-badge-pro {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(234, 179, 8, 0.05) 100%) !important;
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: #ca8a04 !important;
}

/* Locked status on download button */
.btn-locked {
    position: relative;
    opacity: 0.85;
}
.btn-locked::after {
    content: 'PRO';
    position: absolute;
    top: -6px;
    right: -6px;
    background: #eab308;
    color: #0f172a;
    font-size: 0.62rem;
    font-weight: 800;
    padding: 2px 4px;
    border-radius: 4px;
    border: 1.5px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    letter-spacing: 0.02em;
}

/* Watermark Footer on Shared Page */
.share-watermark {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.7);
    border-top: 1px solid rgba(255,255,255,0.08);
    font-weight: 500;
}
.share-watermark a {
    color: #eab308;
    text-decoration: none;
    font-weight: 700;
    margin-left: 6px;
    transition: color 0.2s ease;
}
.share-watermark a:hover {
    color: #fde047;
    text-decoration: underline;
}
.share-watermark-padding {
    padding-bottom: 40px !important;
}

/* --- Login Page Two-Column Layout --- */
.auth-wrapper {
    display: flex;
    width: 100%;
    max-width: 1100px; /* Expanded width */
    margin: 0 auto;
    padding: 0;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    z-index: 2;
    position: relative;
}

.auth-features-panel {
    flex: 1.1;
    display: flex;
    flex-direction: column;
    gap: 20px; /* Reduced gap */
    background: #e0f6f0; /* Stronger mint/cyan intensity matching screenshot */
    padding: 30px; /* Reduced padding */
    border-right: 1px solid #f0f0f5;
}

.features-header {
    text-align: left;
}

.features-main-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #1e1b4b 0%, #4f46e5 50%, #d946ef 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.features-subtitle {
    font-size: 1.02rem;
    color: #475569;
    margin-top: 6px;
    font-weight: 600;
}

.features-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg);
    padding: 16px; /* Reduced padding */
    box-shadow: 0 10px 30px rgba(91, 33, 182, 0.02), 0 1px 3px rgba(0, 0, 0, 0.01), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
}

.feature-card.free::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #94a3b8, #cbd5e1);
}

.feature-card.free {
    background: #eef9f8; /* Light cyan background for Free Plan */
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.feature-card.pro {
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: #eef9f8; /* Match Free Plan background exactly */
}

.feature-card.pro::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #a78bfa);
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    padding-bottom: 10px;
}

.plan-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e293b;
}

.feature-card.pro .plan-title {
    color: #4f46e5;
}

.plan-tag {
    font-size: 0.68rem;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.05);
    color: #64748b;
    padding: 3px 9px;
    border-radius: 6px;
    text-transform: uppercase;
}

.plan-price {
    font-size: 0.9rem;
    font-weight: 800;
    color: #4f46e5;
    background: rgba(99, 102, 241, 0.08);
    padding: 3px 9px;
    border-radius: 6px;
}

.plan-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.plan-features li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.feat-icon {
    width: 24px;
    height: 24px;
    padding: 5px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0px !important;
}

.feat-icon.check {
    background: rgba(148, 163, 184, 0.12);
    color: #475569;
}

.feat-icon.sparkle {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}

.plan-features li div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.plan-features li strong {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
}

.plan-features li span {
    font-size: 0.76rem;
    color: #64748b;
    line-height: 1.35;
}

.auth-login-panel {
    flex: 0.9;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px; /* Reduced padding */
}

/* Mobile responsive layout */
@media (max-width: 900px) {
    .auth-wrapper {
        flex-direction: column;
        gap: 40px;
        padding: 24px;
        overflow-y: auto;
        height: 100vh;
        justify-content: flex-start;
    }
    
    .auth-features-panel {
        width: 100%;
        flex: none;
    }
    
    .auth-login-panel {
        width: 100%;
        flex: none;
        justify-content: center;
        padding-bottom: 60px;
    }
    
    .auth-card {
        width: 100%;
        max-width: 100%;
    }
}

/* --- Billing Switch Toggles --- */
.billing-toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.billing-toggle-container.modal-toggle {
    justify-content: center;
    background: #f8fafc;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.toggle-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s;
}

.toggle-label.active {
    color: #4f46e5;
}

.discount-tag {
    font-size: 0.65rem;
    font-weight: 800;
    background: #eef2ff;
    color: #4f46e5;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

/* Switch styling */
.billing-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.billing-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.billing-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 22px;
}

.billing-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.billing-switch input:checked + .billing-slider {
    background-color: #4f46e5;
}

.billing-switch input:checked + .billing-slider:before {
    transform: translateX(20px);
}

@media (max-width: 768px), ((hover: none) and (pointer: coarse)) {
    #btn-first, #btn-last {
        display: none !important;
    }
    .controls-bar {
        gap: 8px !important;
        padding: 6px 12px !important;
        justify-content: center !important;
    }
    .controls-bar .icon-btn {
        width: 36px !important;
        height: 36px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    #btn-zoom-in, #btn-zoom-out {
        display: flex !important;
    }
}



.auth-tab-link.active { display: none !important; }
