/* styles.css – Bronwel Suppliers | Premium Dashboard UI */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-dark: #0A2540;
    --primary: #1A4D6F;
    --accent: #635BFF;
    --accent-light: #E9E8FF;
    --bg-page: #F6F9FC;
    --card-bg: #FFFFFF;
    --border-light: #E2E8F0;
    --text-primary: #1E293B;
    --text-secondary: #5B6E8C;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --radius: 14px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.03), 0 1px 3px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar – fixed, clean */
.sidebar {
    width: 260px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-light);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 10;
}

.sidebar-logo {
    padding: 1.8rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1.5rem;
}

.sidebar-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary-dark), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.sidebar-logo p {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.7rem 1.5rem;
    margin: 0.2rem 0.8rem;
    border-radius: 40px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s ease;
}

.sidebar-nav a:hover {
    background: #F1F5F9;
    color: var(--primary-dark);
}

.sidebar-nav .active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: 260px;
    width: calc(100% - 260px);
}

/* Topbar */
.topbar {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-light);
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--primary-dark);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-badge {
    position: relative;
    cursor: default;
    font-size: 1.2rem;
}

.avatar {
    width: 38px;
    height: 38px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

/* Cards & Grids */
/* KPI cards - 4 per row on desktop */
.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 1.5rem 0;
}

/* Responsive: 2 cards on tablet, 1 on mobile */
@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.2rem 1.2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #CBD5E1;
}

.stat-icon {
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.2;
}

.stat-trend {
    font-size: 0.7rem;
    color: var(--success);
    margin-top: 0.4rem;
}

/* Tables (borderless, horizontal separators) */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 0.9rem 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-light);
}

.data-table td {
    padding: 1rem 0.5rem;
    border-bottom: 1px solid #F0F2F5;
    font-size: 0.9rem;
}

.data-table tr:hover td {
    background: #FCFDFF;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 40px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-success { background: #E0F2E9; color: #166534; }
.badge-warning { background: #FEF3C7; color: #B45309; }
.badge-info { background: #E0F2FE; color: #0E5F72; }
.badge-danger { background: #FEE2E2; color: #991B1B; }

/* Progress bar */
.progress-bar {
    width: 100px;
    background: #E2E8F0;
    border-radius: 20px;
    height: 5px;
    overflow: hidden;
}

.progress-fill {
    background: var(--accent);
    height: 5px;
    border-radius: 20px;
}

/* Warehouse cards */
.warehouse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.warehouse-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

/* Tracking timeline (vertical) */
.tracking-timeline {
    margin-top: 2rem;
    border-left: 2px solid #E2E8F0;
    padding-left: 2rem;
    position: relative;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-dot {
    position: absolute;
    left: -2.3rem;
    top: 0.2rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    border: 2px solid #CBD5E1;
}

.timeline-dot.completed {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
}

.timeline-dot.current {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,91,255,0.2);
}

.timeline-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Auth pages (centered card) */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(120deg, #F6F9FC 0%, #FFFFFF 100%);
}

.auth-card {
    background: white;
    padding: 2rem;
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-light);
}

.auth-card h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-dark);
}

.auth-card input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 40px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.btn {
    background: var(--primary-dark);
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 40px;
    font-weight: 500;
    width: 100%;
    cursor: pointer;
    transition: 0.15s;
}

.btn-primary {
    background: var(--accent);
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .topbar {
        padding: 0.8rem 1rem;
    }
    .page-title {
        font-size: 1.4rem;
    }
}

/* Premium icon styling for dashboard */
.stat-icon i {
    font-size: 2rem;
    color: var(--accent);
    opacity: 0.85;
    transition: opacity 0.2s;
}

.stat-card:hover .stat-icon i {
    opacity: 1;
}

.sidebar-nav i {
    width: 1.6rem;
    font-size: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.sidebar-nav .active i {
    color: var(--accent);
}

.notification-badge i {
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Section title icons */
h3 i {
    margin-right: 0.5rem;
    color: var(--accent);
}

/* ========== DARK MODE VARIABLES ========== */
body.dark-theme {
    --primary-dark: #1E2A3A;
    --primary: #2C3E50;
    --accent: #818CF8;
    --accent-light: #312E81;
    --bg-page: #0F172A;
    --card-bg: #1E293B;
    --border-light: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

/* override any hardcoded white backgrounds */
body.dark-theme .stat-card,
body.dark-theme .warehouse-card,
body.dark-theme .data-table,
body.dark-theme .sidebar,
body.dark-theme .topbar,
body.dark-theme [style*="background: white"] {
    background-color: var(--card-bg) !important;
}

body.dark-theme .data-table tr:hover td {
    background: rgba(129, 140, 248, 0.05);
}

body.dark-theme .progress-bar {
    background: #334155;
}

/* Theme toggle button styling */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    color: var(--text-secondary);
}

.theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-theme .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ========== ANALYTICS SECTION STYLING ========== */
.analytics {
    margin: 2rem 0 2rem 0;
}

.analytics-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analytics-title i {
    color: var(--accent);
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* .analytics-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
} */

.analytics-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.analytics-card.wide {
    grid-column: span 1;
}

@media (min-width: 1024px) {
    .analytics-card.wide {
        grid-column: span 2;
    }
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.7rem;
}

.card-header i {
    font-size: 1.2rem;
    color: var(--accent);
    background: rgba(99, 91, 255, 0.1);
    padding: 0.4rem;
    border-radius: 12px;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* .chart-container {
    position: relative;
    height: 220px;
    margin: 0.5rem 0;
} */

/* Warehouse utilization list inside card */
.warehouse-util-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.util-item {
    width: 100%;
}

.util-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
    color: var(--text-secondary);
}

/* Ensure progress bars inside analytics card use theme colors */
.analytics-card .progress-bar {
    background: var(--border-light);
    height: 6px;
    border-radius: 10px;
    overflow: hidden;
}

.analytics-card .progress-fill {
    background: var(--accent);
    height: 100%;
    border-radius: 10px;
}

/* Dark mode adjustments for charts (canvas text color handled by Chart.js defaults) */
body.dark-theme .analytics-card {
    background: var(--card-bg);
    border-color: var(--border-light);
}

body.dark-theme .card-header {
    border-bottom-color: var(--border-light);
}

/* Responsive tweaks */
@media (max-width: 768px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    .chart-container {
        height: 200px;
    }
}

/* ========== ANALYTICS SECTION FIXES ========== */
.analytics-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
    overflow: hidden; /* prevent any overflow */
}

.chart-container {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 200px;
    max-height: 260px;
    margin: 0.5rem 0;
}

.chart-container canvas {
    max-width: 100%;
    height: auto !important;
    width: 100% !important;
}

/* For donut charts, ensure they don't become huge */
canvas {
    max-height: 200px;
    width: auto !important;
    margin: 0 auto;
}

/* Ensure horizontal bar chart also fits */
#topRoutesChart {
    max-height: 280px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chart-container {
        min-height: 180px;
        max-height: 220px;
    }
    canvas {
        max-height: 180px;
    }
}

.dalogo{
    height: 50px !important;
    opacity: 0.8;
}

/* ========== CUSTOMER SPECIFIC STYLES ========== */
.customer-welcome {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(26,77,111,0.03), rgba(0,168,204,0.03));
    border-radius: 28px;
    border: 1px solid var(--border-light);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border-light);
    transition: transform 0.2s;
}
.summary-card:hover { transform: translateY(-3px); }

