/* ================================================================
   JESSE HUB — Spotify-Inspired Design System
   ================================================================ */

:root {
    /* Backgrounds */
    --bg-base: #121212;
    --bg-surface: #181818;
    --bg-elevated: #242424;
    --bg-highlight: #2a2a2a;
    --sidebar-bg: #000000;
    --sidebar-width: 240px;

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #a7a7a7;
    --text-subdued: #6a6a6a;

    /* Borders */
    --border: #333333;
    --border-subtle: #282828;

    /* Accents */
    --accent: #1db954;
    --accent-hover: #1ed760;
    --income: #1db954;
    --expense: #e74c3c;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-pill: 20px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

/* Override Bootstrap dark theme */
[data-bs-theme="dark"] {
    --bs-body-bg: var(--bg-base);
    --bs-body-color: var(--text-primary);
    --bs-border-color: var(--border);
    --bs-tertiary-bg: var(--bg-elevated);
    --bs-dark-bg-subtle: var(--bg-surface);
    --bs-secondary-color: var(--text-secondary);
    --bs-primary: var(--accent);
    --bs-primary-rgb: 29, 185, 84;
    --bs-link-color: var(--accent);
    --bs-link-hover-color: var(--accent-hover);
}

/* ── Base ─────────────────────────────────────────────────────── */

body {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 0.9rem;
    background: var(--bg-base);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    transition: color 0.15s;
}
a:hover {
    color: var(--accent-hover);
}

/* ── Sidebar ──────────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    flex-shrink: 0;
    min-height: 100vh;
    background: var(--sidebar-bg);
    border-right: none;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    position: sticky;
    top: 0;
    align-self: flex-start;
    z-index: 10;
}

.sidebar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}
.sidebar-brand i {
    color: var(--accent);
}

.sidebar-group-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-subdued);
    padding: 0.75rem 0.75rem 0.35rem;
    margin-top: 1.25rem;
    list-style: none;
    font-weight: 600;
}
.sidebar-group-label:first-child {
    margin-top: 0;
}

.sidebar .nav-link {
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar .nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.sidebar .nav-link.active {
    color: var(--text-primary);
    background: var(--accent);
    font-weight: 600;
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* ── Breadcrumbs ──────────────────────────────────────────────── */

.breadcrumb {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    background: none;
    padding: 0;
}
.breadcrumb-item a {
    color: var(--text-subdued);
    text-decoration: none;
}
.breadcrumb-item a:hover {
    color: var(--text-secondary);
}
.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* ── Cards (Surface) ─────────────────────────────────────────── */

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all 0.2s ease;
}
.stat-card:hover {
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.stat-card .stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subdued);
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Clickable card links */
a.stat-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
a.stat-card-link .stat-card {
    border-left: 3px solid var(--border-subtle);
}
a.stat-card-link:hover .stat-card {
    border-left-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* ── Status Colors ────────────────────────────────────────────── */

.text-income, .text-net-positive, .text-under-budget {
    color: var(--income);
}
.text-expense, .text-net-negative, .text-over-budget {
    color: var(--expense);
}
.text-near-budget {
    color: var(--warning);
}

/* ── Progress Bars ────────────────────────────────────────────── */

.goal-progress,
.budget-progress {
    height: 6px;
    border-radius: 3px;
    background: var(--bg-highlight);
    overflow: hidden;
}

.goal-progress .progress-bar,
.budget-progress .progress-bar {
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-bar.bg-success {
    background: linear-gradient(90deg, var(--accent), #1ed760) !important;
}
.progress-bar.bg-primary {
    background: linear-gradient(90deg, var(--info), #60a5fa) !important;
}
.progress-bar.bg-danger {
    background: linear-gradient(90deg, #dc2626, var(--expense)) !important;
}
.progress-bar.bg-warning {
    background: linear-gradient(90deg, #d97706, var(--warning)) !important;
}
.progress-bar.bg-info {
    background: linear-gradient(90deg, #0891b2, #22d3ee) !important;
}

/* ── Tables ────────────────────────────────────────────────────── */

.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--bg-elevated);
    color: var(--text-primary);
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--border-subtle);
    padding: 0.75rem 1rem;
}

.table thead th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subdued);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.table tbody tr {
    transition: background 0.1s;
}
.table tbody tr:hover {
    background: var(--bg-elevated);
}

.table-transactions th,
.table-budget th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-subdued);
    font-weight: 600;
}

/* Table wrapper card */
.table-responsive {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.table-responsive .table {
    margin-bottom: 0;
}

/* ── Buttons ──────────────────────────────────────────────────── */

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 600;
    border-radius: var(--radius-pill);
    padding: 0.4rem 1.25rem;
    transition: all 0.15s;
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #000;
    transform: scale(1.02);
}

.btn-outline-primary {
    color: var(--accent);
    border-color: var(--accent);
    border-radius: var(--radius-pill);
    font-weight: 600;
}
.btn-outline-primary:hover {
    background: var(--accent);
    color: #000;
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border);
    border-radius: var(--radius-pill);
    font-weight: 500;
}
.btn-outline-secondary:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
    border-color: var(--text-secondary);
}

