/* Cambria font loaded from system locally on desktop, falling back to Caladea from Google Fonts on mobile. */

/* Design System Tokens */
:root {
    --ui-font: "SF Pro", "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --bg-main: #060814;          /* Super-rich deep obsidian night */
    --bg-card: #0b0f19;          /* Premium dark card background */
    --bg-input: #121826;         /* Modern deep input backdrop */
    --border-color: rgba(255, 255, 255, 0.08); /* Clean thin border */
    --border-hover: rgba(255, 255, 255, 0.16);
    
    --text-primary: #f8fafc;     /* Clean slate-50 white */
    --text-secondary: #94a3b8;   /* Muted slate-400 */
    --text-muted: #64748b;       /* slate-500 */
    
    --primary: #6366f1;          /* Indigo accent */
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.08);
    
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: rgba(239, 68, 68, 0.08);
    
    --success: #10b981;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    
    --radius-sm: 8px;            /* Sleek rounded corners */
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --preview-scale: 0.7;
    
    /* Cover customization variables (modified dynamically by JS) */
    --cover-font: 'Cambria', 'Caladea', Georgia, serif;
    --cover-accent: #000000;
    --cover-border-width: 3px;
    --cover-border-style: double;
    --cover-outer-radius: 0px;
    --cover-box-radius: 8px;
    --cover-box-border: 2.3px;
    --cover-font-size-adjust: 100%;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--ui-font);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.app-header {
    background: rgba(11, 15, 25, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: auto;
    height: 42px;
    max-width: 120px;
    object-fit: contain;
    border-radius: 0;
    background-color: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-logo:hover {
    transform: scale(1.05) rotate(3deg);
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
}

.brand-text h1 {
    font-size: 19px;
    font-weight: 800;
    font-family: var(--ui-font);
    line-height: 1.2;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.3px;
    text-align: left;
    margin: 0;
}

.brand-text p {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    letter-spacing: 0.1px;
    text-align: left;
    margin: 2px 0 0 0;
}



.header-stats span strong {
    font-weight: 700;
}

#download-count {
    color: #818cf8; /* Indigo accent glow */
}

#visitor-count {
    color: #34d399; /* Emerald accent glow */
}

.stat-separator {
    display: none !important; /* Hide outdated separator line */
}

.stat-icon {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.header-stats span:hover .stat-icon {
    opacity: 1;
}

.header-badge {
    background-color: var(--primary-light);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--ui-font);
}

.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(139, 92, 246, 0.25) 100%);
    color: #e0e7ff;
    border: 1px solid rgba(99, 102, 241, 0.4);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: var(--ui-font);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.pwa-install-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.45) 0%, rgba(139, 92, 246, 0.45) 100%);
    border-color: rgba(165, 180, 252, 0.7);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
}

.pwa-install-btn:active {
    transform: translateY(0);
}

.pwa-install-btn span {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    color: inherit !important;
    display: inline !important;
}

/* PWA Instruction Modal */
.pwa-guide-modal {
    max-width: 480px !important;
    padding: 28px 24px !important;
    text-align: left !important;
}

.pwa-guide-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.pwa-guide-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.pwa-guide-title h3 {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    font-family: var(--ui-font);
}

.pwa-guide-title p {
    font-size: 12px;
    color: var(--text-secondary);
}

.pwa-step-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.pwa-step-num {
    background: var(--primary);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.pwa-step-text h4 {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.pwa-step-text p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.pwa-step-text code {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11.5px;
}

/* Main Workspace */
.app-workspace {
    flex: 1;
    display: grid;
    grid-template-columns: 460px 1fr;
    height: calc(100vh - 145px); /* Header + Footer heights */
    overflow: hidden;
}

@media (max-width: 1024px) {
    body {
        height: auto !important;
        overflow: auto !important;
    }
    .app-container {
        height: auto !important;
        overflow: visible !important;
    }
    .app-workspace {
        grid-template-columns: 1fr !important;
        height: auto !important;
        overflow: visible !important;
    }
}

/* Control Panel */
.control-panel {
    background-color: var(--bg-main); /* Outer panel is deep obsidian */
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 24px;
    height: 100%;
    max-height: calc(100vh - 145px);
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .control-panel {
        height: auto !important;
        max-height: none !important;
        overflow-y: visible !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        padding: 16px !important;
    }
    .preview-panel {
        height: auto !important;
        min-height: 520px !important;
        max-height: 80vh !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .preview-toolbar {
        position: sticky !important;
        top: 0 !important;
        padding: 8px 12px !important;
    }
    .preview-viewport-scroll {
        padding: 14px 6px 30px !important;
    }
}

@media (max-width: 640px) {
    .toolbar-info {
        display: none !important;
    }
    .preview-toolbar {
        padding: 6px 8px !important;
        gap: 4px !important;
    }
    .preview-page-tabs {
        padding: 2px !important;
        gap: 2px !important;
    }
    .page-tab-btn {
        font-size: 10.5px !important;
        padding: 3px 6px !important;
    }
    .tool-btn {
        width: 28px !important;
        height: 28px !important;
    }
    .zoom-level {
        min-width: 32px !important;
        font-size: 11px !important;
    }
}

.card {
    display: flex;
    flex-direction: column;
    gap: 28px;
    background-color: var(--bg-card); /* Inner container is card */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-premium);
}

/* Tab Switcher */
.tabs-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background-color: rgba(6, 8, 20, 0.5); /* Semi-transparent obsidian */
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-family: var(--ui-font);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    border: 1px solid rgba(59, 130, 246, 0.25);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.tab-btn.active:hover {
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.45);
    transform: translateY(-0.5px);
}

/* Form Styles */
.form-group-section {
    border-top: none;
    padding-top: 0;
}

.form-group-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-family: var(--ui-font);
    letter-spacing: 0.5px;
}

.section-title-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-title-with-actions h3 {
    margin-bottom: 0;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-text:hover {
    text-decoration: underline;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }

.input-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--ui-font);
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.required {
    color: var(--danger);
    margin-left: 2px;
}

.input-field input,
.input-field select,
.input-field textarea {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--ui-font);
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-field input:hover,
.input-field select:hover,
.input-field textarea:hover {
    border-color: var(--border-hover);
    background-color: rgba(255, 255, 255, 0.03);
}

.input-field input:focus,
.input-field select:focus,
.input-field textarea:focus {
    border-color: var(--primary);
    background-color: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Premium Custom Select Chevron Arrow */
.input-field select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 40px;
    cursor: pointer;
    transition: background-image 0.2s ease, border-color 0.25s, box-shadow 0.25s, background-color 0.25s;
}

.input-field select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23818cf8' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 15l7-7 7 7'/%3E%3C/svg%3E") !important;
}

.input-field select option {
    background-color: #0b0f19 !important;
    color: #f8fafc !important;
    font-family: var(--ui-font) !important;
    font-size: 14px;
    padding: 12px !important;
}

.input-field input::placeholder {
    color: var(--text-muted);
}

