/* ============================================================
   TRUCKFLOW — ADMIN DASHBOARD (Royal Seat Soft-Elevation Style)
   assets/css/dashboards.css
   Yellow + White / Dark Mode | Clean, Modern, Premium
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-surface);
    color: var(--text-main);
    min-height: 100vh;
}

/* ── Layout Shell ─────────────────────────────────── */
.layout {
    display: flex;
    min-height: 100vh;
    gap: 0;
}

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    gap: 0.25rem;
    border-right: 1px solid var(--border-color);
    min-height: 100vh;
    position: sticky;
    top: 0;
}

/* hide the nav scrollbar chrome — the list still scrolls */
.sidebar nav {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sidebar nav::-webkit-scrollbar { display: none; width: 0; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    color: #1a1d20;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 0, 85, 0.35);
}

.sidebar-section {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.75rem 0.75rem 0.25rem;
    margin-top: 0.5rem;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar a:hover {
    background: var(--bg-surface);
    color: var(--text-main);
}

.sidebar a.active {
    background: rgba(255, 0, 85, 0.12);
    color: var(--text-main);
    font-weight: 700;
}

.sidebar a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--color-primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.sidebar a.active .sidebar-icon,
.sidebar a:hover .sidebar-icon {
    opacity: 1;
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 20px;
    background: var(--color-primary);
    color: #1a1d20;
    line-height: 1.4;
}

.sidebar-spacer { flex: 1; }

.sidebar-logout {
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

/* ── Main Content Area ────────────────────────────── */
.layout main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
}

/* ── Topbar ───────────────────────────────────────── */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 1rem;
}

.topbar h1 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(255, 0, 85, 0.12);
    color: var(--text-main);
    gap: 0.35rem;
}

.topbar-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-primary);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #1a1d20;
    font-weight: 800;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Theme toggle button */
.topbar-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.topbar-icon-btn:hover {
    color: var(--text-main);
    border-color: var(--color-primary);
}

/* ── Page Content Wrapper ─────────────────────────── */
.page-content {
    padding: 2rem;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
}

/* ── Stats Grid ───────────────────────────────────── */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* ── Cards ────────────────────────────────────────── */
.card {
    background: var(--bg-color);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
    transform: translateY(-1px);
}

.card.stat h3 {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card.stat p, .card.stat .stat-value {
    margin: 0;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

/* Stat card accent strip */
.card.stat {
    position: relative;
    overflow: hidden;
}

.card.stat::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--color-primary);
    opacity: 0.7;
    border-radius: 16px 16px 0 0;
}

/* ── Tables ───────────────────────────────────────── */
.table-wrapper {
    background: var(--bg-color);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
}

.table-wrapper th,
.table-wrapper td,
table th,
table td {
    padding: 0.9rem 1.25rem;
    text-align: left;
    font-size: 0.9rem;
}

.table-wrapper th, table th {
    background: var(--bg-surface);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-color);
}

.table-wrapper td, table td {
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-main);
}

.table-wrapper tr:last-child td,
table tr:last-child td {
    border-bottom: none;
}

.table-wrapper tr:hover td,
table tr:hover td {
    background: var(--bg-surface);
}

/* ── Buttons ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
}

.btn-primary, .btn-yellow {
    background: var(--color-primary);
    color: #1a1d20;
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(255, 0, 85, 0.25);
}

.btn-primary:hover, .btn-yellow:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255, 0, 85, 0.35);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-surface);
    color: var(--text-main);
    border-color: var(--text-muted);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ── Badges / Status Pills ────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-active, .badge-completed, .badge-approved {
    color: #059669;
    background: rgba(16, 185, 129, 0.12);
}

.badge-pending {
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
}

.badge-banned, .badge-rejected {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.12);
}

.badge-matured, .badge-paid {
    color: #7c3aed;
    background: rgba(139, 92, 246, 0.12);
}

/* ── Forms inside Dashboard ───────────────────────── */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 0, 85, 0.15);
}

/* Search form row */
form[method="get"] {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

form[method="get"] input {
    padding: 0.65rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    flex: 1;
    min-width: 200px;
    transition: border-color 0.2s ease;
}

form[method="get"] input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* ── Flash Alerts ─────────────────────────────────── */
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 900px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0.25rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-brand {
        padding: 0.25rem 0.5rem 0.25rem;
        border-bottom: none;
        margin-bottom: 0;
        margin-right: auto;
    }

    .sidebar-section { display: none; }
    .sidebar-spacer { display: none; }

    .sidebar a {
        padding: 0.5rem 0.75rem;
        font-size: 0.82rem;
    }

    .sidebar a.active::before { display: none; }

    .page-content {
        padding: 1.25rem;
    }

    .topbar {
        padding: 1rem 1.25rem;
    }

    .grid-stats {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 1rem;
    }
}