.btn-outline-danger {
    border-radius: var(--radius-pill);
}

.btn-success {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 600;
    border-radius: var(--radius-pill);
}

/* ── Nav Tabs (Modern Pills) ─────────────────────────────────── */

.nav-tabs {
    border-bottom: 1px solid var(--border-subtle);
    gap: 0.25rem;
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.6rem 1rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s;
}
.nav-tabs .nav-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--text-subdued);
}
.nav-tabs .nav-link.active {
    color: var(--text-primary);
    background: transparent;
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* ── Forms ─────────────────────────────────────────────────────── */

.form-control,
.form-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.form-control:focus,
.form-select:focus {
    background: var(--bg-highlight);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(29, 185, 84, 0.15);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-subdued);
}

.input-group-text {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

.form-label,
.col-form-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-text {
    color: var(--text-subdued);
}

/* ── Alerts ────────────────────────────────────────────────────── */

.alert {
    border-radius: var(--radius);
    border: none;
    font-size: 0.875rem;
}

.alert-info {
    background: rgba(29, 185, 84, 0.1);
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-left: 3px solid var(--warning);
}

.alert-danger {
    background: rgba(231, 76, 60, 0.1);
    color: var(--expense);
    border-left: 3px solid var(--expense);
}

.alert-success {
    background: rgba(29, 185, 84, 0.1);
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

.alert-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-left: 3px solid var(--text-subdued);
}

.alert a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* ── Badges ────────────────────────────────────────────────────── */

.badge {
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    padding: 0.3em 0.65em;
    border-radius: var(--radius-sm);
}

.badge-ing {
    background: #ff6200;
    color: #fff;
}
.badge-rabobank {
    background: #003082;
    color: #fff;
}
.badge-knab {
    background: #00a651;
    color: #fff;
}

/* ── Pagination ───────────────────────────────────────────────── */

.pagination {
    gap: 0.25rem;
}
.page-link {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
}
.page-link:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border);
}
.page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

/* ── Category Cards ───────────────────────────────────────────── */

.cat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}
.cat-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.cat-card-add {
    border-style: dashed;
    border-color: var(--text-subdued);
    opacity: 0.5;
    transition: all 0.2s;
}
.cat-card-add:hover,
.cat-card-add:focus-within {
    opacity: 1;
    border-color: var(--accent);
}

.cat-card-header {
    padding: 1rem 1rem 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.cat-card-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.cat-count {
    font-size: 0.7rem;
    color: var(--text-subdued);
}

.cat-card-body {
    padding: 0.875rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 0.3rem 0.5rem 0.3rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.cat-chip:hover {
    border-color: var(--expense);
    color: var(--text-primary);
}

.cat-chip-delete {
    background: none;
    border: none;
    color: var(--text-subdued);
    padding: 0;
    line-height: 1;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 50%;
    width: 1.2rem;
    height: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.cat-chip-delete:hover {
    color: var(--expense);
    background: rgba(231, 76, 60, 0.15);
}

.btn-icon-delete {
    background: none;
    border: none;
    color: var(--text-subdued);
    padding: 0.2rem;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.btn-icon-delete:hover {
    color: var(--expense);
    background: rgba(231, 76, 60, 0.15);
}

.cat-add-form {
    margin-top: auto;
    padding-top: 0.5rem;
}

/* ── Budget Yearly ────────────────────────────────────────────── */

.budget-yearly-table {
    font-size: 0.8rem;
}

.budget-yearly-table .sticky-col {
    position: sticky;
    left: 0;
    background: var(--bg-surface);
    z-index: 1;
}

/* ── Section Headings ─────────────────────────────────────────── */

h2 {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
}

h4 {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

h5 {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Card (Bootstrap override) ────────────────────────────────── */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.card-body {
    padding: 1.25rem;
}

/* ── Scrollbar ────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-highlight);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* ── Selection ────────────────────────────────────────────────── */

::selection {
    background: rgba(29, 185, 84, 0.3);
    color: var(--text-primary);
}

/* ── Utility ──────────────────────────────────────────────────── */

.bg-body-secondary {
    background: var(--bg-elevated) !important;
}