/* Custom Date Input Container */
.custom-date-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    height: 42px;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-date-container:hover {
    border-color: var(--border-hover);
    background-color: rgba(255, 255, 255, 0.03);
}

.custom-date-value {
    font-size: 13.5px;
    color: #ffffff;
    font-family: var(--ui-font);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-date-icon {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    flex-shrink: 0;
    color: #94a3b8;
    pointer-events: none;
}

.custom-date-container input[type="date"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

/* File Upload Area */
.logo-upload-container {
    width: 100%;
}

.logo-upload-box {
    border: 2px dashed var(--border-color);
    background-color: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.logo-upload-box:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.upload-icon {
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.logo-upload-box:hover .upload-icon {
    color: var(--primary);
}

.upload-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.browse-link {
    color: var(--primary);
    font-weight: 600;
}

.upload-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.logo-preview-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: var(--radius-md);
}

.logo-preview-box img {
    height: 48px;
    max-width: 120px;
    object-fit: contain;
}

.remove-logo-btn {
    background-color: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.remove-logo-btn:hover {
    background-color: var(--danger);
    color: white;
}

/* Checkbox design */
.checkbox-field {
    margin-top: 4px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Customizer Sliders */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.slider-container input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    outline: none;
    padding: 0;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-hover);
}

.slider-value {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 38px;
    text-align: right;
}

/* Actions Blocks */
.actions-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-family: var(--ui-font);
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    text-decoration: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.97) !important;
}

.btn-large {
    padding: 15px 28px;
    font-size: 15px;
    border-radius: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.4);
    font-weight: 700;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 12px 25px -5px rgba(99, 102, 241, 0.45), 0 8px 10px -6px rgba(99, 102, 241, 0.45);
    border-color: rgba(99, 102, 241, 0.6);
}

.btn-primary svg:not(.spinner-icon) {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover svg:not(.spinner-icon) {
    transform: translateY(2px);
}

/* Loading Spinner Animation & Stability */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.animate-spin,
.spinner-icon {
    animation: spin 0.85s linear infinite !important;
    transform-origin: center center !important;
    display: inline-block !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
    transition: none !important;
    will-change: transform;
}

.btn-primary:hover .spinner-icon,
.btn-primary:active .spinner-icon,
.btn-primary:focus .spinner-icon {
    transform: none !important;
    transition: none !important;
}

.secondary-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    background-color: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.4);
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.2);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.02);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.btn-danger:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.35);
}

/* Panel Footer */
.panel-footer {
    margin-top: 16px;
}

.privacy-notice {
    display: flex;
    gap: 10px;
    background-color: rgba(31, 41, 55, 0.5);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.privacy-notice svg {
    flex-shrink: 0;
    color: var(--primary);
    margin-top: 2px;
}

/* Right Preview Panel */
.preview-panel {
    background-color: #060814;
    background-image: 
        radial-gradient(rgba(99, 102, 241, 0.08) 1px, transparent 1px),
        radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.preview-toolbar {
    background-color: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    gap: 8px;
}

.toolbar-info-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-info {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--ui-font);
}

.preview-page-tabs {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.page-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.page-tab-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.06);
}

.page-tab-btn.active {
    background: #4f46e5;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.tool-btn {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.zoom-level {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 38px;
    text-align: center;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background-color: var(--border-color);
    margin: 0 2px;
}

/* Preview Viewport Scroll Area */
.preview-viewport-scroll {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
    padding: 68px 10px 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    -webkit-overflow-scrolling: touch;
}

.preview-viewport-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: fit-content;
    padding: 10px 0;
    min-width: 0;
    width: fit-content;
}

.preview-viewport-center.stacked-pages {
    gap: 0;
}

/* THE A4 SHEET PAGE CONTAINER */
.a4-page-container {
    width: 210mm;
    height: 297mm;
    background-color: #ffffff;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.65), 0 10px 20px -8px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
    transform: scale(var(--preview-scale));
    transform-origin: top center;
    margin-left: calc(210mm * (var(--preview-scale) - 1) / 2);
    margin-right: calc(210mm * (var(--preview-scale) - 1) / 2);
    margin-bottom: calc(297mm * (var(--preview-scale) - 1) + 24px);
    color: #000000;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease-out;
    flex-shrink: 0;
}

/* CSS variables injected directly into HTML via style customizer */
.a4-page-container {
    font-family: var(--cover-font);
    font-size: var(--cover-font-size-adjust);
}

/* Footer Section */
.app-footer {
    background-color: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 28px;
    z-index: 10;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.footer-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.25s ease;
    background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom: 1px dashed rgba(129, 140, 248, 0.3);
    padding-bottom: 1px;
}

.footer-link:hover {
    border-bottom-color: rgba(129, 140, 248, 0.8);
    opacity: 0.9;
}

.footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap !important;
}

.footer-tag {
    background-color: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.15);
    padding: 5px 12px;
    border-radius: 100px;
    color: #a5b4fc;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    font-family: var(--ui-font);
    font-size: 11.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.2px;
    white-space: nowrap !important;
    flex-shrink: 0;
}

.footer-tag:hover {
    color: #ffffff;
    border-color: rgba(99, 102, 241, 0.35);
    background-color: rgba(99, 102, 241, 0.12);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
}

.footer-tag-icon {
    color: #a5b4fc;
    transition: all 0.25s ease;
}

.footer-tag:hover .footer-tag-icon {
    color: #ffffff;
    transform: rotate(-10deg) scale(1.05);
}

/* Form field error styling */
.input-field.error input {
    border-color: var(--danger);
    background-color: rgba(239, 68, 68, 0.05);
}

.input-field.error label {
    color: var(--danger);
}

.input-error-msg {
    font-size: 11px;
    color: var(--danger);
    margin-top: 2px;
}

/* ==========================================================================
   ACADEMIC COVER PAGE RENDERING STYLES (Inside A4 container)
   ========================================================================== */

