/* ============================================================
   DocVerify - Main Stylesheet
   Document Security Verification System
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --success: #34a853;
    --success-light: #e6f4ea;
    --danger: #ea4335;
    --danger-light: #fce8e6;
    --warning: #fbbc04;
    --warning-light: #fef7e0;
    --info: #4285f4;
    --info-light: #e8f0fe;
    --dark: #202124;
    --gray-900: #3c4043;
    --gray-700: #5f6368;
    --gray-500: #9aa0a6;
    --gray-300: #dadce0;
    --gray-100: #f1f3f4;
    --gray-50: #f8f9fa;
    --white: #ffffff;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.1);
    --shadow: 0 2px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    --transition: 0.2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    color: var(--dark);
    background: var(--gray-50);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* --- Typography --- */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.3; }
h2 { font-size: 1.35rem; font-weight: 600; line-height: 1.4; }
h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.4; }
.lead { font-size: 1.1rem; color: var(--gray-700); }
.text-muted { color: var(--gray-700); font-size: 0.875rem; }
.text-center { text-align: center; }
.small { font-size: 0.8rem; }
code { font-family: var(--font-mono); background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }

.btn-primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); }

.btn-outline { background: transparent; color: var(--primary); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-100); color: var(--primary-dark); }

.btn-danger-outline { background: transparent; color: var(--danger); border-color: var(--gray-300); }
.btn-danger-outline:hover { background: var(--danger-light); color: var(--danger); }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; }
.btn-xl { padding: 1rem 2.5rem; font-size: 1.1rem; }
.btn-full { width: 100%; }

/* --- Forms --- */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--gray-900);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--dark);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: var(--font-sans);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-body { padding: 1.25rem; }

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 99px;
    background: var(--gray-100);
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-active { background: var(--success-light); color: var(--success); }
.status-revoked { background: var(--danger-light); color: var(--danger); }
.status-expired { background: var(--warning-light); color: #e37400; }

.critical-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 4px;
    background: var(--danger-light);
    color: var(--danger);
    margin-left: 0.5rem;
    text-transform: uppercase;
}

/* --- Alerts --- */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    border-left: 4px solid;
}

.alert-error { background: var(--danger-light); border-color: var(--danger); color: #c5221f; }
.alert-success { background: var(--success-light); border-color: var(--success); color: #188038; }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: #b06000; }
.alert-info { background: var(--info-light); border-color: var(--info); color: var(--primary-dark); }

/* --- Table --- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.table th {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--gray-50);
}

.table tbody tr:hover { background: var(--gray-50); }

/* --- Navigation --- */
.main-nav {
    background: var(--white);
    border-bottom: 1px solid var(--gray-300);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 1rem;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: var(--gray-700);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--dark);
    text-decoration: none;
}

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

.nav-user-name {
    font-size: 0.85rem;
    color: var(--gray-700);
}

/* Hamburger & mobile menu hidden on desktop */
.nav-hamburger { display: none; }
.nav-mobile-menu { display: none; }

/* --- Auth Pages (Login/Register) --- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    padding: 1rem;
}

.auth-container { width: 100%; max-width: 420px; }

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.auth-header {
    padding: 2rem 1.5rem 1rem;
    text-align: center;
}

.auth-header h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.auth-header p { color: var(--gray-700); font-size: 0.9rem; }

.auth-form { padding: 0 1.5rem 1.5rem; }

.auth-footer {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    text-align: center;
    font-size: 0.85rem;
}

.auth-footer p { margin-bottom: 0.25rem; }

/* --- Dashboard --- */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-header h1 { margin-bottom: 0; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
    border-top: 3px solid var(--gray-300);
}

.stat-card.stat-success { border-top-color: var(--success); }
.stat-card.stat-danger { border-top-color: var(--danger); }
.stat-card.stat-info { border-top-color: var(--info); }

.stat-value { font-size: 2rem; font-weight: 700; color: var(--dark); }
.stat-label { font-size: 0.85rem; color: var(--gray-700); margin-top: 0.25rem; }

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--gray-700);
}

.empty-state p { margin-bottom: 1rem; }

/* --- Upload Page --- */
.upload-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin-bottom: 0.25rem; }

.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.upload-zone-content p { margin-bottom: 0.25rem; }

