/* assets/css/theme.css */

:root {
    --theme-white: #FFFFFF;
    --theme-dark-yellow: #FFC107;
    /* Primary Accent */
    --theme-dark-yellow-hover: #E0A800;
    /* Darker yellow for hover/active */
    --theme-light-gray: #F8F9FA;
    /* Subtle backgrounds, page background */
    --theme-medium-gray: #DEE2E6;
    /* Borders */
    --theme-dark-gray: #343A40;
    /* Primary text color */
    --theme-text-muted: #6C757D;
    /* Muted text */
    --theme-sidebar-width: 260px;
    --theme-navbar-height: 60px;
    /* Or your preferred navbar height */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--theme-light-gray);
    color: var(--theme-dark-gray);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-size: 16px;
    /* Base font size */
}

a {
    color: var(--theme-dark-yellow);
    text-decoration: none;
}

a:hover {
    color: var(--theme-dark-yellow-hover);
    text-decoration: none;
}

/* --- Wrapper and Layout --- */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--theme-sidebar-width));
    /* Default for when sidebar is visible */
    margin-left: var(--theme-sidebar-width);
    /* Default for when sidebar is visible */
    transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out;
    background-color: var(--theme-light-gray);
    /* Background for the content area itself */
}

.wrapper:not(.wrapper-with-sidebar) .content {
    width: 100%;
    margin-left: 0;
}


.page-container {
    flex-grow: 1;
    padding: 1.5rem 2rem;
    /* More padding */
    background-color: var(--theme-white);
    margin: 1rem;
    /* Margin around the content block */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* --- Navbar (within .content) --- */
.main-header-navbar {
    /* Wrapper for the navbar */
    background-color: var(--theme-white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--theme-medium-gray);
    position: sticky;
    /* Make navbar sticky */
    top: 0;
    z-index: 1020;
    /* Lower than sidebar (1060) so sidebar overlays navbar when open */
}

.theme-navbar {
    /* The <nav> element itself */
    min-height: var(--theme-navbar-height);
    padding: 0 1.5rem !important;
    /* Consistent padding */
}

.theme-navbar .navbar-brand {
    color: var(--theme-dark-yellow) !important;
    font-weight: bold !important;
    font-size: 1.3rem !important;
}

.theme-navbar .nav-link {
    color: var(--theme-dark-gray) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 6px;
}

.theme-navbar .nav-link:hover,
.theme-navbar .nav-link.active {
    color: var(--theme-dark-yellow-hover) !important;
    background-color: var(--theme-light-gray);
}

.theme-navbar .navbar-toggler {
    border-color: rgba(0, 0, 0, 0.1) !important;
}

.theme-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(var(--theme-dark-gray-rgb), 0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* Convert dark gray hex to RGB for SVG stroke */
:root {
    --theme-dark-gray-rgb: 52, 58, 64;
}


/* --- Sidebar --- */
.theme-sidebar {
    width: var(--theme-sidebar-width);
    min-height: 100vh;
    /* Changed to min-height */
    height: 100vh;
    /* Fixed height for sticky position */
    position: fixed;
    /* Fixed Sidebar */
    top: 0;
    left: 0;
    background-color: var(--theme-white);
    border-right: 1px solid var(--theme-medium-gray);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.07);
    display: flex;
    flex-direction: column;
    z-index: 1060;
    /* Higher than navbar (1050) */
    transition: transform 0.3s ease-in-out;
}

/* Sidebar collapse transition logic */

/* Sidebar toggle button: In-flow for navbar */
.sidebar-toggle-btn {
    /* Removed fixed positioning to sit in navbar */
    position: relative;
    border: none;
    background: transparent;
    padding: 0.25rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1045;
    /* Below sidebar (1060) but visible */
}

/* Hide toggle button when sidebar is open - sidebar overlays navbar */
body.sidebar-mobile-open .sidebar-toggle-btn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.sidebar-toggle-btn .sidebar-toggle-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease;
}

.sidebar-toggle-btn .sidebar-toggle-icon--open {
    opacity: 1;
}

.sidebar-toggle-btn .sidebar-toggle-icon--close {
    opacity: 0;
    pointer-events: none;
}

.sidebar-toggle-btn.is-sidebar-open .sidebar-toggle-icon--open {
    opacity: 0;
    pointer-events: none;
}

.sidebar-toggle-btn.is-sidebar-open .sidebar-toggle-icon--close {
    opacity: 1;
    pointer-events: auto;
}

