/* ── Northwind Traders - Main Stylesheet ── */

:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #4e73df;
    --topbar-height: 56px;
    --primary: #4e73df;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --light: #f8f9fc;
    --dark: #1e293b;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--light);
    color: #333;
    margin: 0;
    overflow-x: hidden;
}

/* ── App Layout ── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--primary);
}

.sidebar-brand span {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-section {
    padding: 12px 20px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #64748b;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: #e2e8f0;
}

.nav-link.active {
    background: rgba(78, 115, 223, 0.15);
    color: #fff;
    border-left-color: var(--primary);
}

.nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

/* ── Main Content ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e3e6f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-title h5 {
    margin: 0;
    color: var(--primary);
    font-weight: 700;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-area {
    padding: 24px;
    flex: 1;
}

/* ── KPI Cards ── */
.kpi-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.kpi-blue { border-left-color: var(--primary); }
.kpi-green { border-left-color: var(--success); }
.kpi-purple { border-left-color: #85aa00; }
.kpi-orange { border-left-color: var(--warning); }

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-blue .kpi-icon { background: rgba(78,115,223,0.1); color: var(--primary); }
.kpi-green .kpi-icon { background: rgba(28,200,138,0.1); color: var(--success); }
.kpi-purple .kpi-icon { background: rgba(133,170,0,0.1); color: #85aa00; }
.kpi-orange .kpi-icon { background: rgba(246,194,62,0.1); color: var(--warning); }

.kpi-content { flex: 1; }
.kpi-label { font-size: 0.8rem; color: #888; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.kpi-value { font-size: 1.8rem; font-weight: 700; color: #333; line-height: 1.2; }
.kpi-trend { font-size: 0.75rem; color: #aaa; margin-top: 2px; }
.kpi-trend i { margin-right: 3px; }

/* ── Cards ── */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e3e6f0;
    padding: 16px 20px;
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
    color: var(--primary);
}

.card-header h6 {
    color: var(--primary);
    margin: 0;
}

.card-body { background: #fff; }

/* ── Tables ── */
.table { margin-bottom: 0; }
.table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    font-weight: 600;
    border-bottom-width: 2px;
    background: #f8f9fc;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover { background: rgba(78, 115, 223, 0.03); }

/* ── DataTables Custom ── */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    padding: 12px 20px;
    color: #666;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: 6px;
    border: 1px solid #ddd;
    padding: 4px 8px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    margin: 0 2px;
}

/* ── Report Buttons ── */
.report-btn {
    background: #f8f9fc;
    border: 2px solid #e3e6f0;
    color: #555;
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    transition: all 0.2s;
    display: block;
}

.report-btn:hover {
    background: #fff;
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}

.report-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.report-btn i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 6px;
}

/* ── Avatar Circles ── */
.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .content-area {
        padding: 16px;
    }
    .kpi-card {
        padding: 16px;
    }
    .kpi-value {
        font-size: 1.4rem;
    }
}

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

/* ── Badge Pills ── */
.badge.rounded-pill {
    padding: 4px 10px;
    font-weight: 500;
}

/* ── Print ── */
@media print {
    .sidebar, .top-bar { display: none; }
    .main-content { margin-left: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ── Flash Messages ── */
.flash-messages {
    position: sticky;
    top: var(--topbar-height);
    z-index: 200;
}

.flash-messages .alert {
    margin-bottom: 0;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
