/* ===================================================================
   SHANTI LOGISTICS – Admin Theme
   Transport / Logistics professional dark-sidebar admin template
   =================================================================== */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #2563eb;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --topbar-height: 60px;
    --topbar-bg: #ffffff;
    --topbar-shadow: 0 2px 8px rgba(0,0,0,.08);
    --body-bg: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,.08);
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
    --transition: .25s ease;
}

/* ── GLOBAL ─────────────────────────────────────────────────────── */
html, body { height: 100%; }
body {
    background: var(--body-bg);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
}

a { text-decoration: none; }

/* ── SIDEBAR ────────────────────────────────────────────────────── */
.admin-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
    overflow: hidden;
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    font-size: 28px;
    color: var(--primary);
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition);
}

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

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(148,163,184,.5);
    padding: 16px 20px 6px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    gap: 14px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 0;
    transition: all .15s ease;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.sidebar-link i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.sidebar-link.active {
    color: var(--sidebar-text-active);
    background: rgba(37,99,235,.15);
    border-left-color: var(--sidebar-active);
}

.sidebar-link.active i { color: var(--sidebar-active); }

.sidebar-link-text {
    overflow: hidden;
    transition: opacity var(--transition);
}

/* Sidebar footer */
.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.sidebar-footer small {
    color: rgba(148,163,184,.4);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
}

/* ── SIDEBAR COLLAPSED STATE ─────────────────────────────────── */
body.sidebar-collapsed .admin-sidebar {
    width: var(--sidebar-collapsed-width);
}
body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-link-text,
body.sidebar-collapsed .nav-section-title,
body.sidebar-collapsed .sidebar-footer small {
    opacity: 0;
    width: 0;
}
body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    border-left-width: 0;
}
body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 0;
}

/* ── TOPBAR ─────────────────────────────────────────────────── */
.admin-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    box-shadow: var(--topbar-shadow);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 24px;
    transition: left var(--transition);
}

body.sidebar-collapsed .admin-topbar {
    left: var(--sidebar-collapsed-width);
}

.topbar-toggle {
    background: none;
    border: none;
    font-size: 22px;
    color: #475569;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background .15s;
}
.topbar-toggle:hover { background: #f1f5f9; }

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

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background .15s;
}
.topbar-user:hover { background: #f1f5f9; }

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

.topbar-user-info {
    line-height: 1.3;
}
.topbar-user-name {
    font-weight: 600;
    font-size: 13.5px;
    color: #1e293b;
}
.topbar-user-role {
    font-size: 11px;
    color: #94a3b8;
}

/* ── CONTENT WRAPPER ────────────────────────────────────────── */
.admin-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 24px;
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left var(--transition);
}

body.sidebar-collapsed .admin-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* ── BREADCRUMB BAR ─────────────────────────────────────────── */
.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 13px;
}

.breadcrumb-item a {
    color: var(--primary);
}

.breadcrumb-item.active {
    color: #64748b;
}

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: var(--card-shadow);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.stat-card.border-success { border-left-color: var(--success); }
.stat-card.border-warning { border-left-color: var(--warning); }
.stat-card.border-info    { border-left-color: var(--info); }
.stat-card.border-danger  { border-left-color: var(--danger); }

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

.stat-icon.bg-primary { background: rgba(37,99,235,.1); color: var(--primary); }
.stat-icon.bg-success { background: rgba(5,150,105,.1);  color: var(--success); }
.stat-icon.bg-warning { background: rgba(217,119,6,.1);  color: var(--warning); }
.stat-icon.bg-info    { background: rgba(8,145,178,.1);  color: var(--info); }
.stat-icon.bg-danger  { background: rgba(220,38,38,.1);  color: var(--danger); }

.stat-info { flex: 1; }
.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #64748b;
    margin-bottom: 4px;
}
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 15px;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: 20px; }

/* ── TABLES ─────────────────────────────────────────────────── */
.table {
    margin-bottom: 0;
    font-size: 13.5px;
}

.table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 2px solid #e2e8f0;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.table-hover tbody tr:hover {
    background: #f8fafc;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: #fafbfc;
}

/* ── ACTION BUTTONS (inside tables) ──────────────────────────── */
.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    border: none;
    transition: all .15s;
}