.file-preview { margin-top: 1rem; padding: 1rem; background: var(--gray-50); border-radius: var(--radius); }
.hidden { display: none !important; }

/* --- Document Fields --- */
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.field-label, .field-value { padding: 0.5rem 0.75rem; font-size: 0.9rem; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-remove-field {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
}

.btn-remove-field:hover { background: var(--danger-light); color: var(--danger); }

/* --- Verification Page --- */
.verify-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--gray-50);
    padding: 1rem;
}

.verify-container {
    width: 100%;
    max-width: 560px;
}

.verify-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.verify-header h1 { font-size: 1.3rem; margin-bottom: 0.25rem; }

.verify-result {
    text-align: center;
    padding: 2rem 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.result-icon { font-size: 3rem; margin-bottom: 0.5rem; }

.verify-authentic { background: var(--success-light); }
.verify-not-found { background: var(--danger-light); }
.verify-revoked { background: var(--danger-light); }
.verify-expired { background: var(--warning-light); }

.verify-result h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.scan-counter {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.verify-details { background: var(--white); }

.doc-meta { margin-bottom: 0.5rem; }

.meta-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
}

.meta-row:last-child { border-bottom: none; }
.meta-label { color: var(--gray-700); flex-shrink: 0; margin-right: 1rem; }
.meta-value { font-weight: 500; text-align: right; word-break: break-all; }

/* Fields list */
.fields-list { margin-top: 0.5rem; }

.field-item {
    padding: 0.75rem;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: border-color var(--transition);
}

.field-item.field-critical { border-color: var(--warning); border-width: 1.5px; }

.field-label {
    font-size: 0.8rem;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.15rem;
}

.field-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--dark);
}

.verify-tip { margin-top: 1rem; }

/* --- Fountain CTA --- */
.fountain-cta {
    border: 2px solid var(--primary);
    background: var(--primary-light);
}

.fountain-cta-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.fountain-cta-icon {
    flex-shrink: 0;
}

.qr-stream-animation {
    display: flex;
    gap: 4px;
    font-size: 1.5rem;
}

.qr-stream-animation span {
    animation: qrPulse 1s ease-in-out infinite;
}

.qr-stream-animation span:nth-child(2) { animation-delay: 0.2s; }
.qr-stream-animation span:nth-child(3) { animation-delay: 0.4s; }

@keyframes qrPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.fountain-cta-text { flex: 1; min-width: 200px; }
.fountain-cta-text h3 { margin-bottom: 0.25rem; }
.fountain-cta-text p { font-size: 0.85rem; color: var(--gray-700); margin-bottom: 0; }

.verify-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.verify-footer p { margin-bottom: 0.25rem; }

/* --- Fountain Sender Page --- */
.fountain-sender-page {
    background: #0a0e17;
    color: var(--white);
    min-height: 100vh;
}

.fountain-sender-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.fountain-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.fountain-header h1 { color: var(--white); }

.fountain-sender-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1.5rem;
    align-items: start;
}

.fountain-stream-panel {
    background: #111827;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 0 30px rgba(26, 115, 232, 0.15);
}

.stream-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-500);
}

.status-dot.status-pending { background: var(--gray-500); }
.status-dot.status-active { background: var(--success); animation: pulse 1.5s infinite; }
.status-dot.status-streaming { background: var(--primary); animation: pulse 0.5s infinite; }
.status-dot.status-complete { background: var(--success); }

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; }
    50% { opacity: 0.7; box-shadow: 0 0 8px 4px currentColor; }
}

.qr-canvas-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

#qrCanvas {
    max-width: 100%;
    height: auto;
    display: block;
}

.stream-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
}

.stream-overlay.hidden { display: none; }

.stream-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.stream-info { font-size: 0.85rem; color: var(--gray-500); font-family: var(--font-mono); }
.stream-info div { margin-bottom: 0.15rem; }

.stream-actions { display: flex; gap: 0.5rem; }
.stream-actions select, .stream-actions .btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

.fountain-info-panel .card {
    background: #111827;
    border: 1px solid #1f2937;
}

.fountain-info-panel .card-header {
    border-bottom-color: #1f2937;
}

