/* ============================================
   REYIS B.V. — Dark/Light Mode Dashboard
   ============================================ */

:root {
    --bg-dark: #0f1117;
    --bg-card: #1a1d27;
    --bg-sidebar: #141620;
    --bg-input: #232636;
    --border: #2a2d3a;
    --blue: #3b82f6;
    --blue-dark: #1e3a5f;
    --blue-light: #60a5fa;
    --green: #22c55e;
    --red: #ef4444;
    --orange: #f59e0b;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --text-muted: #64748b;
    --white: #ffffff;
    --sidebar-width: 240px;
}

body.light {
    --bg-dark: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #f8f9fb;
    --bg-input: #f0f0f0;
    --border: #d0d5dd;
    --text: #1a1a1a;
    --text-dim: #444444;
    --text-muted: #777777;
    --white: #ffffff;
    --blue: #2563eb;
    --blue-light: #3b82f6;
}
body.light .sidebar { border-right: 1px solid #d0d5dd; }
body.light .nav-menu li a.active { background: rgba(37,99,235,0.08); }
body.light .stat-card { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
body.light .card { box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
body.light th { color: #555; }
body.light .badge { font-weight: 600; }

.theme-btn {
    background: none; border: 1px solid var(--border); color: var(--text);
    border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    display: flex;
}

a { color: var(--blue-light); text-decoration: none; }
a:hover { color: var(--white); }

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 28px;
    font-weight: 800;
    color: var(--blue);
    letter-spacing: 3px;
}

.logo-sub {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 6px;
    margin-top: -2px;
}

.nav-menu {
    list-style: none;
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-menu li a:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--white);
}

.nav-menu li a.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--blue-light);
    border-left-color: var(--blue);
}

.nav-menu .icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logout-btn {
    color: var(--red) !important;
    font-size: 12px;
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 22px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

/* ---- MAIN CONTENT ---- */
.content {
    margin-left: var(--sidebar-width);
    padding: 32px;
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

.content-full {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- CARDS ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--white);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.stat-card .label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
}

.stat-card .sub {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 4px;
}

.stat-card.blue { border-left: 3px solid var(--blue); }
.stat-card.green { border-left: 3px solid var(--green); }
.stat-card.red { border-left: 3px solid var(--red); }
.stat-card.orange { border-left: 3px solid var(--orange); }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.card h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 16px;
}

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px;
    font-size: 14px;
    border-bottom: 1px solid rgba(42, 45, 58, 0.5);
    color: var(--text);
}

tr:hover td { background: rgba(59, 130, 246, 0.04); }

/* ---- BADGES ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-concept { background: rgba(100,116,139,0.2); color: #94a3b8; }
.badge-verstuurd { background: rgba(59,130,246,0.2); color: #60a5fa; }
.badge-io { background: rgba(245,158,11,0.2); color: #fbbf24; }
.badge-definitief { background: rgba(34,197,94,0.2); color: #4ade80; }
.badge-betaald { background: rgba(34,197,94,0.3); color: #22c55e; }
.badge-openstaand { background: rgba(239,68,68,0.2); color: #f87171; }
.badge-ontvangen { background: rgba(245,158,11,0.2); color: #fbbf24; }
.badge-geboekt { background: rgba(59,130,246,0.2); color: #60a5fa; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
}
.btn-primary:hover { background: #2563eb; color: var(--white); }

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--blue); }

.btn-danger {
    background: rgba(239,68,68,0.15);
    color: var(--red);
    border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-success {
    background: rgba(34,197,94,0.15);
    color: var(--green);
    border: 1px solid rgba(34,197,94,0.3);
}
.btn-success:hover { background: rgba(34,197,94,0.25); }

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---- FORMS ---- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-inline {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
}

/* ---- FLASH MESSAGES ---- */
.flash-messages { margin-bottom: 20px; }

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 8px;
}

.flash-error { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.flash-success { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.flash-info { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }

/* ---- LOGIN ---- */
.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box .logo { font-size: 36px; margin-bottom: 4px; }
.login-box .logo-sub { margin-bottom: 32px; }

.login-box .form-group { text-align: left; }

.login-box .btn { width: 100%; justify-content: center; margin-top: 8px; }

/* ---- FACTUUR SPECIFIEK ---- */
.factuur-totalen {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.factuur-totalen .row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.factuur-totalen .row.total {
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    border-top: 2px solid var(--border);
    padding-top: 12px;
    margin-top: 8px;
}

.factuur-totalen .row.g-rek {
    color: var(--red);
    font-weight: 600;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: block; }
    .content { margin-left: 0; width: 100%; padding: 16px; padding-top: 56px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card .value { font-size: 22px; }
}

/* ---- UTILITIES ---- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-blue { color: var(--blue-light); }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.eur::before { content: "\20AC "; }
.nowrap { white-space: nowrap; }
.hidden { display: none; }
