/**
 * AI LIFE GROWTH - Premium Black & Gold Fintech Design System
 * Colors:
 * Base Dark: #090909
 * Secondary Dark: #151515
 * Card Dark: #191919
 * Gold: #D4AF37
 * Champagne: #F3DFA5
 * Text Muted: #A1A1AA
 * Success: #16A36A
 * Danger: #DC4545
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Cinzel:wght@500;700&display=swap');

:root {
    --bg-base: #090909;
    --bg-secondary: #151515;
    --bg-card: #191919;
    --bg-elevated: #222222;
    --gold: #D4AF37;
    --gold-hover: #b5952f;
    --champagne: #F3DFA5;
    --text-white: #FFFFFF;
    --text-muted: #A1A1AA;
    --text-light: #E4E4E7;
    --border-gold-subtle: rgba(212, 175, 55, 0.22);
    --border-gold-bright: rgba(212, 175, 55, 0.6);
    --border-dark: #27272A;
    --success: #16A36A;
    --danger: #DC4545;
    --warning: #F59E0B;
    --info: #3B82F6;
    --shadow-gold: 0 8px 30px rgba(212, 175, 55, 0.08);
    --shadow-gold-lg: 0 14px 45px rgba(212, 175, 55, 0.15);
    --sidebar-width: 280px;
    --topbar-height: 72px;
}

body {
    background-color: var(--bg-base);
    color: var(--text-light);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography */
.brand-font {
    font-family: 'Cinzel', serif;
    letter-spacing: 1.5px;
}

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

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

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

/* Backgrounds */
.bg-dark-base {
    background-color: var(--bg-base) !important;
}

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

.bg-dark-card {
    background-color: var(--bg-card) !important;
}

.bg-gold {
    background: linear-gradient(135deg, #F3DFA5 0%, #D4AF37 60%, #AA820A 100%) !important;
    background-color: #D4AF37 !important;
    color: #000000 !important;
}

.bg-gold.text-dark, .badge.bg-gold.text-dark {
    color: #000000 !important;
}

.badge.bg-gold {
    background: linear-gradient(135deg, #F3DFA5 0%, #D4AF37 60%, #AA820A 100%) !important;
    color: #000000 !important;
    font-weight: 700 !important;
    border: 1px solid rgba(243, 223, 165, 0.4);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.25);
    letter-spacing: 0.3px;
}

.bg-gold-subtle {
    background: rgba(212, 175, 55, 0.08) !important;
}

/* Borders */
.border-gold-subtle {
    border: 1px solid var(--border-gold-subtle) !important;
}

.border-gold {
    border: 1px solid var(--gold) !important;
}

.border-dark-subtle {
    border: 1px solid var(--border-dark) !important;
}

/* Cards */
.card-premium {
    background-color: var(--bg-card);
    border: 1px solid var(--border-gold-subtle);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card-premium:hover {
    border-color: var(--border-gold-bright);
    box-shadow: var(--shadow-gold);
}

.card-header-clean {
    background: transparent;
    border-bottom: 1px solid var(--border-gold-subtle);
    padding: 1.25rem 1.5rem;
}

/* Buttons */
.btn-gold {
    background: linear-gradient(135deg, #D4AF37 0%, #AA820A 100%);
    color: #090909 !important;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1.4rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.25);
}

.btn-gold:hover, .btn-gold:focus {
    background: linear-gradient(135deg, #F3DFA5 0%, #D4AF37 100%);
    color: #000000 !important;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
    transform: translateY(-1px);
}

.btn-outline-gold {
    background: transparent;
    color: var(--gold) !important;
    border: 1px solid var(--gold);
    font-weight: 600;
    border-radius: 8px;
    padding: 0.65rem 1.4rem;
    transition: all 0.25s ease;
}

.btn-outline-gold:hover {
    background: rgba(212, 175, 55, 0.12);
    color: var(--champagne) !important;
    border-color: var(--champagne);
    transform: translateY(-1px);
}

/* Forms */
.form-control-luxury, .form-select-luxury, .form-control, .form-select,
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
    background-color: #141418 !important;
    border: 1px solid rgba(212, 175, 55, 0.25) !important;
    color: var(--text-white) !important;
    border-radius: 8px !important;
    padding: 0.75rem 1rem !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control-luxury:focus, .form-select-luxury:focus, .form-control:focus, .form-select:focus,
input:focus, select:focus, textarea:focus {
    background-color: #1a1a20 !important;
    border-color: var(--gold) !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.25) !important;
    outline: none !important;
}

.input-group-text {
    background-color: #1e1e24 !important;
    color: var(--gold) !important;
    border: 1px solid rgba(212, 175, 55, 0.25) !important;
}

.form-control-luxury:focus, .form-select-luxury:focus {
    background-color: #1a1a1a;
    border-color: var(--gold);
    box-shadow: 0 0 0 0.25rem rgba(212, 175, 55, 0.18);
    color: var(--text-white);
}

.form-control-luxury::placeholder {
    color: #66666e;
}

/* Layout: Sidebar and Content */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-gold-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1020;
    transition: transform 0.3s ease-in-out;
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-gold-subtle);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1rem;
}

.nav-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #71717A;
    font-weight: 700;
    padding: 0.75rem 0.75rem 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.sidebar-link i {
    width: 22px;
    margin-right: 0.75rem;
    font-size: 1.1rem;
    color: #71717A;
    transition: color 0.2s;
}

.sidebar-link:hover {
    color: var(--champagne);
    background-color: rgba(212, 175, 55, 0.08);
}

.sidebar-link:hover i {
    color: var(--gold);
}

.sidebar-link.active {
    color: #090909;
    background: linear-gradient(90deg, #D4AF37 0%, #F3DFA5 100%);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
}

.sidebar-link.active i {
    color: #090909;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.3s ease-in-out;
}

.app-navbar {
    height: var(--topbar-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-gold-subtle);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1010;
}

.app-content {
    flex: 1;
    padding: 2rem;
}

/* Tables */
.table-luxury {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-light);
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table-luxury th {
    background-color: #1a1a1a;
    color: var(--champagne);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-gold-subtle);
}

.table-luxury td {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-dark);
    vertical-align: middle;
}