.fountain-info-panel .meta-row .meta-label { color: #9ca3af; }
.fountain-info-panel .meta-row .meta-value { color: #e5e7eb; }

.receiver-qr-container {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.receiver-qr-container canvas {
    border-radius: var(--radius);
    border: 4px solid #1f2937;
}

.steps-list {
    padding-left: 1.5rem;
    font-size: 0.9rem;
    color: #d1d5db;
}

.steps-list li { margin-bottom: 0.75rem; }

/* --- Fountain Receiver Page --- */
.fountain-receiver-page {
    background: #0a0e17;
    color: var(--white);
    min-height: 100vh;
}

.receiver-container {
    max-width: 560px;
    margin: 0 auto;
    padding: 1rem;
}

.receiver-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-top: 1rem;
}

.receiver-header h1 { font-size: 1.3rem; color: var(--white); }
.receiver-header p { color: var(--gray-500); font-size: 0.9rem; }

/* Camera */
.camera-panel {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    margin-bottom: 1rem;
}

.camera-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
}

#cameraVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-frame {
    width: 70%;
    aspect-ratio: 1;
    border: 3px solid rgba(255,255,255,0.6);
    border-radius: 12px;
}

.scan-line {
    position: absolute;
    top: 15%;
    left: 15%;
    right: 15%;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {
    0%, 100% { top: 15%; }
    50% { top: 80%; }
}

.scan-status {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.9rem;
    background: #111827;
}

.status-indicator { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }

/* Progress */
.progress-panel {
    background: #111827;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.progress-header { text-align: center; margin-bottom: 1rem; }
.progress-header h2 { font-size: 1.1rem; color: var(--white); }
.progress-header p { color: var(--gray-500); font-size: 0.85rem; }

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #1f2937;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #34a853);
    border-radius: 99px;
    transition: width 0.3s ease;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    text-align: center;
}

.progress-stats .stat { padding: 0.5rem; }
.progress-stats .stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--white);
    font-family: var(--font-mono);
}
.progress-stats .stat-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
}

/* Result panel (after receiving) */
.result-panel {
    background: #111827;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.result-header {
    padding: 1.5rem;
    text-align: center;
}