.cover-page-inner {
    width: 100%;
    height: 100%;
    padding: calc(12mm * var(--cover-gap-scale, 1)) 10mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Fonts */
.a4-page-container.font-cambria {
    font-family: 'Cambria', 'Caladea', Georgia, serif;
}
.a4-page-container.font-times {
    font-family: "Times New Roman", Times, serif;
}
.a4-page-container.font-roboto {
    font-family: 'Roboto', sans-serif;
}
.a4-page-container.font-lato {
    font-family: 'Lato', sans-serif;
}
.a4-page-container.font-open-sans {
    font-family: 'Open Sans', sans-serif;
}
.a4-page-container.font-sf-pro {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro", "Segoe UI", system-ui, sans-serif;
}

/* Theme Accent Colors (Borders, Lines, Texts) */
.a4-page-container.theme-black { --accent-rgb: 0, 0, 0; --accent-hex: #000000; }
.a4-page-container.theme-navy { --accent-rgb: 0, 51, 102; --accent-hex: #003366; }
.a4-page-container.theme-green { --accent-rgb: 0, 77, 0; --accent-hex: #004d00; }
.a4-page-container.theme-crimson { --accent-rgb: 128, 0, 0; --accent-hex: #800000; }
.a4-page-container.theme-teal { --accent-rgb: 15, 118, 110; --accent-hex: #0f766e; }
.a4-page-container.theme-purple { --accent-rgb: 109, 40, 217; --accent-hex: #6d28d9; }
.a4-page-container.theme-terracotta { --accent-rgb: 194, 65, 12; --accent-hex: #c2410c; }
.a4-page-container.theme-slate { --accent-rgb: 71, 85, 105; --accent-hex: #475569; }
.a4-page-container.theme-burgundy { --accent-rgb: 159, 18, 57; --accent-hex: #9f1239; }
.a4-page-container.theme-midnight { --accent-rgb: 30, 58, 138; --accent-hex: #1e3a8a; }
.a4-page-container.theme-rose-gold { --accent-rgb: 190, 24, 93; --accent-hex: #be185d; }
.a4-page-container.theme-forest { --accent-rgb: 20, 83, 45; --accent-hex: #14532d; }
.a4-page-container.theme-bronze { --accent-rgb: 120, 53, 15; --accent-hex: #78350f; }
.a4-page-container.theme-cobalt { --accent-rgb: 29, 79, 216; --accent-hex: #1d4ed8; }
.a4-page-container.theme-coral { --accent-rgb: 234, 88, 12; --accent-hex: #ea580c; }
.a4-page-container.theme-olive { --accent-rgb: 63, 98, 18; --accent-hex: #3f6212; }

/* Dynamic Borders */
.a4-page-container.border-double .cover-page-inner::before {
    content: "";
    position: absolute;
    top: 8mm;
    bottom: 8mm;
    left: 8mm;
    right: 8mm;
    border: 4px double var(--accent-hex);
    border-radius: var(--cover-outer-radius);
    pointer-events: none;
}

.a4-page-container.border-medium .cover-page-inner::before {
    content: "";
    position: absolute;
    top: 8mm;
    bottom: 8mm;
    left: 8mm;
    right: 8mm;
    border: 2px solid var(--accent-hex);
    border-radius: var(--cover-outer-radius);
    pointer-events: none;
}

.a4-page-container.border-thin .cover-page-inner::before {
    content: "";
    position: absolute;
    top: 8mm;
    bottom: 8mm;
    left: 8mm;
    right: 8mm;
    border: 1px solid var(--accent-hex);
    border-radius: var(--cover-outer-radius);
    pointer-events: none;
}

.a4-page-container.border-thick .cover-page-inner::before {
    content: "";
    position: absolute;
    top: 8mm;
    bottom: 8mm;
    left: 8mm;
    right: 8mm;
    border: 4px solid var(--accent-hex);
    border-radius: var(--cover-outer-radius);
    pointer-events: none;
}

.a4-page-container.border-none .cover-page-inner::before {
    display: none;
}

/* --- TEMPLATE 1: DIU Style Layout --- */
.diu-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    margin-bottom: calc(8mm * var(--cover-gap-scale, 1));
}

.diu-logo {
    height: auto;
    max-height: var(--logo-height, 36mm) !important;
    width: auto;
    max-width: 95%;
    object-fit: contain;
    margin-bottom: 2mm;
    transition: max-height 0.15s ease;
}

.diu-university-name {
    font-size: 15pt;
    font-weight: 700;
    color: var(--accent-hex);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2mm;
    white-space: nowrap;
    -webkit-text-size-adjust: none !important;
    text-size-adjust: none !important;
}

.diu-dept-box {
    border: 3.5px solid var(--accent-hex);
    padding: 0mm 3mm;
    font-size: 24pt;
    font-weight: 700;
    color: var(--accent-hex);
    margin-bottom: -6mm;
    max-width: 95%;
    text-align: center;
}

.diu-dept-box.diu-dept-box-long {
    font-size: 18pt;
}

/* Decorative wings and pill for DIU title */
.diu-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: calc(5mm * var(--cover-gap-scale, 1)) 0 calc(9mm * var(--cover-gap-scale, 1));
    width: 100%;
}

.diu-title-pill {
    background-color: var(--cover-shape-bg, #e2e8f0);
    color: var(--cover-shape-color, #000000);
    font-weight: 700;
    font-size: 18pt;
    padding: 0 10mm;
    height: 12mm;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid var(--cover-shape-border, #cbd5e1);
    text-underline-offset: 4px;
    line-height: 1;
}

.diu-title-wings-left,
.diu-title-wings-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
}

.diu-title-wings-left span,
.diu-title-wings-right span {
    display: block;
    height: 2px;
    background-color: var(--cover-shape-wing-bg, #cbd5e1);
    border-radius: 2px;
}

.diu-title-wings-left span:nth-child(1) { width: 22px; align-self: flex-end; }
.diu-title-wings-left span:nth-child(2) { width: 32px; align-self: flex-end; }
.diu-title-wings-left span:nth-child(3) { width: 16px; align-self: flex-end; }

.diu-title-wings-right span:nth-child(1) { width: 22px; align-self: flex-start; }
.diu-title-wings-right span:nth-child(2) { width: 32px; align-self: flex-start; }
.diu-title-wings-right span:nth-child(3) { width: 16px; align-self: flex-start; }

/* Course & Expt Table info style */
.diu-info-section {
    width: 96%;
    margin: calc(4mm * var(--cover-gap-scale, 1)) auto calc(9mm * var(--cover-gap-scale, 1));
    font-size: 15pt;
    line-height: 0.8;
}

.diu-info-row {
    display: flex;
    margin-bottom: 2.2mm;
    align-items: flex-start;
}

.diu-info-label {
    font-weight: 700;
    color: #000000;
    flex-shrink: 0;
    line-height: 1.2;
}

.diu-info-colon {
    margin: 0 8px;
    font-weight: 700;
    color: #000000;
    flex-shrink: 0;
    line-height: 1.2;
}

.diu-info-value {
    flex-grow: 1;
    font-weight: 500;
    color: #000000;
    line-height: 1.2 !important;
}

/* Round boxes for student / teacher */
.diu-boxes-grid {
    display: flex;
    justify-content: space-between;
    width: 96%;
    margin-bottom: calc(10mm * var(--cover-gap-scale, 1));
    gap: 6mm;
}

.diu-card-box {
    width: 48%;
    border: var(--cover-box-border, 2.3px) solid var(--accent-hex);
    border-radius: var(--cover-box-radius);
    background-color: var(--cover-box-bg, transparent);
    padding: 3mm;
    min-height: 52mm;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.diu-box-title {
    font-size: 15pt;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 4mm;
    color: var(--accent-hex);
}

.diu-box-content {
    font-size: 15px;
    line-height: 1;
}

.diu-box-name {
    font-weight: 700;
    font-size: 15pt;
    margin-bottom: 3.5mm;
    color: #000000;
}

.diu-box-teacher-detail {
    font-size: 21px;
    margin-bottom: 1.5mm;
    color: #000000;
}

.diu-teacher-uni {
    white-space: nowrap !important;
    font-size: 21px !important;
    -webkit-text-size-adjust: none !important;
    text-size-adjust: none !important;
}

.diu-box-item {
    display: flex;
    margin-bottom: 1.5mm;
    font-size: 15pt;
}

.diu-box-item-label {
    font-weight: 500;
    flex-shrink: 0;
    color: #000000;
}

.diu-box-item-colon {
    margin: 0 6px;
    font-weight: 600;
    flex-shrink: 0;
    color: #000000;
}

.diu-box-item-val {
    flex-grow: 1;
    word-break: break-word;
    color: #000000;
}

/* Signature & submission footer */
.diu-footer-signatures {
    width: 96%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
    padding-bottom: 2mm;
}

.diu-submission-date {
    font-size: 15pt;
    font-weight: 400;
    color: #000000;
}

.diu-signature-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60mm;
}

.diu-sig-line {
    width: 100%;
    height: 1px;
    border-top: 1px dashed #000000;
    margin-bottom: 2mm;
}

.diu-sig-label {
    font-size: 15pt;
    font-weight: 600;
    text-align: center;
    color: #000000;
    white-space: nowrap;
}

/* --- TEMPLATE 2: Modern Academic Layout --- */
.modern-cover {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 18mm 16mm;
    box-sizing: border-box;
}

.modern-sidebar-accent {
    position: absolute;
    left: 8mm;
    top: 8mm;
    bottom: 8mm;
    width: 3mm;
    background-color: var(--accent-hex);
}

.modern-header {
    display: flex;
    align-items: center;
    gap: 6mm;
    margin-bottom: 12mm;
    width: 100%;
}

.modern-logo {
    height: 20mm;
    max-width: 35mm;
    object-fit: contain;
}

.modern-uni-info {
    display: flex;
    flex-direction: column;
}

.modern-uni-name {
    font-size: 15pt;
    font-weight: 700;
    color: var(--accent-hex);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.modern-dept-name {
    font-size: 10.5pt;
    color: #4b5563;
    font-weight: 500;
}

.modern-badge-row {
    display: flex;
    gap: 3mm;
    margin-bottom: 6mm;
}

.modern-badge {
    background-color: rgba(var(--accent-rgb), 0.08);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    color: var(--accent-hex);
    padding: 1.5mm 3.5mm;
    border-radius: 4px;
    font-size: 9.5pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modern-title-container {
    margin-bottom: 10mm;
    width: 100%;
}

.modern-title-pre {
    font-size: 10.5pt;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-hex);
    margin-bottom: 2mm;
}

.modern-title-text {
    font-size: 24pt;
    font-weight: 800;
    line-height: 1.25;
    color: #111827;
}

.modern-title-underline {
    width: 18mm;
    height: 4px;
    background-color: var(--accent-hex);
    margin-top: 4mm;
    border-radius: 2px;
}

.modern-details-section {
    width: 100%;
    margin-bottom: 10mm;
}

.modern-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6mm;
    width: 100%;
}

.modern-card {
    background-color: rgba(var(--accent-rgb), 0.02);
    border-left: 3px solid var(--accent-hex);
    padding: 4.5mm 5mm;
    border-radius: 0 4px 4px 0;
}

.modern-card-title {
    font-size: 9.5pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 3.5mm;
    color: var(--accent-hex);
}

.modern-card-row {
    display: flex;
    font-size: 9.5pt;
    margin-bottom: 1.5mm;
}

.modern-card-label {
    width: 24mm;
    font-weight: 600;
    color: #4b5563;
    flex-shrink: 0;
}

.modern-card-val {
    flex-grow: 1;
    font-weight: 500;
    color: #111827;
}

.modern-expt-card {
    grid-column: span 2;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-left: 3px solid var(--accent-hex);
    border-radius: 0 6px 6px 0;
    padding: 5mm 6mm;
}

.modern-expt-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3mm 4mm;
    font-size: 10pt;
}

.modern-expt-label {
    font-weight: 700;
    color: var(--accent-hex);
}

.modern-expt-val {
    color: #1f2937;
}

.modern-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
    width: 100%;
}

/* --- TEMPLATE 3: Minimal Academic Layout --- */
.minimal-cover {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 22mm 18mm;
    box-sizing: border-box;
    text-align: center;
}

.minimal-uni-name {
    font-size: 15pt;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 4mm;
    color: #111;
    white-space: nowrap;
}

.minimal-dept-name {
    font-size: 10.5pt;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #4b5563;
    margin-top: 1.5mm;
    margin-bottom: 6mm;
}

.minimal-divider {
    width: 40mm;
    height: 0.75px;
    background-color: #d1d5db;
    margin-bottom: 12mm;
}

.minimal-logo {
    height: 18mm;
    max-width: 32mm;
    object-fit: contain;
    filter: grayscale(1);
    opacity: 0.85;
    margin-bottom: 10mm;
}

.minimal-type-tag {
    font-size: 11pt;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--accent-hex);
    font-weight: 600;
    margin-bottom: 4mm;
}

.minimal-title-text {
    font-size: 21pt;
    font-weight: 700;
    line-height: 1.35;
    color: #111;
    max-width: 90%;
    margin-bottom: 8mm;
}

.minimal-meta-info {
    font-size: 10pt;
    color: #4b5563;
    margin-bottom: 14mm;
    display: flex;
    flex-direction: column;
    gap: 1.5mm;
}

.minimal-meta-info strong {
    color: #111;
}

.minimal-boxes-container {
    width: 92%;
    display: flex;
    justify-content: space-between;
    text-align: left;
    margin-bottom: 14mm;
}

.minimal-column {
    width: 45%;
}

.minimal-col-title {
    font-size: 9.5pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-hex);
    margin-bottom: 3.5mm;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1.5mm;
}

.minimal-col-text {
    font-size: 9.5pt;
    line-height: 1.7;
    color: #374151;
}

.minimal-col-text strong {
    color: #111;
}

.minimal-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 92%;
    margin-top: auto;
}

/* Hide print layout elements by default during preview */
#a4-preview-page .print-only {
    display: none !important;
}

/* ==========================================================================
   PRINT MEDIA QUERY STYLES (A4 Portrait Direct Print)
   ========================================================================== */
@media print {
    /* Hide everything except the app container and its preview page descendants */
    body > *:not(.app-container) {
        display: none !important;
    }
    
    .app-container {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        background: none !important;
    }
    
    .app-header,
    .app-footer,
    .control-panel,
    .preview-toolbar,
    .actions-block,
    .secondary-actions-grid,
    .btn,
    button {
        display: none !important;
    }
    
    .app-workspace {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .preview-panel {
        display: block !important;
        background-color: #ffffff !important;
        background-image: none !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .preview-viewport-scroll {
        display: block !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .preview-viewport-center {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Print page styling override */
    .a4-page-container {
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        width: 210mm !important;
        height: 297mm !important;
        margin: 0 !important;
        box-shadow: none !important;
        transform: none !important;
        page-break-after: always !important;
        break-after: page !important;
        overflow: hidden !important;
    }

    .a4-page-container:last-of-type {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    @page {
        size: A4 portrait;
        margin: 0;
    }
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVENESS OVERRIDES
   ========================================================================== */

/* Tablet & Mobile Layout Adjustment */
@media (max-width: 1024px) {
    /* Limit A4 visual container width to fit mobile screen and prevent extra whitespace */
    .preview-viewport-scroll {
        overflow-x: hidden;
        padding: 70px 10px 20px;
    }
    
    .preview-viewport-center {
        padding: 5px;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    /* Style the relocated actions block and privacy footer under the preview page */
    .app-workspace > .actions-block {
        background-color: var(--bg-card);
        padding: 24px 16px;
        margin: 0;
        border-top: 1px solid var(--border-color);
    }
    
    .app-workspace > .panel-footer {
        background-color: var(--bg-card);
        padding: 0 16px 24px;
        margin: 0;
    }
}

/* Medium Screens and Small Tablets */
@media (max-width: 768px) {
    .header-brand {
        gap: 8px;
    }
    
    .brand-logo {
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

    .brand-text h1 {
        font-size: 15px;
    }

    .brand-text p {
        font-size: 10px;
    }

    .control-panel {
        padding: 16px;
    }

    .form-group-section {
        padding: 16px;
        margin-bottom: 16px;
    }

    .actions-block {
        padding-top: 16px;
    }
}

/* Small Screens and Mobile Phones */
@media (max-width: 600px) {
    .app-header {
        position: relative !important;
        padding: 10px 14px !important;
        background: rgba(11, 15, 25, 0.9) !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        display: flex !important;
        flex-direction: row !important;
        justify-content: flex-start !important;
        align-items: center !important;
    }

    .header-left-wrap {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 12px !important;
        width: 100% !important;
        flex-wrap: nowrap !important;
        position: static !important;
    }

    .mobile-menu-toggle {
        display: inline-flex !important;
        position: static !important;
        transform: none !important;
        width: 38px !important;
        height: 38px !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
    }

    .header-brand {
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        margin: 0 !important;
        flex: 1 !important;
        min-width: 0 !important;
        flex-wrap: nowrap !important;
    }

    .brand-logo {
        width: auto !important;
        height: 34px !important;
        max-width: 70px !important;
        flex-shrink: 0 !important;
        padding: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin: 0 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .brand-text {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        text-align: left !important;
        min-width: 0 !important;
        flex: 1 !important;
    }

    .brand-text h1 {
        font-size: 14.5px !important;
        letter-spacing: -0.02em;
        font-weight: 800;
        line-height: 1.15;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-align: left !important;
        margin: 0 !important;
    }

    .brand-text p {
        font-size: 9.5px !important;
        color: #94a3b8;
        opacity: 0.9;
        letter-spacing: 0.1px;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-align: left !important;
        margin: 2px 0 0 0 !important;
    }

    .header-badge {
        font-size: 10px;
        padding: 2px 8px;
    }

    .footer-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        align-items: center;
    }

    .footer-actions {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        justify-content: center !important;
        width: 100% !important;
    }

    .footer-tag {
        padding: 4px 8px !important;
        font-size: 11px !important;
        gap: 4px !important;
    }
}

/* Tiny mobile screens: stack form grids to 1 column */
@media (max-width: 480px) {
    .input-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .col-6, .col-4 {
        grid-column: span 12 !important;
    }

    .secondary-actions-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .btn {
        width: 100%;
        padding: 10px 8px;
        font-size: 13px;
    }
}

/* Premium Glassmorphic Stats Pill Styling (Two Separate Cards) */
.header-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.header-stats > span {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 18px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #cbd5e1;
    font-family: var(--ui-font);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.header-stats > span:hover {
    border-color: rgba(99, 102, 241, 0.25);
    background-color: rgba(255, 255, 255, 0.04);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.12);
    transform: translateY(-2px);
}

.stat-icon {
    flex-shrink: 0;
    opacity: 0.8;
}

/* Download/Generate style colors */
.header-stats > span:first-of-type .stat-icon {
    color: #818cf8;
}

/* Visitor style colors */
.header-stats > span:last-of-type .stat-icon {
    color: #34d399;
}

.header-stats strong {
    font-weight: 700;
    font-size: 13.5px;
}

.header-stats > span:first-of-type strong {
    color: #818cf8;
}

.header-stats > span:last-of-type strong {
    color: #34d399;
}

.stat-separator {
    display: none !important; /* Hide separator entirely */
}

@media (max-width: 600px) {
    .header-stats {
        margin-top: 4px;
        gap: 8px;
    }
    .header-stats span {
        padding: 6px 12px;
        font-size: 11px;
        border-radius: 10px;
    }
    .header-stats strong {
        font-size: 12px;
    }
    
    /* Control Panel Layout to Card List */
    .control-panel {
        padding: 16px 12px !important;
        background-color: #080c14 !important;
    }
    
    .form-group-section {
        background-color: var(--bg-card) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        padding: 0 !important; /* Clear duplicate padding on mobile container */
        border-radius: 12px;
        margin-bottom: 14px;
        backdrop-filter: none;
        box-shadow: none;
    }
    
    /* Accordion header and content padding for mobile */
    .accordion-header {
        padding: 14px 16px !important;
    }
    
    .accordion-header h3 {
        font-size: 15px !important;
        color: #ffffff;
        font-weight: 700;
        letter-spacing: 0.3px;
    }
    
    .accordion-content {
        padding: 0 16px !important;
    }
    
    .accordion-item.active .accordion-content {
        padding: 4px 16px 16px !important;
    }
    
    /* Input styles inside cards */
    .input-field label {
        font-size: 12.5px;
        font-weight: 600;
        color: var(--text-secondary);
        margin-bottom: 5px;
        letter-spacing: 0.3px;
        text-transform: uppercase;
        opacity: 0.9;
    }
    
    .input-field input, .input-field select, .input-field textarea {
        background-color: rgba(17, 24, 39, 0.7);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 12px;
        font-size: 15px; /* Larger font size to prevent iOS auto-zoom */
        color: #ffffff;
        padding: 12px 14px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        -webkit-appearance: none;
        appearance: none;
        outline: none;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .input-field select {
        padding-right: 38px !important;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") !important;
        background-repeat: no-repeat !important;
        background-position: right 14px center !important;
        background-size: 15px 15px !important;
    }
    
    .input-field input:focus, .input-field select:focus, .input-field textarea:focus {
        border-color: #818cf8;
        background-color: rgba(17, 24, 39, 0.95);
        box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.05);
        transform: translateY(-1px);
    }
    
    .input-field select:focus {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23818cf8' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 15l7-7 7 7'/%3E%3C/svg%3E") !important;
    }
    
    /* Tabs styling inside card */
    .tabs-container {
        border-radius: 12px;
        padding: 3px;
        background-color: rgba(17, 24, 39, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.08);
        margin-bottom: 8px;
    }
    
    .tab-btn {
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 8px;
    }
    
    /* Section subtitle action text button alignment */
    .section-title-with-actions {
        margin-bottom: 12px;
    }
    
    .btn-text {
        font-size: 12px;
    }
}

/* Developer Info Modal Styles (Premium Layout) */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6); /* Glassy dark overlay */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #0f172a; /* Deep slate premium background */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    width: 420px;
    max-width: 90%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 24px;
    padding: 24px;
}

.modal-backdrop.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: #94a3b8;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.dev-card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(16, 185, 129, 0.04) 50%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.dev-left {
    z-index: 1;
    flex-shrink: 0;
}

.dev-avatar-wrap {
    width: 104px;
    height: 104px;
    border-radius: 20px;
    background: #0f172a;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dev-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.dev-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.dev-uni {
    font-size: 11px;
    color: #10b981; /* Emerald branding */
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: 16px;
    font-family: var(--ui-font);
    white-space: nowrap; /* Ensure it stays on 1 line */
}

.dev-name {
    font-size: 22px;
    font-weight: 800; /* Extra Bold premium look */
    color: #ffffff;
    margin-bottom: 12px;
    font-family: var(--ui-font);
    letter-spacing: 0.05em; /* Elegant spacing for capitalized name */
    text-transform: uppercase; /* CAPITAL */
    line-height: 1.1;
}

.dev-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px; /* Muted spacing before dev-uni */
    flex-wrap: wrap;
}

.dev-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--ui-font);
}

.badge-dept {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.badge-batch {
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.15);
}

.badge-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.dev-portfolio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--ui-font);
    text-decoration: none;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: fit-content;
}

.dev-portfolio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.45);
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
}

.btn-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.dev-portfolio-btn:hover .btn-arrow {
    transform: translate(2px, -2px);
}

/* Make it stack on very narrow devices */
@media (max-width: 440px) {
    .modal-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 32px 24px;
        width: 300px;
        gap: 16px;
    }
    .dev-right {
        align-items: center;
    }
    .dev-badges {
        justify-content: center;
    }
    .dev-avatar-wrap {
        width: 90px;
        height: 90px;
    }
}

/* Ambient Background Glow */
.ambient-glow {
    position: fixed;
    top: -200px;
    left: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    filter: blur(80px);
    animation: pulseGlow 10s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    0% { transform: scale(1) translate(0, 0); opacity: 0.8; }
    100% { transform: scale(1.1) translate(50px, 50px); opacity: 1; }
}

.control-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Collapsible Form Accordions */
.accordion-item {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background-color: var(--bg-card) !important; /* Solid premium card background instead of dusty gray translucent overlays */
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.accordion-item:hover {
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.2);
}

.accordion-item.active {
    border-color: rgba(99, 102, 241, 0.25); /* Elegant active border highlight */
    background-color: var(--bg-card) !important;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

.accordion-header {
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.accordion-header:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.accordion-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 !important;
    font-family: var(--ui-font);
    letter-spacing: 0.3px;
}

.accordion-chevron {
    color: var(--text-secondary);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.accordion-item.active .accordion-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.22s cubic-bezier(0.16, 1, 0.3, 1), padding 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0 24px;
}

.accordion-item.active .accordion-content {
    max-height: 1200px;
    padding: 4px 24px 24px;
}

/* Quick Color Swatches */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.swatch:hover {
    transform: scale(1.15);
    border-color: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.swatch.active {
    transform: scale(1.1);
    border-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.45);
}

.swatch.active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Premium Custom Toggle Switch */
.switch-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.switch-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--ui-font);
}

.switch-container {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 34px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #94a3b8;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-container input:checked + .switch-slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

.switch-container input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

/* Glass Fullscreen Download Loader */
.glass-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(6, 8, 20, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.glass-loader-overlay.fade-out {
    opacity: 0;
}

.glass-loader-card {
    background-color: rgba(11, 15, 25, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 40px 48px;
    border-radius: 20px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 400px;
    text-align: center;
}

.loader-spinner-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 40%, var(--primary) 100%);
    animation: spin 0.95s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3.5px;
    box-sizing: border-box;
}

.spinner-core {
    width: 100%;
    height: 100%;
    background-color: #0b0f19;
    border-radius: 50%;
}

.loader-text-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loader-title {
    font-family: var(--ui-font);
    font-size: 19px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: 0.2px;
}

.loader-status {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
    height: 18px;
}

.loader-progress-bar {
    width: 100%;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    overflow: hidden;
    margin-top: 6px;
}

.loader-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #a5b4fc 100%);
    border-radius: 100px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Premium Custom Toggle Switch */
.switch-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.switch-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--ui-font);
}

.switch-container {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 34px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #94a3b8;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-container input:checked + .switch-slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

.switch-container input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

/* Glass Fullscreen Download Loader */
.glass-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(6, 8, 20, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.glass-loader-overlay.fade-out {
    opacity: 0;
}

.glass-loader-card {
    background-color: rgba(11, 15, 25, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 40px 48px;
    border-radius: 20px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 400px;
    text-align: center;
}

.loader-spinner-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 40%, var(--primary) 100%);
    animation: spin 0.95s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3.5px;
    box-sizing: border-box;
}

.spinner-core {
    width: 100%;
    height: 100%;
    background-color: #0b0f19;
    border-radius: 50%;
}

.loader-text-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loader-title {
    font-family: var(--ui-font);
    font-size: 19px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: 0.2px;
}

.loader-status {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
    height: 18px;
}

.loader-progress-bar {
    width: 100%;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    overflow: hidden;
    margin-top: 6px;
}

.loader-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #a5b4fc 100%);
    border-radius: 100px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (min-width: 601px) {
    .modal-backdrop {
        align-items: flex-end !important;
        justify-content: flex-end !important;
        padding: 40px !important;
        background-color: rgba(6, 8, 20, 0.2) !important;
        backdrop-filter: blur(2px) !important;
        -webkit-backdrop-filter: blur(2px) !important;
    }
    
    #pwa-guide-modal {
        align-items: center !important;
        justify-content: center !important;
        background-color: rgba(6, 8, 20, 0.6) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
    }
    
    .modal-card {
        transform: translateY(40px) scale(0.95);
        margin-right: 0;
        margin-bottom: 0;
    }
    
    .modal-backdrop.active .modal-card {
        transform: translateY(0) scale(1) !important;
    }
}

/* Flex Row for keeping small inputs side-by-side on mobile */
.flex-row-mobile {
    display: flex !important;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

.flex-row-mobile > .input-field {
    margin-bottom: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.flex-row-mobile > .input-field > label {
    margin-top: 0;
    margin-bottom: auto;
    padding-bottom: 6px;
}

.num-field-mobile {
    flex: 1;
}

.date-field-mobile {
    flex: 1;
    text-align: right;
}

.date-field-mobile > label {
    text-align: right;
    width: 100%;
}

.date-field-mobile > input {
    text-align: right !important;
}

/* Custom Overlay Date Input */
.custom-date-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    height: 46px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 16px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-date-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.custom-date-value {
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--ui-font);
    margin-right: 28px;
    text-align: right;
    width: 100%;
    pointer-events: none;
}

.custom-date-icon {
    position: absolute;
    right: 16px;
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    pointer-events: none;
}

.custom-date-container input[type="date"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    cursor: pointer !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    -webkit-appearance: none !important;
}

@media (max-width: 480px) {
    .num-field-mobile {
        flex: 0 0 42% !important;
    }
    .date-field-mobile:not([style*="display: none"]) {
        flex: 1 !important;
    }
}

.date-field-mobile[style*="display: none"],
#experiment-date-col[style*="display: none"] {
    display: none !important;
    flex: 0 0 0% !important;
    width: 0 !important;
    max-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

/* FAQ Page Layout Styles */
body.faq-body {
    overflow: auto;
    height: auto;
    min-height: 100vh;
}

.faq-page-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 50px 24px;
    min-height: 100vh;
    background-color: var(--bg-main);
    overflow-y: auto;
    width: 100%;
}

.faq-page-card {
    background-color: transparent;
    border: none;
    border-radius: 0;
    width: 100%;
    max-width: 880px;
    padding: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.faq-back-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    transition: color 0.25s ease, transform 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
    width: fit-content;
    padding: 8px 16px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
}

.faq-back-nav:hover {
    color: var(--text-primary);
    transform: translateX(-4px);
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
}

.faq-back-nav svg {
    transition: transform 0.25s ease;
}

.faq-title {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    margin-top: 12px;
}

.faq-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: -8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 8px;
}

.faq-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-md);
    transition: border-color 0.25s ease, transform 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.faq-item:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background-color: rgba(11, 15, 25, 0.95);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px -10px rgba(99, 102, 241, 0.15);
}

.faq-question {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: 0.1px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.faq-question::before {
    content: "Q";
    font-size: 11px;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.faq-answer {
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--text-secondary);
    padding-left: 36px;
}

.faq-answer code {
    background-color: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.faq-answer strong {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .faq-page-wrapper {
        padding: 30px 16px;
    }
    .faq-title {
        font-size: 26px;
    }
    .faq-item {
        padding: 22px;
    }
    .faq-answer {
        padding-left: 0;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    .faq-title {
        font-size: 22px;
    }
}

/* In-App Browser Warning Banner & Fallback Modal Styles */
.iab-warning-banner {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: #ffffff;
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    font-family: var(--ui-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

.iab-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.iab-banner-text {
    flex: 1;
    line-height: 1.4;
    font-size: 13.5px;
    font-weight: 500;
    color: #ffffff;
    text-align: left;
}

.iab-banner-text .iab-highlight {
    color: #ffffff;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.iab-banner-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.iab-banner-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background-color: #ffffff;
    color: #1e40af;
    border: none;
    padding: 7px 14px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.iab-banner-btn:hover {
    background-color: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.iab-banner-btn:active {
    transform: translateY(0);
}

.iab-btn-icon {
    display: inline-block;
    flex-shrink: 0;
    width: 17px;
    height: 17px;
}

.iab-banner-close {
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.iab-banner-close:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.06);
}

.iab-banner-close:active {
    transform: scale(0.95);
}

@media (max-width: 580px) {
    .iab-warning-banner {
        padding: 8px 12px;
    }
    
    .iab-banner-content {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    
    .iab-banner-text {
        font-size: 11.5px;
        line-height: 1.3;
    }
    
    .iab-banner-btn {
        padding: 6px 10px;
        font-size: 11.5px;
        gap: 5px;
        border-radius: 7px;
    }
    
    .iab-btn-icon {
        width: 15px;
        height: 15px;
    }

    .iab-banner-close {
        width: 24px;
        height: 24px;
    }
}

.iab-modal-card {
    display: flex;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 32px 24px !important;
    max-width: 440px !important;
    width: 90% !important;
}

.iab-modal-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.iab-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    font-family: var(--ui-font);
}

.iab-modal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.iab-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.iab-action-btn {
    width: 100% !important;
    font-size: 13.5px !important;
    padding: 12px 16px !important;
}

/* ==========================================================================
   LAB INDEX (TABLE OF CONTENTS) UI & TEMPLATE STYLES
   ========================================================================== */

/* Preview Toolbar Header & Tabs */
.toolbar-info-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.preview-page-tabs {
    display: inline-flex;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
}

.page-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    font-family: var(--ui-font);
    padding: 5px 11px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.page-tab-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.page-tab-btn.active {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.badge-feature-pill {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    letter-spacing: 0.05em;
}

/* Index Editor in Control Panel */
.index-editor-hint {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.index-editor-hint strong {
    color: #ffffff;
}

/* Index Card-Based Editor in Control Panel */
.index-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.empty-cards-state {
    padding: 24px 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.expt-card-item {
    background-color: rgba(17, 24, 39, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.expt-card-item:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background-color: rgba(17, 24, 39, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.expt-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.expt-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    padding: 3px 8px;
    gap: 4px;
}

.badge-hash {
    font-size: 11px;
    font-weight: 800;
    color: #a5b4fc;
}

.expt-num-input {
    width: 24px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    outline: none;
    font-family: var(--ui-font);
}

.badge-label {
    font-size: 11px;
    font-weight: 600;
    color: #c7d2fe;
}

.btn-card-del {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--ui-font);
    transition: all 0.2s ease;
}

.btn-card-del:hover {
    background-color: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ffffff;
    transform: translateY(-1px);
}

.expt-name-row {
    width: 100%;
    margin-bottom: 10px;
}

.expt-name-input {
    width: 100%;
    box-sizing: border-box;
    background-color: rgba(11, 15, 25, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    outline: none;
    font-family: var(--ui-font);
    transition: all 0.2s ease;
}

.expt-name-input:focus {
    border-color: #818cf8;
    background-color: rgba(11, 15, 25, 1);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25);
}

.expt-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr 75px;
    gap: 8px;
    align-items: flex-end;
    box-sizing: border-box;
}

.expt-date-col, .expt-page-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.expt-field-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.expt-date-input, .expt-page-input {
    width: 100%;
    box-sizing: border-box;
    background-color: rgba(11, 15, 25, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    color: #ffffff;
    outline: none;
    font-family: var(--ui-font);
    transition: all 0.2s ease;
}

.expt-date-input:focus, .expt-page-input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.25);
}

@media (max-width: 480px) {
    .expt-card-body {
        grid-template-columns: 1fr 1fr;
    }
    .expt-page-col {
        grid-column: span 2;
    }
}

.index-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--ui-font);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.btn-index-add {
    background: rgba(99, 102, 241, 0.15);
    color: #c7d2fe;
    border-color: rgba(99, 102, 241, 0.35);
}

.btn-index-add:hover {
    background: var(--primary);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-index-preset {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-index-preset:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn-index-clear {
    background: transparent;
    color: #94a3b8;
    border-color: var(--border-color);
}

.btn-index-clear:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background-color: rgba(239, 68, 68, 0.05);
}

/* Stacked preview layout when 'View Both' is active */
.preview-viewport-center.stacked-pages {
    flex-direction: column !important;
    gap: 32px !important;
}

/* -------------------------------------------------------------
   LAB INDEX A4 DOCUMENT STYLING
   ------------------------------------------------------------- */

.lab-index-page-inner {
    width: 100%;
    height: 100%;
    padding: 12mm 10mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    color: #000000;
}

.lab-index-header {
    margin-bottom: 6px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lab-index-dept-box {
    border: 2.5px solid #000000 !important;
    padding: 1.5mm 6mm !important;
    font-size: 16pt !important;
    font-weight: 700 !important;
    color: #000000 !important;
    text-align: center !important;
    display: inline-block !important;
    margin: 4px auto 6px !important;
    box-sizing: border-box !important;
    letter-spacing: 0.3px;
    max-width: 90%;
}

.lab-index-pill {
    letter-spacing: 0.08em;
    font-weight: 800;
    font-size: 13px !important;
}

.lab-index-meta-container {
    width: 100%;
    margin: 8px 0 12px;
    border: 1.2px solid #000000;
    border-radius: 4px;
    padding: 6px 12px;
    background-color: #fafafa;
    box-sizing: border-box;
}

.lab-index-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 20px;
    font-size: 11px;
}

.lab-index-meta-item {
    display: flex;
    align-items: center;
    line-height: 1.35;
}

.lab-index-meta-item .meta-label {
    width: 82px;
    font-weight: 700;
    color: #1e293b;
    flex-shrink: 0;
}

.lab-index-meta-item .meta-colon {
    margin: 0 4px;
    font-weight: 700;
}

.lab-index-meta-item .meta-val {
    flex: 1;
    font-weight: 600;
    color: #000000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lab-index-table-container {
    width: 100%;
    flex: 1;
    margin-bottom: 10px;
}

.lab-index-table {
    width: 100%;
    border-collapse: collapse;
    border: 1.5px solid #000000;
    font-size: 10.5px;
}

.lab-index-table thead tr {
    background-color: #f1f5f9;
}

.lab-index-table th {
    border: 1px solid #000000;
    padding: 6px 4px;
    font-weight: 700;
    text-align: center;
    font-size: 10.5px;
    color: #000000;
}

.lab-index-table td {
    border: 1px solid #000000;
    padding: 6px 5px;
    vertical-align: middle;
    color: #000000;
    line-height: 1.25;
}

.lab-index-table .td-sl {
    text-align: center;
    font-weight: 700;
}

.lab-index-table .td-name {
    text-align: left;
    font-weight: 500;
}

.lab-index-table .td-date {
    text-align: center;
    font-size: 10px;
    white-space: nowrap;
}

.lab-index-table .td-page {
    text-align: center;
    font-weight: 600;
}

.lab-index-table .td-sign {
    text-align: center;
}

.lab-index-table tr.empty-row td {
    height: 24px;
}

.lab-index-footer {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
    padding-top: 8px;
}

.lab-index-grading-grid {
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lab-index-grading-grid .grading-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lab-index-signature-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 200px;
}

.lab-index-sig-line {
    width: 180px;
    border-top: 1.2px dotted #000000;
    margin-bottom: 4px;
}

.lab-index-sig-title {
    font-size: 10.5px;
    font-weight: 700;
    text-align: center;
    color: #000000;
}

.lab-index-sig-date {
    font-size: 10px;
    color: #334155;
    margin-top: 2px;
}

/* ==========================================================================
   MOBILE SLIDE NAVIGATION DRAWER
   ========================================================================== */
.mobile-menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }
}

.header-left-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.4);
    transform: scale(1.04);
}

.mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 8, 20, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
}

.mobile-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    width: 320px;
    max-width: 85vw;
    height: 100%;
    background: rgba(11, 15, 25, 0.96);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.6);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
}

.mobile-drawer.active {
    transform: translateX(0);
}

.drawer-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drawer-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.drawer-brand-text h3 {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    font-family: var(--ui-font);
    line-height: 1.2;
}

.drawer-brand-text p {
    font-size: 11px;
    color: var(--text-secondary);
}

.drawer-close-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.drawer-close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.drawer-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Install App Card in Drawer */
.drawer-install-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.15);
}

.drawer-install-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.drawer-install-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.drawer-install-info h4 {
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 2px;
}

.drawer-install-info p {
    font-size: 11px;
    color: #a5b4fc;
}

.drawer-install-btn {
    background: #6366f1;
    color: #ffffff;
    border: none;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.drawer-install-btn:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

/* Nav sections */
.drawer-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drawer-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding-left: 6px;
}

.drawer-nav-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--ui-font);
    cursor: pointer;
    transition: all 0.22s ease;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

.drawer-nav-item:hover, .drawer-nav-item:active {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
    color: #ffffff;
    transform: translateX(3px);
}

.drawer-nav-icon {
    color: #818cf8;
    flex-shrink: 0;
}

/* Stats in Drawer */
.drawer-stats-card {
    margin-top: auto;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.drawer-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.drawer-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.drawer-stat-val {
    font-size: 15px;
    font-weight: 800;
}

#drawer-download-count {
    color: #818cf8;
}

#drawer-visitor-count {
    color: #34d399;
}

.drawer-stat-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
}