.theme-sidebar-header {
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--theme-medium-gray);
    display: flex;
    align-items: center;
    min-height: var(--theme-navbar-height);
    /* Match navbar height */
    flex-shrink: 0;
}

.theme-sidebar-header .site-name-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.theme-sidebar-header .site-icon {
    color: var(--theme-dark-yellow);
    font-size: 1.6rem;
    margin-right: 0.75rem;
}

.theme-sidebar-header .site-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--theme-dark-gray);
}

.theme-sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.theme-sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    color: var(--theme-dark-gray);
    font-weight: 500;
    border-left: 4px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-left-color 0.2s ease;
}

.theme-sidebar-nav .nav-link:hover {
    background-color: var(--theme-light-gray);
    color: var(--theme-dark-yellow-hover);
    border-left-color: var(--theme-dark-yellow-hover);
}

.theme-sidebar-nav .nav-link.active {
    background-color: #fffaf0;
    /* Very light yellow */
    color: var(--theme-dark-yellow);
    font-weight: 600;
    border-left-color: var(--theme-dark-yellow);
}

.theme-sidebar-nav .nav-link.active i {
    color: var(--theme-dark-yellow);
}

.theme-sidebar-nav .nav-link i {
    margin-right: 1rem;
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    color: var(--theme-text-muted);
    transition: color 0.2s ease;
}

.theme-sidebar-nav .nav-link:hover i,
.theme-sidebar-nav .nav-link.active i {
    color: var(--theme-dark-yellow);
}


.theme-sidebar-user-profile {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--theme-medium-gray);
    background-color: var(--theme-white);
    /* or var(--theme-light-gray) */
    flex-shrink: 0;
}

.theme-sidebar-user-profile .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--theme-dark-yellow);
    color: var(--theme-white);
    /* White or dark gray text */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
}

.theme-sidebar-user-profile .user-info .username {
    font-weight: 600;
    color: var(--theme-dark-gray);
    font-size: 0.9rem;
    line-height: 1.2;
}

.theme-sidebar-user-profile .user-info .user-role {
    font-size: 0.8rem;
    color: var(--theme-text-muted);
    line-height: 1.2;
}

.theme-sidebar-user-profile .user-info .user-role i {
    margin-right: 0.3rem;
}



/* --- Footer --- */
.theme-footer {
    background-color: var(--theme-white);
    color: var(--theme-text-muted);
    padding: 1.5rem;
    /* Padding inside footer */
    text-align: center;
    border-top: 1px solid var(--theme-medium-gray);
    margin-top: auto;
    /* Pushes footer to bottom of content flex if content is short */
}

.theme-footer .footer-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    max-width: 1140px;
    /* Match typical container width */
    margin: 0 auto;
    /* Center container */
}

.theme-footer .footer-section p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
}

.theme-footer .footer-section a {
    color: var(--theme-dark-yellow);
    font-weight: 500;
}

.theme-footer .footer-section a:hover {
    color: var(--theme-dark-yellow-hover);
}

.theme-footer .footer-bottom {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--theme-light-gray);
    font-size: 0.8rem;
}

/* --- Dashboard Specific Styles (from index.php, now themed) --- */
/* Dashboard layout containers */

.dashboard-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--theme-medium-gray);
}

.dashboard-header h1 {
    font-size: 1.85rem;
    /* Slightly smaller than bootstrap h1 */
    font-weight: 700;
    color: var(--theme-dark-gray);
    margin-bottom: 0.25rem;
}

.dashboard-header p.text-muted {
    /* For subheading */
    font-size: 1rem;
    margin-bottom: 0;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    /* Adjusted minmax */
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--theme-white);
    border: 1px solid var(--theme-medium-gray);
    border-radius: 10px;
    /* Slightly less rounded */
    padding: 1.5rem;
    transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
}

.stat-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transform: translateY(-4px);
}

.stat-card .stat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    margin-bottom: 1rem;
}

.stat-card .stat-header i {
    font-size: 1.4rem;
    color: var(--theme-dark-yellow);
}

.stat-card .stat-content {
    margin-top: auto;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--theme-dark-gray);
    margin-bottom: 0.75rem;
    display: block;
}

.section-header {
    /* For "Recent Orders" title section */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    /* border-bottom: 1px solid var(--theme-light-gray); */
    /* Optional: can be too much lining */
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--theme-dark-gray);
}

.table-container {
    background: var(--theme-white);
    border: 1px solid var(--theme-medium-gray);
    border-radius: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.04);
    -webkit-overflow-scrolling: touch;
}