.result-header.result-success { background: linear-gradient(135deg, #065f46, #047857); }
.result-header .result-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.result-header h2 { color: var(--white); font-size: 1.3rem; }
.result-header p { color: rgba(255,255,255,0.8); font-size: 0.9rem; }

.result-panel .card {
    background: #1f2937;
    border: 1px solid #374151;
    margin: 0;
    border-radius: 0;
}

.result-panel .card-header { border-bottom-color: #374151; }
.result-panel .card-header h3 { color: var(--white); }
.result-panel .card-header p { color: #9ca3af; }

.result-panel .doc-meta .meta-label { color: #9ca3af; }
.result-panel .doc-meta .meta-value { color: #e5e7eb; }

.result-panel .field-item {
    background: #111827;
    border-color: #374151;
}

.result-panel .field-value .original-value { color: var(--success); }

.field-compare {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.compare-input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    background: #0a0e17;
    border: 1px solid #374151;
    border-radius: var(--radius);
    color: var(--white);
    font-family: var(--font-sans);
}

.compare-input:focus { outline: none; border-color: var(--primary); }

.compare-result {
    font-size: 1rem;
    font-weight: 700;
}

.compare-result.match { color: var(--success); }
.compare-result.mismatch { color: var(--danger); }

.compare-actions { text-align: center; margin-top: 1rem; }

.compare-verdict {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    font-weight: 600;
}

.compare-verdict.verdict-match { background: var(--success-light); color: var(--success); }
.compare-verdict.verdict-mismatch { background: var(--danger-light); color: var(--danger); }

/* --- Error page (fountain) --- */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem;
    background: #0a0e17;
    color: var(--white);
}

.error-page h1 { font-size: 1.5rem; margin-bottom: 0.75rem; }
.error-page p { color: #9ca3af; margin-bottom: 1rem; }
.error-page .btn-outline { color: #d1d5db; border-color: #374151; }
.error-page .btn-outline:hover { background: #1f2937; color: var(--white); }

/* --- Responsive --- */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }

    .field-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .field-row .checkbox-label { grid-column: span 2; }

    .nav-links { display: none !important; }
    .nav-user { display: none !important; }

    /* --- Hamburger Button (mobile only) --- */
    .nav-hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        width: 40px;
        height: 40px;
        background: none;
        border: 1px solid var(--gray-300);
        border-radius: var(--radius);
        cursor: pointer;
        padding: 0;
        flex-shrink: 0;
    }
    .nav-hamburger span {
        display: block;
        width: 18px;
        height: 2px;
        background: var(--dark);
        border-radius: 2px;
        transition: all 0.25s ease;
        transform-origin: center;
    }
    .nav-hamburger.nav-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .nav-hamburger.nav-open span:nth-child(2) { opacity: 0; }
    .nav-hamburger.nav-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    /* --- Mobile Dropdown Menu --- */
    .nav-mobile-menu {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--white);
        border-bottom: 1px solid var(--gray-300);
        box-shadow: var(--shadow-lg);
        flex-direction: column;
        z-index: 99;
        max-height: calc(100vh - 56px);
        overflow-y: auto;
    }
    .nav-mobile-menu.nav-mobile-open { display: flex; }
    .nav-mobile-link {
        display: block;
        padding: 0.85rem 1.25rem;
        font-size: 0.95rem;
        color: var(--dark);
        border-bottom: 1px solid var(--gray-100);
        cursor: pointer;
        text-align: left;
        background: none;
        border-left: none;
        border-right: none;
        border-top: none;
        width: 100%;
        font-family: var(--font-sans);
        text-decoration: none;
        transition: background var(--transition);
    }
    .nav-mobile-link:hover {
        background: var(--gray-100);
        text-decoration: none;
    }
    .nav-mobile-link:last-child { border-bottom: none; }
    .nav-mobile-divider {
        height: 1px;
        background: var(--gray-300);
        margin: 0.25rem 1rem;
    }
    .nav-mobile-logout { color: var(--danger); }

    .main-nav {
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .nav-inner {
        position: relative;
    }

    .fountain-sender-layout {
        grid-template-columns: 1fr;
    }

    .fountain-cta-content {
        flex-direction: column;
        text-align: center;
    }

    .progress-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }
    .stat-card {
        padding: 0.85rem 0.5rem;
    }
    .stat-value { font-size: 1.5rem; }
    .stat-label { font-size: 0.75rem; }

    /* Mobile dashboard improvements */
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    .dashboard-header > div:last-child {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }
    .dashboard-header .gw-tour-btn {
        flex: 0;
    }
    .dashboard-header .btn-primary {
        flex: 1;
        text-align: center;
    }

    .dashboard {
        padding: 1rem 0.75rem;
    }

    /* Mobile nav brand - more compact */
    .nav-brand {
        font-size: 0.95rem;
        white-space: nowrap;
    }

    /* Mobile cards - full width, cleaner */
    .card {
        border-radius: var(--radius);
        margin-bottom: 0.75rem;
    }
    .card-header {
        padding: 0.75rem 0.85rem;
    }
    .card-header h2 {
        font-size: 0.95rem;
    }
    .card-body {
        padding: 0.75rem 0.85rem;
    }

    /* Mobile buttons - full width, larger touch targets */
    .btn {
        min-height: 42px;
        padding: 0.55rem 1rem;
        font-size: 0.88rem;
    }
    .btn-sm {
        min-height: 36px;
        padding: 0.35rem 0.75rem;
        font-size: 0.82rem;
    }

    /* Mobile form improvements */
    .form-control {
        font-size: 16px; /* Prevents iOS zoom */
        min-height: 42px;
    }

    /* Badge styling */
    .badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    /* Mobile empty state */
    .empty-state {
        padding: 1.25rem 0.75rem;
        font-size: 0.88rem;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.4rem; }

    .auth-card { border-radius: var(--radius); }

    .field-row {
        grid-template-columns: 1fr;
    }

    .field-row .checkbox-label { grid-column: auto; }
}

/* ============================================================
   Guide Wizard — Step-by-Step Interactive Overlay
   ============================================================ */

/* --- Overlay & Spotlight --- */
#gw-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#gw-overlay.gw-visible {
    pointer-events: auto;
    opacity: 1;
}

/* Dark backdrop (the "dim" layer) */
#gw-overlay::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1;
    border-radius: 0;
}

/* Spotlight cutout — highlights the target element */
#gw-spotlight {
    position: fixed;
    z-index: 2;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

/* Animated pulse ring around spotlight */
#gw-spotlight::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid rgba(26, 115, 232, 0.6);
    border-radius: inherit;
    animation: gw-pulse 2s ease-in-out infinite;
}

@keyframes gw-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(26, 115, 232, 0); }
}

