/* ═══════════════════════════════════════════════
   ZZP Boekhouding – Custom Stylesheet v5
   Mobile-first responsive + PWA ready
   ═══════════════════════════════════════════════ */

/* ── CSS variabelen ──────────────────────────── */
:root {
    --sidebar-w: 260px;
    --sidebar-w-collapsed: 64px;
    --sidebar-bg-start: #1a2a4a;
    --sidebar-bg-end:   #0d1b2e;
    --topbar-h: 56px;
}

/* ── Body / wrapper ──────────────────────────── */
body {
    font-size: 0.9rem;
    background: #f5f7fa;
    overscroll-behavior: none;       /* prevent pull-to-refresh on mobile */
}

#wrapper {
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════
   SIDEBAR – desktop
   ═══════════════════════════════════════════════ */
#sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    transition: width 0.25s ease, transform 0.25s ease;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1030;
}

#sidebar .nav-link {
    border-radius: 8px;
    padding: 10px 12px;
    transition: background 0.15s;
    font-size: 0.88rem;
    white-space: nowrap;
}

#sidebar .nav-link:hover  { background: rgba(255,255,255,0.12); }
#sidebar .nav-link.active { background: #007bff; color: #fff !important; }

/* ── Sidebar: desktop collapsed (toggle) ─────── */
#sidebar.collapsed {
    width: var(--sidebar-w-collapsed);
}
#sidebar.collapsed .sidebar-label,
#sidebar.collapsed .fs-5,
#sidebar.collapsed .sidebar-section-label,
#sidebar.collapsed small.text-white-50 {
    display: none !important;
}
#sidebar.collapsed .nav-link { justify-content: center; padding: 10px 0; }

/* ── Scrollbar ───────────────────────────────── */
#sidebar::-webkit-scrollbar       { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

/* ═══════════════════════════════════════════════
   SIDEBAR – MOBILE (overlay slide-in)
   ═══════════════════════════════════════════════ */
@media (max-width: 991.98px) {
    #sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100%;
        width: var(--sidebar-w) !important;
        transform: translateX(-100%);
        z-index: 1045;
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }
    #sidebar.mobile-open {
        transform: translateX(0);
    }
    #sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1044;
    }
    #sidebar-overlay.show { display: block; }

    /* Labels altijd zichtbaar op mobile sidebar */
    #sidebar .sidebar-label,
    #sidebar .fs-5,
    #sidebar .sidebar-section-label {
        display: inline !important;
    }
    #sidebar .nav-link { justify-content: flex-start !important; padding: 10px 12px !important; }
}

/* ═══════════════════════════════════════════════
   PAGE CONTENT
   ═══════════════════════════════════════════════ */
#page-content {
    min-height: 100vh;
    flex: 1;
    min-width: 0;
    transition: all 0.25s ease;
}

/* ── Top bar ─────────────────────────────────── */
.top-bar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ── Content padding ─────────────────────────── */
.content-area {
    padding: 1.5rem;
}
@media (max-width: 575.98px) {
    .content-area { padding: 0.75rem; }
}

/* ═══════════════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════════════ */
.stat-card .card-body { padding: 1.1rem; }

.stat-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem;
    margin-bottom: 0.65rem;
}

.stat-label {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
}

@media (max-width: 575.98px) {
    .stat-value { font-size: 1.05rem; }
}

/* Soft backgrounds */
.bg-success-soft { background: rgba(40,167,69,0.12); }
.bg-danger-soft  { background: rgba(220,53,69,0.12); }
.bg-primary-soft { background: rgba(0,123,255,0.12); }
.bg-warning-soft { background: rgba(255,193,7,0.12); }

