/* ============================================================
   GOVINDA TRANSPORT - Main Stylesheet
   Bootstrap 5 + Custom Transport Theme
   ============================================================ */

:root {
    --primary: #1a3a5c;
    --primary-light: #2563a8;
    --accent: #e8a020;
    --accent-dark: #c47d10;
    --sidebar-bg: #1a2942;
    --sidebar-text: #c8d6e8;
    --sidebar-hover: #2563a8;
    --sidebar-active: #e8a020;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.10);
    --border-radius: 8px;
    --success-soft: #d4edda;
    --danger-soft: #f8d7da;
    --warning-soft: #fff3cd;
    --info-soft: #d1ecf1;
}

/* ── Body & Layout ────────────────────────────────────────── */
html, body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    background: #f0f4f8;
    color: #333;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
    width: 240px;
    height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
}

    #sidebar.collapsed {
        width: 60px;
    }

        #sidebar.collapsed .brand-text,
        #sidebar.collapsed .sidebar-section,
        #sidebar.collapsed .sidebar-nav li a span {
            display: none;
        }

.sidebar-brand {
    background: var(--primary);
    padding: 16px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid var(--accent);
    min-height: 64px;
}

    .sidebar-brand .brand-text {
        color: #fff;
        font-weight: 700;
        font-size: 13px;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
    }

        .sidebar-brand .brand-text span {
            color: var(--accent);
            font-size: 11px;
            display: block;
            font-weight: 400;
        }

    .sidebar-brand i {
        color: var(--accent);
        font-size: 22px;
        flex-shrink: 0;
    }

.sidebar-section {
    padding: 8px 0 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #6a85a0;
    padding-left: 16px;
    margin-top: 6px;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

    .sidebar-nav li a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
        color: var(--sidebar-text);
        text-decoration: none;
        font-size: 13.5px;
        transition: all 0.2s;
        border-left: 3px solid transparent;
        white-space: nowrap;
        overflow: hidden;
    }

        .sidebar-nav li a:hover {
            background: rgba(255,255,255,0.06);
            color: #fff;
            border-left-color: var(--accent);
        }

        .sidebar-nav li a.active {
            background: rgba(37,99,168,0.25);
            color: var(--accent);
            border-left-color: var(--accent);
            font-weight: 600;
        }

        .sidebar-nav li a i {
            font-size: 16px;
            flex-shrink: 0;
            width: 20px;
            text-align: center;
        }

    .sidebar-nav .submenu {
        display: none;
        background: rgba(0,0,0,0.15);
    }

        .sidebar-nav .submenu.open {
            display: block;
        }

        .sidebar-nav .submenu li a {
            padding-left: 44px;
            font-size: 13px;
        }

    .sidebar-nav .has-sub > a::after {
        content: "\F107";
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        margin-left: auto;
        transition: transform 0.3s;
    }

    .sidebar-nav .has-sub.open > a::after {
        transform: rotate(180deg);
    }

/* ── Topbar ──────────────────────────────────────────────── */
#topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: fixed;
    top: 0;
    transform: none;
    right: 0;
    left: 240px;
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    transition: left 0.3s ease;
}

body.sidebar-collapsed #topbar {
    left: 60px;
}

.topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}

    .topbar-user .avatar {
        width: 34px;
        height: 34px;
        background: var(--primary-light);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-weight: 700;
        font-size: 13px;
    }

/* ── Main Content ─────────────────────────────────────────── */
#main-content {
    margin-left: 240px;
    margin-top: 60px;
    padding: 24px;
    min-height: calc(100vh - 60px);
    transition: margin-left 0.3s ease;
}

body.sidebar-collapsed #main-content {
    margin-left: 60px;
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 4px solid var(--accent);
}

    .page-header h4 {
        margin: 0;
        font-size: 17px;
        font-weight: 700;
        color: var(--primary);
    }

    .page-header .breadcrumb {
        margin: 0;
        background: none;
        padding: 0;
        font-size: 12px;
    }

/* ── Cards ───────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.card-header {
    background: var(--primary);
    color: #fff;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .card-header.accent {
        background: var(--accent);
        color: #fff;
    }

/* Stat Cards (Dashboard) */
.stat-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s;
}

    .stat-card:hover {
        transform: translateY(-2px);
    }

    .stat-card .icon {
        width: 52px;
        height: 52px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
    }

        .stat-card .icon.blue {
            background: #e8f0fe;
            color: var(--primary-light);
        }

        .stat-card .icon.green {
            background: #d4f5e9;
            color: #1a9a5c;
        }

        .stat-card .icon.orange {
            background: #fef3e2;
            color: var(--accent-dark);
        }

        .stat-card .icon.red {
            background: #fde8e8;
            color: #dc3545;
        }

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

    .stat-card .label {
        font-size: 12px;
        color: #888;
    }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrapper {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
    font-size: 13px;
}

    .table thead th {
        background: var(--primary);
        color: #fff;
        font-weight: 600;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        padding: 11px 12px;
        border: none;
        white-space: nowrap;
    }

    .table tbody tr:hover {
        background: #f0f7ff;
    }

    .table tbody td {
        padding: 9px 12px;
        vertical-align: middle;
        border-color: #e9ecef;
    }