/* --- Tooltip --- */
#gw-tooltip {
    position: fixed;
    z-index: 100001;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.12);
    padding: 0;
    max-width: 380px;
    width: 340px;
    transition: top 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform: none;
    font-family: var(--font-sans);
    pointer-events: auto;
    overflow: hidden;
}

/* Centered tooltip for welcome/complete steps */
#gw-tooltip.gw-tooltip-centered {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
    width: 380px;
    max-width: calc(100vw - 32px);
}

/* --- Progress Bar --- */
#gw-progress {
    padding: 12px 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gw-progress-text {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
    font-weight: 500;
}

.gw-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--gray-100);
    border-radius: 2px;
    overflow: hidden;
}

.gw-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* --- Tooltip Body --- */
#gw-tooltip-body {
    padding: 16px 20px 8px;
}

#gw-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    line-height: 1;
}

#gw-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 6px;
    line-height: 1.3;
}

#gw-desc {
    font-size: 0.88rem;
    color: var(--gray-700);
    line-height: 1.55;
    margin-bottom: 8px;
}

#gw-tip {
    display: none;
    font-size: 0.82rem;
    color: var(--primary-dark);
    background: var(--primary-light);
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 4px;
    line-height: 1.5;
    border-left: 3px solid var(--primary);
}

/* --- Action Buttons --- */
#gw-actions {
    padding: 12px 20px 16px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.gw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
    line-height: 1.4;
}

.gw-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.gw-btn-skip {
    background: transparent;
    color: var(--gray-500);
    margin-right: auto;
    font-weight: 500;
}

.gw-btn-skip:hover {
    color: var(--gray-700);
    text-decoration: underline;
}

.gw-btn-prev {
    background: var(--gray-100);
    color: var(--gray-700);
}

.gw-btn-prev:hover {
    background: var(--gray-300);
}

.gw-btn-next {
    background: var(--primary);
    color: var(--white);
}

.gw-btn-next:hover {
    background: var(--primary-dark);
}

.gw-btn-done {
    background: var(--success);
    color: var(--white);
}

.gw-btn-done:hover {
    background: #2d9249;
}

/* --- Arrow Indicators (Desktop only) --- */
.gw-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--white);
    transform: rotate(45deg);
    z-index: -1;
}

.gw-arrow-up {
    top: -7px;
    left: 0;
    border-top: 1px solid rgba(0,0,0,0.06);
    border-left: 1px solid rgba(0,0,0,0.06);
}

.gw-arrow-down {
    bottom: -7px;
    left: 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    border-right: 1px solid rgba(0,0,0,0.06);
}

.gw-arrow-left {
    left: -7px;
    top: 0;
    border-left: 1px solid rgba(0,0,0,0.06);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.gw-arrow-right {
    right: -7px;
    top: 0;
    border-right: 1px solid rgba(0,0,0,0.06);
    border-top: 1px solid rgba(0,0,0,0.06);
}

/* --- Body Lock --- */
body.gw-active {
    overflow: hidden !important;
}

body.gw-active #gw-overlay {
    overflow-y: auto;
}

/* --- Guide Tour Button (reusable) --- */
.gw-tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid rgba(26, 115, 232, 0.2);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
    white-space: nowrap;
}

.gw-tour-btn:hover {
    background: rgba(26, 115, 232, 0.15);
    border-color: var(--primary);
}

.gw-tour-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* --- Help Badge (pulsing help icon) --- */
.gw-help-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition);
}

.gw-help-badge:hover {
    transform: scale(1.1);
}

