/* ============================================
   GijsbersWebsites Facturatie — Custom Styles
   ============================================ */

:root {
    --gw-primary: #2563eb;
    --gw-primary-dark: #1d4ed8;
    --gw-primary-light: #dbeafe;
    --gw-success: #16a34a;
    --gw-warning: #d97706;
    --gw-danger: #dc2626;
    --gw-sidebar-width: 260px;
    --gw-topbar-height: 56px;
}

/* ---- Layout ---- */
body {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    background-color: #f1f5f9;
}

#sidebar {
    width: var(--gw-sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0;
    z-index: 1030;
    transition: transform 0.3s ease;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 2px 0 8px rgba(0,0,0,.12);
}

#sidebar .sidebar-brand {
    padding: 1.2rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

#sidebar .sidebar-brand h5 {
    color: #fff;
    font-weight: 700;
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

#sidebar .nav-link {
    color: rgba(255,255,255,.7);
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

#sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
}

#sidebar .nav-link.active {
    color: #fff;
    background: rgba(37, 99, 235, 0.15);
    border-left-color: var(--gw-primary);
}

#sidebar .nav-link i {
    width: 22px;
    text-align: center;
    margin-right: 8px;
    font-size: 1rem;
}

#content-wrapper {
    flex: 1;
    margin-left: var(--gw-sidebar-width);
    transition: margin-left 0.3s ease;
}

.topbar {
    height: var(--gw-topbar-height);
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.main-content {
    padding: 1.5rem;
}

/* ---- Sidebar collapse (mobile) ---- */
@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.show {
        transform: translateX(0);
    }
    #content-wrapper {
        margin-left: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1029;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

/* ---- Cards ---- */
.stat-card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-card .stat-icon.bg-primary-light { background: var(--gw-primary-light); color: var(--gw-primary); }
.stat-card .stat-icon.bg-success-light { background: #dcfce7; color: var(--gw-success); }
.stat-card .stat-icon.bg-warning-light { background: #fef3c7; color: var(--gw-warning); }
.stat-card .stat-icon.bg-danger-light  { background: #fee2e2; color: var(--gw-danger); }

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.stat-card .stat-label {
    font-size: 0.82rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---- Page header ---- */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.page-header .breadcrumb {
    font-size: 0.82rem;
    margin-bottom: 0;
}

/* ---- Tables ---- */
.table-card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    overflow: hidden;
}

.table-card .table {
    margin-bottom: 0;
}

.table-card .table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    font-weight: 600;
    padding: 0.75rem 1rem;
}

.table-card .table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-card .table tbody tr:hover {
    background-color: #f8fafc;
}

/* ---- Status badges ---- */
.badge-status {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35em 0.7em;
    border-radius: 6px;
}

.badge-draft     { background: #f1f5f9; color: #475569; }
.badge-sent      { background: #dbeafe; color: #1d4ed8; }
.badge-paid      { background: #dcfce7; color: #15803d; }
.badge-overdue   { background: #fee2e2; color: #b91c1c; }
.badge-cancelled { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }

/* ---- Forms ---- */
.form-card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    padding: 1.5rem;
}

.form-card .form-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: #374151;
}

.form-card .form-control:focus,
.form-card .form-select:focus {
    border-color: var(--gw-primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

/* ---- Invoice items table ---- */
.items-table th {
    font-size: 0.82rem;
    background: #f8fafc;
}

.items-table .btn-sm {
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
}

/* ---- Buttons ---- */
.btn-primary {
    background-color: var(--gw-primary);
    border-color: var(--gw-primary);
}

.btn-primary:hover {
    background-color: var(--gw-primary-dark);
    border-color: var(--gw-primary-dark);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ---- Detail view ---- */
.detail-card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
}

.detail-card .detail-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.detail-card .detail-body {
    padding: 1.5rem;
}

.detail-label {
    font-size: 0.82rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
}

/* ---- Alerts in empty states ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* ---- Dark mode ---- */
[data-bs-theme="dark"] body {
    background-color: #0f172a;
}

[data-bs-theme="dark"] #sidebar {
    background: linear-gradient(180deg, #020617 0%, #0f172a 100%);
}

[data-bs-theme="dark"] .topbar {
    background: #1e293b;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

[data-bs-theme="dark"] .stat-card,
[data-bs-theme="dark"] .table-card,
[data-bs-theme="dark"] .form-card,
[data-bs-theme="dark"] .detail-card {
    background: #1e293b;
    box-shadow: 0 1px 6px rgba(0,0,0,.2);
}

[data-bs-theme="dark"] .table-card .table thead th {
    background: #0f172a;
    border-bottom-color: #334155;
    color: #94a3b8;
}

[data-bs-theme="dark"] .table-card .table tbody tr:hover {
    background-color: #0f172a;
}

[data-bs-theme="dark"] .stat-card .stat-value { color: #f1f5f9; }
[data-bs-theme="dark"] .detail-value { color: #f1f5f9; }
[data-bs-theme="dark"] .page-header h1 { color: #f1f5f9; }
[data-bs-theme="dark"] .form-card .form-label { color: #cbd5e1; }

/* ---- Utility ---- */
.currency::before { content: '€ '; }
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Login page ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
    padding: 2.5rem;
}

.login-card h2 {
    font-weight: 700;
    color: var(--gw-primary);
}

/* ---- Print ---- */
@media print {
    #sidebar, .topbar, .no-print { display: none !important; }
    #content-wrapper { margin-left: 0 !important; }
    .main-content { padding: 0; }
    .stat-card, .table-card, .form-card, .detail-card {
        box-shadow: none;
        break-inside: avoid;
    }
}
