/* Frenmo — Apple-Inspired Theme with Dark Mode */

:root {
    --bg-page: #FBFBFD;
    --bg-card: #FFFFFF;
    --bg-input: #F2F2F7;
    --bg-hover: #F2F2F7;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --text-muted: #AEAEB2;
    --border: #E5E7EB;
    --border-light: #F2F2F7;
    --accent: #007AFF;
    --navbar-bg: #FFFFFF;
    --navbar-border: #E3E8EE;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04);
}

[data-theme="dark"] {
    --bg-page: #000000;
    --bg-card: #1C1C1E;
    --bg-input: #2C2C2E;
    --bg-hover: #2C2C2E;
    --text-primary: #E5E5E7;
    --text-secondary: #98989F;
    --text-muted: #48484A;
    --border: #38383A;
    --border-light: #2C2C2E;
    --accent: #0A84FF;
    --navbar-bg: #1C1C1E;
    --navbar-border: #38383A;
    --card-shadow: none;
}

/* Dark mode overrides — elevation through lighter surfaces, not shadows */
[data-theme="dark"] .card {
    background: #1C1C1E !important;
    border: 1px solid #38383A !important;
    box-shadow: none !important;
}
[data-theme="dark"] .card-blue { background: #1C1C1E !important; }
[data-theme="dark"] .card-green { background: #1C1C1E !important; }
[data-theme="dark"] .card-orange { background: #1C1C1E !important; }
[data-theme="dark"] .card-yellow { background: #1C1C1E !important; }

[data-theme="dark"] .hero-card {
    background: linear-gradient(135deg, #0A3D91 0%, #1C3D5A 100%) !important;
    border: 1px solid #38383A !important;
    box-shadow: none !important;
}

[data-theme="dark"] .btn-primary {
    background: #0A84FF !important;
}
[data-theme="dark"] .btn-primary:hover {
    background: #409CFF !important;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3) !important;
}
[data-theme="dark"] .btn-success {
    background: #30D158 !important;
}

[data-theme="dark"] .alert-error {
    background: #3A1C1E !important;
    color: #FF6961 !important;
    border: 1px solid #5C2C2E !important;
}

[data-theme="dark"] .link-primary {
    color: #0A84FF !important;
}

[data-theme="dark"] .badge-outline {
    background: #2C2C2E !important;
    border-color: #0A84FF !important;
    color: #0A84FF !important;
}

[data-theme="dark"] .checkbox {
    border-color: #48484A !important;
}

/* Dark mode people selector */
[data-theme="dark"] .person-row { opacity: 0.5; }
[data-theme="dark"] .person-row:has(:checked) { opacity: 1; background: rgba(10, 132, 255, 0.08); }
[data-theme="dark"] .person-row .p-name { color: #E5E5E7; }
[data-theme="dark"] .person-row .p-status { border-color: #48484A; }

/* Dark mode — universal overrides for ALL light backgrounds */
/* Solid white backgrounds */
[data-theme="dark"] [style*="background: #FFFFFF"] { background: #1C1C1E !important; }
[data-theme="dark"] [style*="background: #F2F2F7"] { background: #2C2C2E !important; }
[data-theme="dark"] [style*="background: #F9FAFB"] { background: #2C2C2E !important; }
[data-theme="dark"] [style*="background: #F8FAFF"] { background: #2C2C2E !important; }
[data-theme="dark"] [style*="background: #FFFDF7"] { background: #2C2C2E !important; }
[data-theme="dark"] [style*="background: #EEF2FF"] { background: #2C2C2E !important; }
[data-theme="dark"] [style*="background: #ECFDF5"] { background: #1A2E1A !important; }
[data-theme="dark"] [style*="background: #FEF2F2"] { background: #3A1C1E !important; }

/* Gradient backgrounds — override ALL light gradients */
[data-theme="dark"] [style*="linear-gradient(180deg, #DBEAFE"] { background: #1C1C1E !important; }
[data-theme="dark"] [style*="linear-gradient(180deg, #EEF2FF"] { background: #1C1C1E !important; }
[data-theme="dark"] [style*="linear-gradient(180deg, #EFF6FF"] { background: #1C1C1E !important; }
[data-theme="dark"] [style*="linear-gradient(180deg, #F0FDF4"] { background: #1C1C1E !important; }
[data-theme="dark"] [style*="linear-gradient(180deg, #D1FAE5"] { background: #1C1C1E !important; }
[data-theme="dark"] [style*="linear-gradient(180deg, #FED7AA"] { background: #1C1C1E !important; }
[data-theme="dark"] [style*="linear-gradient(180deg, #BBF7D0"] { background: #1A2E1A !important; }
[data-theme="dark"] [style*="linear-gradient(180deg, #93C5FD"] { background: #0A1A3D !important; }
[data-theme="dark"] [style*="linear-gradient(180deg, #FEF2F2"] { background: #3A1C1E !important; }
[data-theme="dark"] [style*="linear-gradient(135deg, #FFFFFF"] { background: #1C1C1E !important; }

/* Hero card balance variants */
[data-theme="dark"] .hero-card { background: #1C1C1E !important; border: 1px solid #38383A !important; }

/* Rounded containers (sidebar, converter, etc) */
[data-theme="dark"] .rounded-2xl[style*="background"] { background: #1C1C1E !important; border-color: #38383A !important; }
[data-theme="dark"] .rounded-xl[style*="background"] { background: #1C1C1E !important; border-color: #38383A !important; }

/* Text colors */
[data-theme="dark"] [style*="color: #86868B"] { color: #98989F !important; }
[data-theme="dark"] [style*="color: #AEAEB2"] { color: #636366 !important; }
[data-theme="dark"] [style*="color: #6E6E73"] { color: #98989F !important; }
[data-theme="dark"] [style*="color: #697386"] { color: #98989F !important; }
[data-theme="dark"] [style*="color: #78716C"] { color: #636366 !important; }

/* Borders */
[data-theme="dark"] [style*="border: 1px solid #E5E7EB"] { border-color: #38383A !important; }
[data-theme="dark"] [style*="border: 1px solid #BFDBFE"] { border-color: #38383A !important; }
[data-theme="dark"] [style*="border: 1px solid #BBF7D0"] { border-color: #38383A !important; }
[data-theme="dark"] [style*="border: 1px solid #A7F3D0"] { border-color: #38383A !important; }
[data-theme="dark"] [style*="border: 1px solid #FECACA"] { border-color: #5C2C2E !important; }
[data-theme="dark"] [style*="border: 1px solid #FDE68A"] { border-color: #38383A !important; }
[data-theme="dark"] [style*="border: 1px solid #DBEAFE"] { border-color: #38383A !important; }
[data-theme="dark"] [style*="border-color: #E3E8EE"] { border-color: #38383A !important; }
[data-theme="dark"] [style*="border: 2px dashed #BFDBFE"] { border-color: #38383A !important; }

/* Inputs in dark mode */
[data-theme="dark"] input[style*="background"], [data-theme="dark"] select[style*="background"] {
    background: #2C2C2E !important; color: #E5E5E7 !important; border-color: #48484A !important;
}

/* Hover states on dark */
[data-theme="dark"] .hover\:bg-gray-50:hover { background: #2C2C2E !important; }
[data-theme="dark"] .hover\:bg-blue-50:hover { background: #0A1A3D !important; }

/* Balance colors */
.balance-positive { color: #34C759; font-weight: 600; }
.balance-negative { color: #FF3B30; }
.balance-zero { color: var(--text-muted); }

/* Cards */
.card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    color: var(--text-primary);
    box-shadow: var(--card-shadow) !important;
}

/* Card color variants */
.card-blue { background: linear-gradient(180deg, #DBEAFE 0%, #FFFFFF 40%) !important; border-color: #BFDBFE !important; }
.card-green { background: linear-gradient(180deg, #D1FAE5 0%, #FFFFFF 40%) !important; border-color: #A7F3D0 !important; }
.card-orange { background: linear-gradient(180deg, #FED7AA 0%, #FFFFFF 40%) !important; border-color: #FDBA74 !important; }
.card-yellow { background: linear-gradient(180deg, #FEF3C7 0%, #FFFFFF 40%) !important; border-color: #FDE68A !important; }

/* Hero card */
.hero-card {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    border-radius: 20px !important;
    padding: 2rem;
    color: #FFFFFF;
    box-shadow: 0 8px 30px rgba(0,122,255,0.2);
}

/* Primary buttons — Apple blue */
.btn-primary {
    background: #007AFF !important;
    border: none !important;
    color: #FFFFFF !important;
    border-radius: 12px !important;
    font-weight: 600;
}
.btn-primary:hover {
    background: #0071E3 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* Success button */
.btn-success {
    background: #34C759 !important;
    border: none !important;
    color: #FFFFFF !important;
    border-radius: 12px !important;
}

/* Error/danger */
.text-error {
    color: #FF3B30 !important;
}

/* Ghost buttons */
.btn-ghost {
    border-radius: 12px !important;
    color: var(--text-secondary) !important;
}
.btn-ghost:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

/* Badge */
.badge-outline {
    border-color: #007AFF !important;
    color: #007AFF !important;
    border-radius: 8px !important;
    background: #F0F5FF !important;
}

/* Form inputs */
.input, .select {
    background: var(--bg-input) !important;
    border: none !important;
    border-radius: 12px !important;
    color: var(--text-primary) !important;
}
.input:focus, .select:focus {
    outline: 2px solid #007AFF !important;
    outline-offset: -1px;
    box-shadow: none !important;
}
.input::placeholder {
    color: #AEAEB2 !important;
}

.checkbox {
    border-color: #D1D1D6 !important;
}
.checkbox:checked {
    background-color: #007AFF !important;
    border-color: #007AFF !important;
}

/* Labels and secondary text */
.label-text {
    color: var(--text-secondary) !important;
}
.text-gray-500 {
    color: var(--text-secondary) !important;
}
.text-gray-400 {
    color: var(--text-muted) !important;
}

/* Section headers */
.card-body h3 {
    letter-spacing: 0.03em;
    color: var(--text-secondary) !important;
    font-size: 0.75rem;
}

/* Card titles */
.card-title {
    color: var(--text-primary) !important;
}

/* Hero balance */
.hero-balance {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #1D1D1F;
}
.hero-positive { color: #34C759 !important; }
.hero-negative { color: #FF3B30 !important; }
.hero-zero { color: #8E8E93 !important; }

/* Quick action circles — Apple style */
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: transform 0.15s ease;
}
.quick-action:hover {
    transform: scale(1.05);
}
.quick-action:active {
    transform: scale(0.95);
}
.quick-action .icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: #F2F2F7;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    transition: all 0.15s ease;
}
.quick-action:hover .icon-circle {
    background: #E5E5EA;
}
.quick-action .icon-label {
    font-size: 0.7rem;
    color: #6E6E73;
    font-weight: 500;
}

/* Links */
.link-primary {
    color: #007AFF !important;
}
.link-primary:hover {
    color: #0071E3 !important;
}

/* Alert */
.alert-error {
    background: #FFF2F2 !important;
    color: #FF3B30 !important;
    border: none !important;
    border-radius: 12px !important;
}

/* Typography — Apple SF precision */
h2, h3, .card-title, .hero-balance {
    letter-spacing: -0.02em;
}
h2 {
    font-weight: 700;
    color: #1D1D1F;
}

/* Smooth transitions — no lag */
.card, .btn {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.input, .select {
    transition: outline 0.1s ease;
}

/* Hover cards — subtle lift */
.card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 12px 32px rgba(0,0,0,0.06) !important;
    transform: translateY(-1px);
}

/* Navbar hover */
.navbar a:hover {
    color: #007AFF !important;
}

/* Card padding */
.card-body {
    padding: 1.25rem !important;
}

/* Section dividers */
.border-b {
    border-color: var(--border-light) !important;
}

/* Dark mode toggle */
.theme-toggle {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border: none; font-size: 16px;
    background: var(--bg-input); transition: all 0.2s ease;
}
.theme-toggle:hover { background: var(--bg-hover); }