/* ═══════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════ */
.card          { border-radius: 12px; }
.card-header   { border-radius: 12px 12px 0 0 !important; border-bottom: 1px solid #f0f0f0; padding: 0.85rem 1.1rem; }

/* ═══════════════════════════════════════════════
   TABLES – mobile-friendly
   ═══════════════════════════════════════════════ */
.table > :not(caption) > * > * { padding: 0.6rem 0.75rem; }

.table-responsive { border-radius: 0 0 12px 12px; }

/* Sticky header inside scrollable table */
.table-responsive thead th { position: sticky; top: 0; z-index: 1; }

@media (max-width: 575.98px) {
    .table > :not(caption) > * > * { padding: 0.45rem 0.5rem; font-size: 0.8rem; }
    /* Hide less-important columns on very small screens */
    .table .hide-xs { display: none !important; }
}

/* ═══════════════════════════════════════════════
   MODALS – full-screen on mobile
   ═══════════════════════════════════════════════ */
.modal-content { border-radius: 14px; border: none; }
.modal-header  { border-radius: 14px 14px 0 0; }

@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100%;
    }
    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }
    .modal-dialog.modal-xl,
    .modal-dialog.modal-lg {
        width: 100%;
    }
}

/* ═══════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════ */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #dee2e6;
    font-size: 0.9rem;
    /* Minimum 16px font on mobile to prevent auto-zoom */
}
@media (max-width: 767.98px) {
    .form-control, .form-select, input, select, textarea {
        font-size: 16px !important;   /* prevent iOS zoom-in */
    }
}
.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,.15);
}
.input-group-text {
    background: #f8f9fa;
    border-color: #dee2e6;
    font-size: 0.9rem;
}

/* ── Touch-vriendelijke touch targets ────────── */
@media (max-width: 991.98px) {
    .btn         { min-height: 40px; }
    .btn-sm      { min-height: 34px; }
    .nav-link    { min-height: 44px; display: flex; align-items: center; }
    .form-check-input { width: 20px; height: 20px; }
    .form-check-label { padding-left: 0.4rem; line-height: 1.8; }
}

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */
.btn        { border-radius: 8px; font-size: 0.88rem; }
.btn-xs     { padding: 0.15rem 0.4rem; font-size: 0.75rem; }

/* Floating action button on mobile */
.fab {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 56px; height: 56px;
    border-radius: 50%;
    font-size: 1.4rem;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    justify-content: center; align-items: center;
}
@media (max-width: 767.98px) {
    .fab { display: flex; }
    .btn-mobile-hide { display: none !important; }
}

/* ═══════════════════════════════════════════════
   NAVIGATION PILLS
   ═══════════════════════════════════════════════ */
.nav-pills .nav-link {
    border-radius: 8px;
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}
@media (max-width: 575.98px) {
    .nav-pills { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
    .nav-pills .nav-link { white-space: nowrap; }
}

/* ═══════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════ */
.page-link { border-radius: 6px !important; margin: 0 2px; font-size: 0.85rem; }

/* ═══════════════════════════════════════════════
   ALERTS & BADGES
   ═══════════════════════════════════════════════ */
.alert  { border-radius: 10px; border-left-width: 4px; }
.badge  { font-weight: 500; letter-spacing: 0.02em; }

/* ═══════════════════════════════════════════════
   PROGRESS
   ═══════════════════════════════════════════════ */
.progress { border-radius: 6px; }

/* ═══════════════════════════════════════════════
   QUICK CAT / BTW SELECTS IN TABLE
   ═══════════════════════════════════════════════ */
.quick-cat, .quick-btw {
    border: none !important;
    background: transparent !important;
    font-size: 0.8rem !important;
    padding: 2px 4px !important;
    cursor: pointer;
}
.quick-cat:focus, .quick-btw:focus { outline: 1px solid #86b7fe; border-radius: 4px; }

/* ═══════════════════════════════════════════════
   FILE ICON
   ═══════════════════════════════════════════════ */
a .fa-file-alt { color: #17a2b8; }

/* ═══════════════════════════════════════════════
   PWA safe-area (notch / home indicator)
   ═══════════════════════════════════════════════ */
@supports (padding: env(safe-area-inset-bottom)) {
    .content-area {
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }
    #sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ═══════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════ */
@media print {
    #sidebar, #sidebar-overlay, .top-bar, .btn, .modal,
    .no-print { display: none !important; }
    #page-content { margin: 0 !important; }
    .card { break-inside: avoid; border: 1px solid #ccc !important; box-shadow: none !important; }
}