.table-striped tbody tr:nth-child(odd) {
    background: #f8fafc;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-section {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.form-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 6px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: #444;
    margin-bottom: 4px;
}

.required-star {
    color: #dc3545;
}

.form-control, .form-select {
    border: 1px solid #d0d7df;
    border-radius: 6px;
    font-size: 13px;
    padding: 7px 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

    .form-control:focus, .form-select:focus {
        border-color: var(--primary-light);
        box-shadow: 0 0 0 3px rgba(37,99,168,0.12);
    }

/* Tabs */
.nav-tabs .nav-link {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    border-radius: 6px 6px 0 0;
    padding: 8px 18px;
}

    .nav-tabs .nav-link.active {
        color: var(--primary);
        border-bottom-color: #fff;
        background: #fff;
    }

.tab-content {
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    padding: 20px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    font-size: 13px;
    padding: 7px 16px;
    border-radius: 6px;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

    .btn-primary:hover {
        background: var(--primary);
        border-color: var(--primary);
    }

.btn-warning {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

    .btn-warning:hover {
        background: var(--accent-dark);
        border-color: var(--accent-dark);
        color: #fff;
    }

.btn-action {
    padding: 4px 10px;
    font-size: 12px;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
}

/* ── Login Page ──────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: #fff;
    border-radius: 14px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

    .login-box .logo {
        text-align: center;
        margin-bottom: 24px;
    }

        .login-box .logo .truck-icon {
            font-size: 48px;
            color: var(--accent);
        }

        .login-box .logo h3 {
            color: var(--primary);
            font-weight: 800;
            margin: 8px 0 2px;
            font-size: 20px;
        }

        .login-box .logo p {
            color: #888;
            font-size: 12px;
            margin: 0;
        }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    border-radius: var(--border-radius);
    font-size: 13px;
    border: none;
    padding: 10px 16px;
}

    .alert i {
        margin-right: 6px;
    }

/* ── Modal ───────────────────────────────────────────────── */
.modal-header {
    background: var(--primary);
    color: #fff;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-title {
    font-size: 15px;
    font-weight: 600;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* ── Mobile sidebar overlay (dark backdrop) ──────────────── */
#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1040;
}

    #sidebarOverlay.active {
        display: block;
    }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
        width: 240px !important;
    }

        #sidebar.mobile-open {
            transform: translateX(0);
            z-index: 1050;
        }

    #topbar {
        left: 0 !important;
    }

    #main-content { margin-left: 0; padding: 16px; }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
    #sidebar, #topbar, .no-print {
        display: none !important;
    }

    #main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
    }

    body {
        background: #fff !important;
    }
}

/* ── Misc ────────────────────────────────────────────────── */
.text-rupee::before {
    content: "₹";
}

.cursor-pointer {
    cursor: pointer;
}

.fs-12 {
    font-size: 12px;
}

.fs-11 {
    font-size: 11px;
}

.fw-600 {
    font-weight: 600;
}

.border-left-primary {
    border-left: 4px solid var(--primary-light);
}

.border-left-accent {
    border-left: 4px solid var(--accent);
}

.bg-primary-soft {
    background: #e8f0fe;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* ── Flatpickr Theme Overrides ──────────────────────────── */
.flatpickr-calendar {
    font-family: 'Segoe UI', Tahoma, sans-serif !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
    border: none !important;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--primary-light) !important;
    border-color: var(--primary-light) !important;
}

.flatpickr-day.today {
    border-color: var(--accent) !important;
}

    .flatpickr-day.today:hover {
        background: var(--accent) !important;
        border-color: var(--accent) !important;
    }

.flatpickr-months .flatpickr-month {
    background: var(--primary) !important;
    color: #fff !important;
    border-radius: 10px 10px 0 0 !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    color: #fff !important;
}

.flatpickr-current-month input.cur-year {
    color: #fff !important;
}

.flatpickr-weekdays {
    background: var(--primary) !important;
}

span.flatpickr-weekday {
    color: rgba(255,255,255,.8) !important;
    background: var(--primary) !important;
}

.numInputWrapper:hover {
    background: rgba(255,255,255,.1) !important;
}

/* ── Multi-Company Styles ───────────────────────────────── */
.company-badge {
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .company-badge .co-code {
        background: rgba(255,255,255,.2);
        border-radius: 4px;
        padding: 1px 5px;
        font-size: 10px;
    }

.company-selector-card {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all .2s;
}

    .company-selector-card:hover,
    .company-selector-card.selected {
        border-color: var(--primary-light);
        background: #f0f6ff;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(37,99,168,.15);
    }

/* ── Step-based Login ───────────────────────────────────── */
.step-badge {
    background: var(--primary-light);
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    margin-right: 6px;
}

/* ── Date field with Flatpickr icon ─────────────────────── */
input[type="date"],
.flatpickr-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px !important;
    cursor: pointer;
}

    input[type="date"]::-webkit-calendar-picker-indicator {
        display: none;
    }