.gw-help-badge::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    animation: gw-badge-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes gw-badge-ping {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* --- Dashboard Tour Button Placement --- */
.dashboard-header .gw-tour-btn {
    margin-left: 10px;
}

/* ============================================================
   Guide Wizard — Responsive Styles
   ============================================================ */
@media (max-width: 768px) {
    /* Tooltip becomes a bottom sheet on mobile */
    #gw-tooltip {
        width: calc(100vw - 24px);
        max-width: none;
        left: 12px !important;
        top: auto !important;
        bottom: 12px !important;
        transform: none !important;
        border-radius: var(--radius-lg) var(--radius-lg) 16px 16px;
        max-height: 45vh;
        overflow-y: auto;
    }

    #gw-tooltip.gw-tooltip-centered {
        top: auto !important;
        bottom: 12px !important;
        left: 12px !important;
        right: 12px !important;
        transform: none !important;
        width: auto;
    }

    /* No arrows on mobile */
    .gw-arrow { display: none; }

    /* Larger tap targets on mobile */
    .gw-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* Progress slightly larger on mobile */
    #gw-progress {
        padding: 10px 16px 0;
    }

    #gw-tooltip-body {
        padding: 12px 16px 6px;
    }

    #gw-actions {
        padding: 10px 16px 14px;
    }

    /* Spotlight less padding on mobile */
    #gw-spotlight {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.72);
    }

    /* Help badge in mobile nav area */
    .gw-tour-btn {
        font-size: 0.75rem;
        padding: 5px 12px;
    }
}

@media (max-width: 480px) {
    #gw-tooltip {
        width: calc(100vw - 16px);
        left: 8px !important;
        bottom: 8px !important;
        max-height: 50vh;
    }

    #gw-tooltip.gw-tooltip-centered {
        left: 8px !important;
        right: 8px !important;
    }

    #gw-title {
        font-size: 0.95rem;
    }

    #gw-desc {
        font-size: 0.84rem;
    }

    .gw-btn {
        padding: 9px 16px;
    }
}

/* ============================================================
   Admin Settings Page — Toggle Switch & Tabs
   ============================================================ */

/* --- Settings Tabs --- */
.settings-tabs {
    display: flex;
    gap: 4px;
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 1.5rem;
}

.settings-tab {
    flex: 1;
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--gray-700);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
}

.settings-tab:hover {
    color: var(--dark);
    background: rgba(255,255,255,0.5);
}

.settings-tab.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* --- Settings Panels --- */
.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

/* --- Toggle Switch --- */
.settings-toggle-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.settings-toggle-info {
    flex: 1;
}

.settings-toggle-info h3 {
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--dark);
}

.settings-toggle-info p {
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
    margin-top: 4px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--gray-300);
    border-radius: 28px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

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

.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --- SMTP Status Indicator --- */
.smtp-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    padding: 4px 10px;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.smtp-status.smtp-configured {
    background: var(--success-light);
    color: var(--success);
}

.smtp-status.smtp-not-configured {
    background: var(--warning-light);
    color: var(--warning);
}

.smtp-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.smtp-configured .smtp-status-dot {
    background: var(--success);
}

.smtp-not-configured .smtp-status-dot {
    background: var(--warning);
}

/* --- Settings Responsive --- */
@media (max-width: 768px) {
    .settings-toggle-row {
        flex-direction: column;
        gap: 16px;
    }

    .toggle-switch {
        align-self: flex-start;
    }

    .settings-tab {
        padding: 8px 12px;
        font-size: 0.82rem;
    }
}

/* ============================================================
   Verify Module — Dashboard Inline
   ============================================================ */
.verify-inline {
    margin-bottom: 8px;
}

.verify-input-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
}

.verify-input-wrap {
    flex: 1;
    min-width: 200px;
    display: flex;
    gap: 0;
}

.verify-input-wrap .form-control {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.verify-input-wrap .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    white-space: nowrap;
}

.verify-result-box {
    margin-top: 12px;
}

@media (max-width: 600px) {
    .verify-input-row {
        flex-direction: column;
    }
    .verify-input-wrap .form-control {
        border-top-right-radius: var(--radius);
        border-bottom-right-radius: 0;
        border-right: 1px solid var(--gray-300);
    }
    .verify-input-wrap .btn {
        border-top-left-radius: 0;
        border-bottom-left-radius: var(--radius);
    }
}

/* --- Health Monitor --- */
.health-section {
    margin-bottom: 1.5rem;
}
.health-section h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--gray-200);
}
.health-grid {
    display: grid;
    gap: 0;
}