.drawer-footer {
    padding: 16px 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.drawer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 100px;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #34d399;
    box-shadow: 0 0 8px #34d399;
}

.drawer-copyright {
    font-size: 11px;
    color: var(--text-muted);
}

.drawer-copyright a {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.drawer-copyright a:hover {
    color: #818cf8;
    text-decoration: underline;
}

/* Show mobile hamburger & adjust header on mobile */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-menu-toggle {
        display: inline-flex !important;
    }

    .app-header {
        position: relative !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: flex-start !important;
        align-items: center !important;
        padding: 10px 14px !important;
    }

    .header-left-wrap {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 12px !important;
        width: 100% !important;
        position: static !important;
        flex-wrap: nowrap !important;
    }

    .header-brand {
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
        margin: 0 !important;
        flex: 1 !important;
        min-width: 0 !important;
        flex-wrap: nowrap !important;
    }

    .brand-text {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        text-align: left !important;
        min-width: 0 !important;
        flex: 1 !important;
    }

    .brand-text h1, .brand-text p {
        text-align: left !important;
    }
}

/* PWA Toast Notification */
.pwa-toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-25px);
    background: rgba(11, 15, 25, 0.96);
    border: 1px solid rgba(52, 211, 153, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(52, 211, 153, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #f1f5f9;
    padding: 10px 18px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--ui-font);
    z-index: 9999999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: calc(100vw - 32px);
    width: max-content;
    box-sizing: border-box;
    white-space: nowrap;
}

.pwa-toast-container.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.pwa-toast-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .pwa-toast-container {
        top: 14px;
        padding: 9px 14px;
        font-size: 12.5px;
        border-radius: 10px;
        white-space: normal;
        text-align: left;
    }
}


