/**
 * App theme: blue scheme aligned with marketing (index-blue-original).
 * Reverse header (dark bar + colored CTA-style nav buttons). Gradient user icon kept from base styles.
 * Load after styles.css on all app copy main pages.
 */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --dark: #0f172a;
    --muted: #475569;
    --light: #f8fafc;
    --white: #ffffff;
    --gradient-hero: linear-gradient(135deg, #1e3a8a 0%, #2563eb 40%, #3b82f6 100%);
    --gradient-cta: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 40px rgba(37, 99, 235, 0.25);
    --radius: 12px;
    --radius-lg: 20px;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--dark);
    background: var(--light);
}

/* Header: hero blue gradient + pattern (same as index hero) */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--gradient-hero);
    color: var(--white);
    padding: 0.9rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.25);
}

.site-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.8;
    z-index: 0;
}

.site-header .brand,
.site-header .user-nav {
    position: relative;
    z-index: 1;
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -0.02em;
}

.brand h1 a {
    color: inherit;
    text-decoration: none;
}

.brand h1 a span {
    color: var(--accent);
}

.brand h1 a:hover {
    color: var(--accent);
}

.brand h1 a:hover span {
    color: var(--accent-hover);
}

.brand p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 2px;
}

/* Nav: ghost = accent color on dark; active = CTA (colored) button */
.user-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-nav .btn-ghost {
    color: rgba(255, 255, 255, 0.9);
    border-color: transparent;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
}

.user-nav .btn-ghost:hover {
    color: var(--dark);
    background: rgba(245, 158, 11, 0.15);
    border-color: transparent;
}

.user-nav .btn-ghost.active {
    background: var(--gradient-cta);
    color: var(--dark);
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.4);
}

.user-nav .btn-ghost.active:hover {
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
}

/* User dropdown: stay on top of header, not clipped */
.user-dropdown-menu {
    z-index: 1001;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

/* Page & panels: card look with radius and shadow */
.page {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

.panel {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.panel-header {
    border-bottom: 2px solid rgba(37, 99, 235, 0.12);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

/* Page action buttons: same blue as "New List" / "Saved Lists" (not header nav) – override base #4a90e2 */
.page .btn-primary,
.panel .btn-primary,
.action-bar .btn-primary,
.btn.btn-primary {
    background: var(--primary) !important;
    color: var(--white) !important;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.page .btn-primary:hover,
.panel .btn-primary:hover,
.action-bar .btn-primary:hover,
.btn.btn-primary:hover {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-ghost {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-ghost:hover {
    background: rgba(37, 99, 235, 0.08);
}

.btn-ghost.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Links */
.merge-field-link,
.list-name-link,
.workflow-steps a {
    color: var(--primary);
}

.merge-field-link:hover,
.list-name-link:hover,
.workflow-steps a:hover {
    color: var(--primary-dark);
}

/* Index: workflow step circles and intro text */
.workflow-steps li::before {
    background: var(--primary);
}

.home-intro,
.workflow-intro {
    color: var(--muted);
}

/* Lists: selection banner and table */
.selection-banner {
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: var(--radius);
}

.selection-option {
    border-color: rgba(37, 99, 235, 0.35);
    border-radius: 10px;
}

.selection-option:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: var(--primary);
}

.selection-option.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.selection-option.active p {
    color: rgba(255, 255, 255, 0.9);
}

.saved-lists-table th {
    background: rgba(37, 99, 235, 0.06);
    color: var(--dark);
    font-weight: 600;
}

.saved-lists-table tr:hover {
    background: rgba(37, 99, 235, 0.04);
}

/* Form focus */
input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Setting sections (if present on these pages) */
.setting-section-header {
    background: rgba(37, 99, 235, 0.06);
    border-bottom-color: rgba(37, 99, 235, 0.1);
}

/* Manage-list: extra left/right padding on Output Options (advanced) header only; page margin unchanged */
.output-options.setting-section .setting-section-header {
    padding-left: 24px;
    padding-right: 24px;
}

/* Documents: tabs – blue active state */
.doc-tabs {
    border-bottom-color: rgba(37, 99, 235, 0.2);
}

.doc-tabs a.active,
.doc-subtabs a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.doc-tabs a:hover,
.doc-subtabs a:hover {
    color: var(--primary-dark);
}

.doc-subtabs {
    border-bottom-color: rgba(37, 99, 235, 0.15);
}

/* Data tables (manage-list, lists, etc.) */
.data-table th {
    background: rgba(37, 99, 235, 0.06);
    color: var(--dark);
}

.data-table tr:hover {
    background: rgba(37, 99, 235, 0.04);
}