.table-container .table {
    margin-bottom: 0 !important;
    min-width: 800px;
    /* Increased to ensure scroll triggers on more devices */
}

.table-container .table th,
.table-container .table td {
    white-space: nowrap;
    /* Prevent content from wrapping and shrinking columns */
}

/* Custom horizontal scrollbar styling for better visibility */
.table-container::-webkit-scrollbar {
    height: 8px;
    /* Slightly thicker for better visibility */
    display: block !important;
}

.table-container::-webkit-scrollbar-track {
    background: var(--theme-light-gray);
    border-radius: 0 0 10px 10px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--theme-medium-gray);
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--theme-dark-yellow);
}

/* Premium Scrollable Table - Guaranteed to scroll on mobile */
.premium-scrollable-table {
    width: 100% !important;
    overflow-x: scroll !important;
    /* Force scrollbar to be reserved */
    overflow-y: hidden !important;
    display: block !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    background: var(--theme-white);
    border: 1px solid var(--theme-medium-gray);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: var(--theme-dark-yellow) #f1f1f1;
    /* Firefox */
}

.premium-scrollable-table .table {
    min-width: 1000px !important;
    /* Force extreme width to trigger scroll */
    margin-bottom: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.premium-scrollable-table .table th,
.premium-scrollable-table .table td {
    white-space: nowrap !important;
    padding-bottom: 1rem !important;
    /* Extra bottom padding to clear scrollbar */
}

/* Custom horizontal scrollbar for premium feel */
.premium-scrollable-table::-webkit-scrollbar {
    height: 12px;
    /* Thicker for better mobile touch */
    display: block !important;
}

.premium-scrollable-table::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 0 0 12px 12px;
}

.premium-scrollable-table::-webkit-scrollbar-thumb {
    background: var(--theme-dark-yellow);
    border-radius: 10px;
    border: 3px solid #e9ecef;
}

.premium-scrollable-table::-webkit-scrollbar-thumb:hover {
    background: var(--theme-dark-yellow-hover);
}

.table th {
    background-color: var(--theme-light-gray) !important;
    color: var(--theme-dark-gray) !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    /* Smaller table headers */
    padding: 0.8rem 1rem !important;
    border-bottom: 2px solid var(--theme-medium-gray) !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 0.8rem 1rem !important;
    vertical-align: middle !important;
    font-size: 0.9rem !important;
    border-top: 1px solid var(--theme-medium-gray) !important;
    /* Changed to medium gray for slightly more definition */
    color: var(--theme-dark-gray);
}

.table tbody tr:hover {
    background-color: #FFF9E8;
    /* Very light yellow for row hover */
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    display: inline-block;
    /* Ensures padding is respected */
    border: 1px solid transparent;
}

.status-pending {
    background-color: #FFF3CD;
    color: #664d03;
    border-color: #FFECB5;
}

.status-confirmed,
.status-processing {
    background-color: #D1ECF1;
    color: #0a58ca;
    border-color: #B9E1E8;
}

.status-looking-for-rider,
.status-looking_for_rider {
    background-color: #E2E3E5;
    color: #41464b;
    border-color: #D3D6D8;
    border-style: dashed;
}

.status-accepted,
.status-assigned {
    background-color: #E7F1FF;
    color: #0d6efd;
    border-color: #CFE2FF;
}

.status-pick-up,
.status-pick_up,
.status-picked-up,
.status-pickedup {
    background-color: #F0F0FF;
    color: #6610f2;
    border-color: #E2D9FF;
}

.status-on-the-way,
.status-on_the_way,
.status-ontheway {
    background-color: #FFF4E5;
    color: #fd7e14;
    border-color: #FFE5D0;
}

.status-delivered,
.status-shipped {
    background-color: #D4EDDA;
    color: #146c43;
    border-color: #C1E5CB;
}

.status-completed,
.status-received {
    background-color: #EBF7EE;
    color: #198754;
    border-color: #D1E7DD;
    border-width: 2px;
}

.status-cancelled {
    background-color: #F8D7DA;
    color: #b02a37;
    border-color: #F1C2C7;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: var(--theme-white);
    /* Or var(--theme-light-gray) for subtle difference */
    border: 1px dashed var(--theme-medium-gray);
    border-radius: 10px;
    margin-top: 1.5rem;
}

.empty-state i {
    font-size: 2.8rem;
    color: var(--theme-dark-yellow);
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--theme-text-muted);
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
}