.alert-card {
    background: #fffbeb;
    border-left: 4px solid #f39c12;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.shipment-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.shipment-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all 0.2s;
}
.shipment-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.timeline-vertical {
    border-left: 2px solid var(--border-light);
    padding-left: 1.5rem;
    margin: 1rem 0;
}
.timeline-step {
    position: relative;
    margin-bottom: 1.5rem;
}
.timeline-step .step-dot {
    position: absolute;
    left: -2rem;
    top: 0.2rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #cbd5e1;
}
.timeline-step.completed .step-dot { background: #10b981; }
.timeline-step.active .step-dot { background: #00a8cc; box-shadow: 0 0 0 3px rgba(0,168,204,0.2); }

.doc-list {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}
.doc-btn {
    background: var(--accent-light);
    padding: 0.4rem 1rem;
    border-radius: 40px;
    font-size: 0.75rem;
}

.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}
.quick-btn {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 60px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    transition: 0.2s;
}
.quick-btn:hover { background: var(--accent); color: white; }

.role-toggle {
    display: flex;
    gap: 0.5rem;
    background: #f1f5f9;
    border-radius: 40px;
    padding: 0.2rem;
}
.role-btn {
    padding: 0.3rem 1rem;
    border-radius: 40px;
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s;
}
.role-btn.active {
    background: var(--accent);
    color: white;
}

/* 1. Alert card – dark theme compatibility */
.alert-card {
    background: #fffbeb;
    border-left: 4px solid #f39c12;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
}

body.dark-theme .alert-card {
    background: #2d2a1e;
    border-left-color: #f39c12;
    color: #f5e6c4;
}

/* 2. Shipment card button – prevent overlap & remove underline */
.shipment-card .btn {
    display: inline-block;
    margin-top: 0.8rem;
    text-decoration: none;
    width: auto;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
}

.shipment-card {
    overflow: visible; /* ensure button not cut off */
    display: flex;
    flex-direction: column;
}

.shipment-card .progress-bar {
    margin: 0.5rem 0;
}

/* 2.1 Remove underline from all buttons and doc-btn */
.btn, .doc-btn, .quick-btn, .role-btn, .theme-toggle {
    text-decoration: none;
}

/* 3. doc-btn on invoices – dark theme contrast & no underline */
.doc-btn {
    background: var(--accent-light);
    padding: 0.3rem 0.8rem;
    border-radius: 40px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: 0.2s;
    text-decoration: none;
    color: var(--text-primary);
}

body.dark-theme .doc-btn {
    background: #334155;
    color: #e2e8f0;
}

.doc-btn:hover {
    background: var(--accent);
    color: white;
}

/* 4. Activity feed – left padding for better alignment */
.activity-feed {
    padding-left: 1rem;
}

.activity-feed .timeline-step {
    margin-bottom: 0.8rem;
    position: relative;
    padding-left: 0.5rem;
}

/* Also ensure the step-dot inside activity feed is properly positioned */
.activity-feed .step-dot {
    left: -0.8rem;
    top: 0.2rem;
}

/* Demo auth links (temporary, topbar) */
.demo-auth-links {
    display: flex;
    gap: 0.5rem;
    margin-right: 0.5rem;
}

.demo-auth-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 40px;
    padding: 0.3rem 0.9rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.demo-auth-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-1px);
}

/* Dark mode compatibility */
body.dark-theme .demo-auth-btn {
    border-color: #475569;
    color: #cbd5e1;
}

body.dark-theme .demo-auth-btn:hover {
    background: var(--accent);
    color: white;
}

/* Responsive: on mobile, reduce padding */
@media (max-width: 640px) {
    .demo-auth-btn span { display: none; }
    .demo-auth-btn i { margin: 0; }
    .demo-auth-btn { padding: 0.3rem 0.6rem; }
}