/**
 * Delvantic - Main Stylesheet
 * Modern design with theming system
 */

/* ==========================================================================
   THEME: Emerald V2 (Default)
   ========================================================================== */
:root,
:root[data-theme="emerald-v2"] {
    /* Primary - Deep Forest Green */
    --theme-primary: #047857;
    --theme-primary-light: #059669;
    --theme-primary-dark: #065f46;
    --theme-primary-rgb: 4, 120, 87;

    /* Secondary - Bright Teal/Cyan for contrast */
    --theme-secondary: #14b8a6;
    --theme-secondary-light: #2dd4bf;
    --theme-secondary-dark: #0d9488;
    --theme-secondary-rgb: 20, 184, 166;

    /* Accent - Vibrant Lime for pop */
    --theme-accent: #84cc16;
    --theme-accent-light: #a3e635;
    --theme-accent-dark: #65a30d;
    --theme-accent-rgb: 132, 204, 22;

    /* Backgrounds */
    --theme-bg-primary: #ffffff;
    --theme-bg-secondary: #f0fdfa;
    --theme-bg-tertiary: #ccfbf1;

    /* Text */
    --theme-text-primary: #0f172a;
    --theme-text-secondary: #475569;
    --theme-text-muted: #94a3b8;
    --theme-text-inverse: #ffffff;

    /* Borders */
    --theme-border: #99f6e4;
    --theme-border-light: #ccfbf1;

    /* Semantic Colors */
    --theme-success: #22c55e;
    --theme-success-rgb: 34, 197, 94;
    --theme-warning: #f59e0b;
    --theme-warning-rgb: 245, 158, 11;
    --theme-danger: #ef4444;
    --theme-danger-rgb: 239, 68, 68;
    --theme-info: #3b82f6;
    --theme-info-rgb: 59, 130, 246;

    /* Pop/Highlight */
    --theme-pop: #f97316;
    --theme-pop-light: #fb923c;
    --theme-pop-dark: #ea580c;
    --theme-pop-rgb: 249, 115, 22;

    /* Gradients */
    --theme-gradient-primary: linear-gradient(135deg, #047857 0%, #14b8a6 100%);
    --theme-gradient-accent: linear-gradient(135deg, #14b8a6 0%, #84cc16 100%);
    --theme-gradient-pop: linear-gradient(135deg, #f97316 0%, #ea580c 100%);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;

    /* Typography */
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    /* Radius */
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-round: 9999px;

    /* Shadows */
    --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-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   THEME: Ocean Blue
   ========================================================================== */
:root[data-theme="ocean-blue"] {
    --theme-primary: #0ea5e9;
    --theme-primary-light: #38bdf8;
    --theme-primary-dark: #0284c7;
    --theme-primary-rgb: 14, 165, 233;

    --theme-secondary: #0891b2;
    --theme-secondary-light: #22d3ee;
    --theme-secondary-dark: #0e7490;
    --theme-secondary-rgb: 8, 145, 178;

    --theme-accent: #10b981;
    --theme-accent-light: #34d399;
    --theme-accent-dark: #059669;
    --theme-accent-rgb: 16, 185, 129;

    --theme-bg-primary: #ffffff;
    --theme-bg-secondary: #f0f9ff;
    --theme-bg-tertiary: #e0f2fe;

    --theme-border: #bae6fd;
    --theme-border-light: #e0f2fe;

    --theme-gradient-primary: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    --theme-gradient-accent: linear-gradient(135deg, var(--theme-secondary) 0%, var(--theme-accent) 100%);
}

/* ==========================================================================
   THEME: Professional Purple
   ========================================================================== */
:root[data-theme="professional-purple"] {
    --theme-primary: #667eea;
    --theme-primary-light: #8b9aff;
    --theme-primary-dark: #4f46e5;
    --theme-primary-rgb: 102, 126, 234;

    --theme-secondary: #764ba2;
    --theme-secondary-light: #9b6fc9;
    --theme-secondary-dark: #5a3780;
    --theme-secondary-rgb: 118, 75, 162;

    --theme-accent: #a855f7;
    --theme-accent-light: #c084fc;
    --theme-accent-dark: #9333ea;
    --theme-accent-rgb: 168, 85, 247;

    --theme-bg-primary: #ffffff;
    --theme-bg-secondary: #faf5ff;
    --theme-bg-tertiary: #f3e8ff;

    --theme-border: #e9d5ff;
    --theme-border-light: #f3e8ff;

    --theme-gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --theme-gradient-accent: linear-gradient(135deg, #764ba2 0%, #a855f7 100%);
}

/* ==========================================================================
   THEME: Slate Modern
   ========================================================================== */
:root[data-theme="slate-modern"] {
    --theme-primary: #475569;
    --theme-primary-light: #64748b;
    --theme-primary-dark: #334155;
    --theme-primary-rgb: 71, 85, 105;

    --theme-secondary: #1e293b;
    --theme-secondary-light: #334155;
    --theme-secondary-dark: #0f172a;
    --theme-secondary-rgb: 30, 41, 59;

    --theme-accent: #3b82f6;
    --theme-accent-light: #60a5fa;
    --theme-accent-dark: #2563eb;
    --theme-accent-rgb: 59, 130, 246;

    --theme-bg-primary: #ffffff;
    --theme-bg-secondary: #f8fafc;
    --theme-bg-tertiary: #f1f5f9;

    --theme-border: #e2e8f0;
    --theme-border-light: #f1f5f9;

    --theme-gradient-primary: linear-gradient(135deg, #475569 0%, #1e293b 100%);
    --theme-gradient-accent: linear-gradient(135deg, #1e293b 0%, #3b82f6 100%);
}

/* ==========================================================================
   Bootstrap Overrides (Theme-Aware)
   ========================================================================== */
.btn-primary {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
}

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

.btn-secondary {
    background-color: var(--theme-secondary);
    border-color: var(--theme-secondary);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: var(--theme-secondary-dark);
    border-color: var(--theme-secondary-dark);
}

.btn-outline-primary {
    color: var(--theme-primary);
    border-color: var(--theme-primary);
}

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

.btn-outline-secondary {
    color: var(--theme-secondary);
    border-color: var(--theme-secondary);
}

.btn-outline-secondary:hover {
    background-color: var(--theme-secondary);
    border-color: var(--theme-secondary);
    color: white;
}

.bg-primary {
    background-color: var(--theme-primary) !important;
}

.bg-secondary {
    background-color: var(--theme-secondary) !important;
}

.text-primary {
    color: var(--theme-primary) !important;
}

.text-secondary {
    color: var(--theme-secondary) !important;
}

.alert-primary {
    background-color: rgba(var(--theme-primary-rgb), 0.1);
    border-color: rgba(var(--theme-primary-rgb), 0.2);
    color: var(--theme-primary-dark);
}

.progress-bar {
    background-color: var(--theme-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--theme-primary-rgb), 0.25);
}

.form-check-input:checked {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
}

a {
    color: var(--theme-primary);
}

a:hover {
    color: var(--theme-primary-dark);
}

/* Base */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--theme-bg-secondary);
    color: var(--theme-text-primary);
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

main {
    flex: 1;
    padding-top: 32px;
    margin-bottom: 100px;
}
.dv-flush-top main {
    padding-top: 0;
    margin-bottom: 0;
}

/* Header/Navigation */
#header {
    z-index: 1000;
}

#header .navbar {
    padding: 1rem 0;
    transition: background 0.3s ease, padding 0.3s ease;
}

#header .navbar-brand {
    font-size: 1.5rem;
    font-weight: var(--font-weight-bold);
}

#header .nav-link {
    font-weight: var(--font-weight-medium);
    padding: 0.5rem 1rem !important;
    transition: color 0.2s ease;
}

#header .nav-link.active {
    color: var(--theme-primary) !important;
}