.btn-action-view { background: rgba(8,145,178,.1); color: var(--info); }
.btn-action-view:hover { background: var(--info); color: #fff; }

.btn-action-edit { background: rgba(217,119,6,.1); color: var(--warning); }
.btn-action-edit:hover { background: var(--warning); color: #fff; }

.btn-action-delete { background: rgba(220,38,38,.1); color: var(--danger); }
.btn-action-delete:hover { background: var(--danger); color: #fff; }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge-status {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
}

/* ── FORMS ──────────────────────────────────────────────────── */
.form-label {
    font-weight: 600;
    font-size: 12.5px;
    color: #475569;
    margin-bottom: 4px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    padding: 8px 14px;
    font-size: 13.5px;
    transition: border-color .15s, box-shadow .15s;
}

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

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 600; font-size: 13.5px; padding: 8px 20px; }

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

.btn-success { background: var(--success); border-color: var(--success); }
.btn-danger  { background: var(--danger); border-color: var(--danger); }

/* ── PAGINATION ─────────────────────────────────────────────── */
.pagination {
    gap: 4px;
    margin-top: 16px;
    justify-content: center;
}

.page-link {
    border-radius: 8px !important;
    border: 1.5px solid #e2e8f0;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.page-link:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--primary);
}

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 13.5px;
    padding: 14px 20px;
}

.alert-success { background: rgba(5,150,105,.08); color: #065f46; }
.alert-danger  { background: rgba(220,38,38,.08); color: #991b1b; }

/* ── LOGIN PAGE ─────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 200%;
    background: radial-gradient(circle, rgba(37,99,235,.12) 0%, transparent 70%);
    pointer-events: none;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    position: relative;
    z-index: 1;
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand-icon {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-brand h2 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.login-brand p {
    font-size: 13px;
    color: #64748b;
    margin: 4px 0 0;
}

.login-input-group {
    position: relative;
    margin-bottom: 20px;
}

.login-input-group i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 16px;
    z-index: 2;
}

.login-input-group input {
    padding-left: 42px;
    height: 46px;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    font-size: 14px;
}

.login-input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.login-btn {
    width: 100%;
    height: 46px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    background: var(--primary);
    border: none;
    color: #fff;
    transition: background .2s;
}
.login-btn:hover { background: var(--primary-dark); color: #fff; }

/* ── MOBILE OVERLAY ──────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1035;
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    body.sidebar-open .admin-sidebar {
        transform: translateX(0);
    }
    body.sidebar-open .sidebar-overlay {
        display: block;
    }
    .admin-topbar {
        left: 0 !important;
    }
    .admin-content {
        margin-left: 0 !important;
    }
}

@media (max-width: 575.98px) {
    .admin-content { padding: 16px; }
    .page-title { font-size: 18px; }
    .stat-card { padding: 14px 16px; }
    .stat-value { font-size: 20px; }
}

/* ── THEME TOGGLE BUTTON ─────────────────────────────────────── */
.theme-toggle-btn {
    background: none;
    border: 1.5px solid #e2e8f0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #475569;
    cursor: pointer;
    transition: all .2s;
    flex-shrink: 0;
}
.theme-toggle-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--primary);
}

/* Icon swap: light mode shows moon, dark mode shows sun */
.theme-toggle-btn .bi-moon-stars-fill { display: inline; }
.theme-toggle-btn .bi-sun-fill        { display: none; }

/* ── DARK THEME ──────────────────────────────────────────────── */
body.dark-theme {
    --topbar-bg: #1e293b;
    --topbar-shadow: 0 2px 8px rgba(0,0,0,.3);
    --body-bg: #0f172a;
    --card-shadow: 0 1px 4px rgba(0,0,0,.25);
    --sidebar-bg: #0b1120;
    --sidebar-hover: #162032;
}

body.dark-theme .theme-toggle-btn .bi-moon-stars-fill { display: none; }
body.dark-theme .theme-toggle-btn .bi-sun-fill        { display: inline; }

body.dark-theme .theme-toggle-btn {
    border-color: #334155;
    color: #f59e0b;
}
body.dark-theme .theme-toggle-btn:hover {
    background: #334155;
    border-color: #475569;
}