/* --- Buttons --- */
.btn {
    border-radius: 6px !important;
    /* Consistent border-radius */
    font-weight: 500 !important;
    padding: 0.5rem 1rem !important;
    /* Adjusted padding */
    font-size: 0.9rem !important;
    transition: all 0.2s ease-in-out !important;
    letter-spacing: 0.2px;
}

.btn-primary {
    background-color: var(--theme-dark-yellow) !important;
    border-color: var(--theme-dark-yellow) !important;
    color: var(--theme-dark-gray) !important;
    /* Dark gray text on yellow */
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--theme-dark-yellow-hover) !important;
    border-color: var(--theme-dark-yellow-hover) !important;
    color: var(--theme-dark-gray) !important;
    box-shadow: 0 2px 8px rgba(var(--theme-dark-yellow-rgb), 0.3) !important;
}

/* Convert dark yellow hex to RGB for SVG stroke */
:root {
    --theme-dark-yellow-rgb: 255, 193, 7;
}


.btn-sm {
    padding: 0.35rem 0.8rem !important;
    font-size: 0.8rem !important;
}

.btn-link {
    color: var(--theme-dark-yellow) !important;
    font-weight: 500 !important;
    /* Slightly less bold */
    text-decoration: none !important;
}

.btn-link:hover {
    color: var(--theme-dark-yellow-hover) !important;
    text-decoration: underline !important;
}

.btn-outline-primary {
    border-color: var(--theme-dark-yellow) !important;
    color: var(--theme-dark-yellow) !important;
}

.btn-outline-primary:hover {
    background-color: var(--theme-dark-yellow) !important;
    color: var(--theme-dark-gray) !important;
}

/* --- Dropdown Adjustments --- */
.theme-navbar .dropdown-menu {
    background-color: var(--theme-white);
    border: 1px solid var(--theme-medium-gray);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
}

.theme-navbar .dropdown-item {
    padding: 0.5rem 1rem;
    color: var(--theme-dark-gray);
    font-size: 0.9rem;
}

.theme-navbar .dropdown-item:hover,
.theme-navbar .dropdown-item:focus {
    background-color: var(--theme-light-gray);
    color: var(--theme-dark-yellow);
}

.theme-navbar .dropdown-item.bg-light {
    background-color: #fffaf0;
    /* Very light yellow for unread notifications */
}

.theme-navbar .dropdown-item .small {
    font-size: 0.8rem;
    line-height: 1.3;
}

.theme-navbar .dropdown-divider {
    margin: 0.25rem 0;
    border-color: var(--theme-medium-gray);
}

/* Ensure dropdowns are wide enough on mobile */
@media (max-width: 767.98px) {
    .theme-navbar .dropdown-menu {
        min-width: 100%;
        max-width: 100%;
        width: 100%;
    }
}


/* Responsive Adjustments */
@media (max-width: 991.98px) {

    /* Bootstrap lg breakpoint */
    .content {
        width: 100%;
        margin-left: 0;
    }

    .theme-sidebar {
        transform: translateX(calc(-1 * var(--theme-sidebar-width)));
    }

    .theme-sidebar.toggled {
        transform: translateX(0);
    }

    /* Hide navbar toggle when sidebar is open - sidebar overlays navbar */
    body.sidebar-mobile-open .sidebar-toggle-btn {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Ensure sidebar is above navbar when open */
    body.sidebar-mobile-open .theme-sidebar.toggled {
        z-index: 1060;
    }

    body.sidebar-mobile-open .main-header-navbar {
        z-index: 1020;
    }

    .main-header-navbar {
        width: 100%;
    }

    .theme-navbar {
        width: 100%;
    }

    .page-container {
        margin: 0.75rem;
        padding: 1rem 1.25rem;
        overflow-x: initial;
        max-width: 100%;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    /* Ensure navbar icons are visible */
    .theme-navbar .nav-link i {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Fix dropdown positioning on mobile */
    .theme-navbar .dropdown-menu {
        position: absolute !important;
        transform: none !important;
        margin-top: 0.25rem;
        border-top: 1px solid var(--theme-medium-gray);
    }
}

/* Extra small devices */
@media (max-width: 575.98px) {
    .theme-navbar {
        padding: 0 0.5rem !important;
    }

    .page-container {
        margin: 0.5rem;
        padding: 0.75rem 1rem;
    }

    .theme-navbar .navbar-brand {
        font-size: 1rem !important;
    }

    .theme-navbar .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem !important;
    }
}