.table-luxury.nowrap-cells td, .table-luxury.nowrap-cells th {
    white-space: nowrap;
}

.table-luxury tbody tr:hover td {
    background-color: rgba(212, 175, 55, 0.04);
}

.breadcrumb a {
    color: #cbd5e1 !important;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--gold) !important;
}

/* Badges */
.badge-gold {
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold);
    border: 1px solid var(--border-gold-bright);
    padding: 0.4em 0.75em;
    font-weight: 600;
    border-radius: 6px;
}

.badge-success-subtle {
    background: rgba(22, 163, 106, 0.15);
    color: #34D399;
    border: 1px solid rgba(22, 163, 106, 0.4);
    padding: 0.4em 0.75em;
    font-weight: 600;
    border-radius: 6px;
}

.badge-danger-subtle {
    background: rgba(220, 69, 69, 0.15);
    color: #F87171;
    border: 1px solid rgba(220, 69, 69, 0.4);
    padding: 0.4em 0.75em;
    font-weight: 600;
    border-radius: 6px;
}

.badge-warning-subtle {
    background: rgba(245, 158, 11, 0.15);
    color: #FBBF24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 0.4em 0.75em;
    font-weight: 600;
    border-radius: 6px;
}

/* Dark Luxury Alerts (Override Bootstrap Light Defaults) */
.alert {
    background-color: #141418 !important;
    border: 1px solid var(--border-gold-subtle) !important;
    color: var(--text-light) !important;
    border-radius: 10px !important;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.12) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
    color: #FDE68A !important;
}

.alert-warning .text-white {
    color: #FFFFFF !important;
}

.alert-warning .text-muted {
    color: #D1D5DB !important;
}

.alert-dark {
    background-color: #151518 !important;
    border-color: var(--border-gold-subtle) !important;
    color: var(--text-light) !important;
}

.alert-dark .text-muted {
    color: #9CA3AF !important;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.12) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
    color: #93C5FD !important;
}

.alert-info .text-muted {
    color: #CBD5E1 !important;
}

.alert-success {
    background-color: rgba(22, 163, 106, 0.12) !important;
    border-color: rgba(22, 163, 106, 0.45) !important;
    color: #6EE7B7 !important;
}

.alert-danger {
    background-color: rgba(220, 69, 69, 0.12) !important;
    border-color: rgba(220, 69, 69, 0.45) !important;
    color: #FCA5A5 !important;
}

/* Universal Table Dark Rules */
.table, table {
    --bs-table-bg: transparent !important;
    --bs-table-color: var(--text-light) !important;
    background-color: transparent !important;
    color: var(--text-light) !important;
}

.table th, table th {
    background-color: #16161a !important;
    color: var(--champagne) !important;
    border-bottom: 1px solid var(--border-gold-subtle) !important;
}

.table td, table td {
    border-bottom: 1px solid var(--border-dark) !important;
    color: var(--text-light) !important;
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(212, 175, 55, 0.05) !important;
    color: var(--text-white) !important;
}

/* Responsive 5-column grid helper */
@media (min-width: 1200px) {
    .col-xl-2-4 {
        flex: 0 0 auto !important;
        width: 20% !important;
    }
}

/* Stat Cards */
.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-gold-subtle);
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s, box-shadow 0.25s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-gold);
    border-color: var(--border-gold-bright);
}

.stat-icon {
    width: 58px;
    height: 58px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: rgba(212, 175, 55, 0.12);
    color: var(--gold);
    border: 1px solid var(--border-gold-subtle);
    margin-right: 1.25rem;
}

/* Genealogy Tree Styles */
.tree-container {
    width: 100%;
    overflow-x: auto;
    padding: 2rem 1rem;
    text-align: center;
}

.tree-node {
    display: inline-block;
    background: var(--bg-card);
    border: 1px solid var(--border-gold-subtle);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    min-width: 180px;
    margin: 0.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: all 0.25s ease;
}

.tree-node:hover {
    border-color: var(--gold);
    box-shadow: var(--shadow-gold);
}

.tree-node .node-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    margin: 0 auto 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    color: var(--gold);
    font-size: 1.1rem;
}

/* Responsive & Mobile Protection */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
}

.app-wrapper {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
}

.app-main {
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
}

.impersonation-bar code {
    color: var(--gold) !important;
    background: rgba(0, 0, 0, 0.35) !important;
    padding: 2px 5px !important;
    border-radius: 4px !important;
}

/* Ensure tables always match dark theme */
.table, .table-luxury, table {
    --bs-table-bg: transparent !important;
    --bs-table-color: #cbd5e1 !important;
    background-color: transparent !important;
    color: #cbd5e1 !important;
}

.table > :not(caption) > * > *,
.table-luxury > :not(caption) > * > * {
    background-color: transparent !important;
    color: #e2e8f0 !important;
}

.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .app-content {
        padding: 1rem 0.75rem;
    }
    .app-navbar {
        padding: 0 0.85rem;
    }
}

@media (max-width: 576px) {
    .card-premium.p-4 {
        padding: 1rem 0.85rem !important;
    }
    .card-premium {
        overflow: hidden;
    }
    .badge {
        max-width: 100%;
        text-overflow: ellipsis;
    }
}