/* Topbar */
body.dark-theme .admin-topbar { background: var(--topbar-bg); }
body.dark-theme .topbar-toggle { color: #cbd5e1; }
body.dark-theme .topbar-toggle:hover { background: #334155; }
body.dark-theme .topbar-user:hover { background: #334155; }
body.dark-theme .topbar-user-name { color: #f1f5f9; }
body.dark-theme .topbar-user-role { color: #64748b; }

/* Dropdown */
body.dark-theme .dropdown-menu {
    background: #1e293b;
    border-color: #334155;
}
body.dark-theme .dropdown-item { color: #cbd5e1; }
body.dark-theme .dropdown-item:hover { background: #334155; color: #fff; }
body.dark-theme .dropdown-divider { border-color: #334155; }

/* Content area */
body.dark-theme .admin-content { background: var(--body-bg); }

/* Page title / breadcrumb */
body.dark-theme .page-title { color: #f1f5f9; }
body.dark-theme .breadcrumb-item.active { color: #94a3b8; }

/* Cards */
body.dark-theme .card {
    background: #1e293b;
    box-shadow: var(--card-shadow);
}
body.dark-theme .card-header {
    background: #1e293b;
    border-bottom-color: #334155;
    color: #f1f5f9;
}
body.dark-theme .card-body { color: #cbd5e1; }
body.dark-theme .card-footer { background: #1e293b; border-top-color: #334155; }

/* Stat cards */
body.dark-theme .stat-card {
    background: #1e293b;
}
body.dark-theme .stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
body.dark-theme .stat-label { color: #94a3b8; }
body.dark-theme .stat-value { color: #f1f5f9; }

body.dark-theme .stat-icon.bg-primary { background: rgba(37,99,235,.2); }
body.dark-theme .stat-icon.bg-success { background: rgba(5,150,105,.2); }
body.dark-theme .stat-icon.bg-warning { background: rgba(217,119,6,.2); }
body.dark-theme .stat-icon.bg-info    { background: rgba(8,145,178,.2); }

/* Tables */
body.dark-theme .table { color: #cbd5e1; }
body.dark-theme .table thead th {
    background: #162032;
    color: #94a3b8;
    border-bottom-color: #334155;
}
body.dark-theme .table tbody td {
    color: #cbd5e1;
    border-bottom-color: #1e293b;
}
body.dark-theme .table-hover tbody tr:hover { background: #162032; }
body.dark-theme .table-striped > tbody > tr:nth-of-type(odd) > td { background-color: #162032; }

/* Action buttons dark mode */
body.dark-theme .btn-action-view { background: rgba(8,145,178,.2); }
body.dark-theme .btn-action-edit { background: rgba(217,119,6,.2); }
body.dark-theme .btn-action-delete { background: rgba(220,38,38,.2); }

/* Badges */
body.dark-theme .badge.bg-light {
    background: #334155 !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}

/* Forms */
body.dark-theme .form-label { color: #94a3b8; }
body.dark-theme .form-control,
body.dark-theme .form-select {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}
body.dark-theme .form-control:focus,
body.dark-theme .form-select:focus {
    background: #0f172a;
    border-color: var(--primary);
    color: #f1f5f9;
}
body.dark-theme .form-control::placeholder { color: #64748b; }
body.dark-theme .form-control:read-only,
body.dark-theme .form-control[readonly] {
    background: #162032;
    color: #94a3b8;
}
body.dark-theme .input-group-text {
    background: #162032;
    border-color: #334155;
    color: #94a3b8;
}

/* Buttons */
body.dark-theme .btn-light {
    background: #334155;
    border-color: #475569;
    color: #e2e8f0;
}
body.dark-theme .btn-light:hover {
    background: #475569;
    color: #fff;
}
body.dark-theme .btn-outline-secondary {
    border-color: #475569;
    color: #94a3b8;
}
body.dark-theme .btn-outline-secondary:hover {
    background: #334155;
    color: #f1f5f9;
}
body.dark-theme .btn-outline-primary {
    border-color: var(--primary);
    color: #60a5fa;
}

/* Pagination */
body.dark-theme .page-link {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}
body.dark-theme .page-link:hover {
    background: #334155;
    border-color: #475569;
    color: #fff;
}

/* Alerts */
body.dark-theme .alert-success { background: rgba(5,150,105,.15); color: #6ee7b7; }
body.dark-theme .alert-danger  { background: rgba(220,38,38,.15); color: #fca5a5; }

/* Progress bar (password strength) */
body.dark-theme .progress {
    background: #334155;
}

/* Text helpers */
body.dark-theme .text-muted { color: #64748b !important; }
body.dark-theme .text-dark  { color: #f1f5f9 !important; }
body.dark-theme hr { border-color: #334155; }

/* Chart canvas background */
body.dark-theme canvas { filter: none; }

/* Consignment live calc gradient */
body.dark-theme .card[style*="linear-gradient"] {
    background: linear-gradient(135deg, #162032, #1a2332) !important;
}
body.dark-theme .card[style*="linear-gradient"] .shadow-sm {
    background: #1e293b !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.3) !important;
}
body.dark-theme .card[style*="border:2px solid var(--primary)"] {
    border-color: var(--primary) !important;
}