/* Sections */
.section {
    padding: 100px 0;
}

.section-light {
    background: var(--theme-bg-primary);
}

.section-dark {
    background: var(--theme-bg-secondary);
}

.section-title {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.section-title h2 {
    font-size: 2.5rem;
    font-weight: var(--font-weight-extrabold);
    margin-bottom: var(--spacing-sm);
    color: var(--theme-text-primary);
}

.section-title p {
    font-size: 1.1rem;
    color: var(--theme-text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Feature Cards */
.feature-card {
    background: var(--theme-bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    border: 1px solid var(--theme-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.feature-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(var(--theme-primary-rgb), 0.1), rgba(var(--theme-secondary-rgb), 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.feature-icon i {
    font-size: 1.5rem;
    background: var(--theme-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-sm);
    color: var(--theme-text-primary);
}

.feature-card p {
    color: var(--theme-text-secondary);
    margin-bottom: var(--spacing-md);
    line-height: 1.7;
}

/* Footer */
#footer {
    background: #1e293b;
    color: #94a3b8;
    padding: var(--spacing-xl) 0;
}

#footer h5 {
    color: white;
    font-weight: var(--font-weight-semibold);
}

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

.animate-on-scroll {
    animation: fadeInUp 0.6s ease forwards;
}

/* Responsive */
@media (max-width: 768px) {
    .section-title h2 {
        font-size: 2rem;
    }
}

/* Utility classes */
.text-gradient {
    background: var(--theme-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Community rank badges (2026-08-12, dev log #647) ───────────────────────
   THE universal rank badge — Citizen / Noble / High Council / Admin. Lives in
   main.css (loaded by every shell) because these get sprinkled everywhere:
   top navs, community chat, tables, member pages.
   Render via the helper: include ROOT . 'content/req-includes/rank-badge.php'
   (set $rankTier — internal key or StocksAuth::tier() output — and optional
   $rankSm = true). Labels come from TierAlias; don't hardcode rank names.
   Gallery + palette reference: /stocks/admin/ui-examples/ § ui-rank-badges. */
.rank-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
    color: #475569; background: #f8fafc;          /* neutral fallback (unknown tier) */
    border: 1px solid #e2e8f0; border-radius: 999px;
    padding: 5px 14px; white-space: nowrap; line-height: 1.4;
}
.rank-badge i { font-size: 12px; }
.rank-badge--sm { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; gap: 4px; padding: 2px 8px; }
.rank-badge--sm i { font-size: 9.5px; }
.rank-badge--xs { font-size: 8px; text-transform: uppercase; letter-spacing: .05em; gap: 3px; padding: 0 6px; }
.rank-badge--xs i { font-size: 8px; }
/* Per-tier palettes — keyed by INTERNAL tier key (user/member/insider/admin),
   never by public name, so TierAlias renames don't touch CSS. Citizen gold,
   Noble emerald, High Council royal blue, Admin violet (took the violet off
   High Council 2026-08-12, William). --admin-alt keeps the earlier soft-red
   option (the site's "Admin only" chip language) as a pickable variant. */
.rank-badge--user      { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.rank-badge--member    { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.rank-badge--insider   { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.rank-badge--admin     { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
/* Named admin color variants — the default --admin above IS the purple; these
   explicit names let a surface pick its flavor: class="rank-badge rank-badge--admin-red". */
.rank-badge--admin-purple { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.rank-badge--admin-red    { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
