/* =====================================================
   admin/assets/admin.css - Admin Panel Main Styles
   ===================================================== */

:root {
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --danger-color: #f56565;
    --info-color: #4299e1;
}

* {
    font-family: 'Sarabun', sans-serif;
}

body {
    background-color: #f7fafc;
}

/* =====================================================
   SIDEBAR STYLES
   ===================================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: white;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease;
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    position: relative;
}

.sidebar-header h4 {
    margin: 0;
    font-weight: 700;
    font-size: 22px;
    transition: opacity 0.3s ease;
}

.sidebar-header p {
    margin: 5px 0 0 0;
    opacity: 0.9;
    font-size: 14px;
    transition: opacity 0.3s ease;
}

/* Toggle Button for Desktop */
.sidebar-toggle-desktop {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-toggle-desktop:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Hide title and subtitle when collapsed */
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-subtitle {
    opacity: 0;
    visibility: hidden;
}

.sidebar.collapsed .sidebar-toggle-desktop {
    right: 50%;
    transform: translate(50%, -50%);
}

.sidebar-menu {
    padding: 20px 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: #4a5568;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-size: 16px;
    position: relative;
    white-space: nowrap;
}

.sidebar-item:hover {
    background: #f7fafc;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-item.active {
    background: #edf2f7;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-item i {
    width: 20px;
    margin-right: 10px;
    font-size: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-text {
    transition: opacity 0.3s ease;
}

/* Collapsed sidebar adjustments */
.sidebar.collapsed .sidebar-item {
    padding: 15px 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-item i {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-text {
    display: none;
}

.sidebar.collapsed .badge {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 10px;
    padding: 2px 5px;
}

/* Sidebar divider */
.sidebar-divider {
    margin: 15px 25px !important;
    border-color: #e2e8f0;
    transition: margin 0.3s ease;
}

.sidebar.collapsed .sidebar-divider {
    margin: 15px 10px !important;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .sidebar-item {
    position: relative;
}

.sidebar.collapsed .sidebar-item:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #2d3748;
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 14px;
    margin-left: 10px;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.sidebar.collapsed .sidebar-item:hover::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #2d3748;
    margin-left: 0;
}

/* =====================================================
   MAIN CONTENT & HEADER
   ===================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

.header {
    height: var(--header-height);
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.content {
    padding: 30px;
}

/* =====================================================
   STATS CARDS
   ===================================================== */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.stat-card .icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
}

.stat-card.primary .icon {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

.stat-card.success .icon {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success-color);
}

.stat-card.warning .icon {
    background: rgba(237, 137, 54, 0.1);
    color: var(--warning-color);
}

.stat-card.danger .icon {
    background: rgba(245, 101, 101, 0.1);
    color: var(--danger-color);
}

.stat-card h3 {
    font-size: 32px;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    line-height: 1;
}

.stat-card p {
    color: #718096;
    margin: 5px 0 0 0;
    font-size: 14px;
}

.stat-card .badge {
    margin-top: 10px;
    font-size: 12px;
    padding: 5px 10px;
    font-weight: 600;
}

/* =====================================================
   TABLES
   ===================================================== */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.table-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h5 {
    margin: 0;
    font-weight: 700;
    color: #2d3748;
}

/* =====================================================
   CARDS & FORMS
   ===================================================== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: none;
    margin-bottom: 30px;
}

.card-header {
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    font-weight: 700;
    color: #2d3748;
}

.filter-section {
    background: #f7fafc;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.filter-section .form-label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
}

/* =====================================================
   TABS
   ===================================================== */
.nav-tabs {
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 30px;
}

.nav-tabs .nav-link {
    color: #718096;
    border: none;
    padding: 12px 24px;
    font-weight: 600;
    transition: all 0.3s;
    margin-bottom: -2px;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background: none;
    border: none;
    border-bottom: 2px solid var(--primary-color);
}

.nav-tabs .nav-link i {
    margin-right: 8px;
}

/* =====================================================
   DRIVER SPECIFIC
   ===================================================== */
.driver-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 16px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.status-dot.online {
    background: #48bb78;
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background: #cbd5e0;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* =====================================================
   EXPENSES SPECIFIC
   ===================================================== */
.expense-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
}

.expense-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.expense-amount {
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
}

.receipt-preview {
    max-width: 100px;
    max-height: 100px;
    cursor: pointer;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.receipt-preview:hover {
    border-color: var(--primary-color);
}

/* =====================================================
   TASKS SPECIFIC
   ===================================================== */
.task-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2196F3;
    transition: all 0.3s;
    cursor: pointer;
}

.task-card:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.task-card.priority-low {
    border-left-color: #4CAF50;
}

.task-card.priority-normal {
    border-left-color: #2196F3;
}

.task-card.priority-high {
    border-left-color: #FF9800;
}

.task-card.priority-urgent {
    border-left-color: #F44336;
}

/* =====================================================
   ROUTES SPECIFIC  
   ===================================================== */
#routeMap {
    height: 500px;
    width: 100%;
    border-radius: 8px;
}

/* Map Container */
.map-container {
    position: relative;
    height: 500px;
    overflow: hidden;
}

#map {
    height: 440px !important;
    width: 100%;
    border-radius: 8px;
}

.map-legend {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    font-size: 14px;
}

.map-legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.map-legend-item:last-child {
    margin-bottom: 0;
}

.map-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Driver List Styles */
.driver-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.driver-list-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f7fafc;
}

.driver-list-header h5 {
    margin: 0;
    font-weight: 700;
    color: #2d3748;
}

/* Custom Scrollbar for driver list */
.driver-list-body::-webkit-scrollbar {
    width: 6px;
}

.driver-list-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.driver-list-body::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.driver-list-body::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Driver Item */
.driver-item {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background 0.2s;
}

.driver-item:hover {
    background: #f7fafc;
}

.driver-item:last-child {
    border-bottom: none;
}

.driver-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.driver-details {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.driver-avatar {
    flex-shrink: 0;
}

.driver-name {
    font-weight: 600;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.driver-vehicle {
    font-size: 12px;
    color: #718096;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.driver-status {
    flex-shrink: 0;
    text-align: right;
    max-width: 200px;
}

.driver-location {
    font-size: 13px;
    color: #4a5568;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.driver-time {
    font-size: 12px;
    color: #a0aec0;
}

/* =====================================================
   ACTIVITY FEED
   ===================================================== */
.activity-feed {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.activity-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-header h5 {
    margin: 0;
    font-weight: 700;
    color: #2d3748;
}

.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 15px;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.checkin {
    background: rgba(72, 187, 120, 0.1);
    color: #48bb78;
}

.activity-icon.expense {
    background: rgba(237, 137, 54, 0.1);
    color: #ed8936;
}

.activity-details {
    flex: 1;
}

.activity-text {
    font-size: 14px;
    color: #2d3748;
    margin-bottom: 2px;
}

.activity-text strong {
    font-weight: 600;
}

.activity-time {
    font-size: 12px;
    color: #a0aec0;
}

/* =====================================================
   UTILITIES
   ===================================================== */
.btn-action {
    padding: 4px 12px;
    font-size: 14px;
    border-radius: 6px;
    margin: 0 2px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h5 {
    color: #718096;
    margin-bottom: 10px;
}

.empty-state p {
    color: #a0aec0;
    margin-bottom: 20px;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.quick-action-btn {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: #4a5568;
    transition: all 0.3s;
    font-weight: 600;
}

.quick-action-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.quick-action-btn i {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
}

/* =====================================================
   MODALS
   ===================================================== */
.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

/* =====================================================
   MOBILE RESPONSIVE
   ===================================================== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #4a5568;
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.show {
    display: block;
}

@media (max-width: 768px) {
    /* Hide desktop toggle on mobile */
    .sidebar-toggle-desktop {
        display: none !important;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.expanded {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .content {
        padding: 20px;
    }
    
    .header {
        padding: 0 20px;
    }
    
    .header-title {
        font-size: 20px;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 14px;
    }
    
    .nav-tabs .nav-link {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .nav-tabs .nav-link span {
        display: none;
    }
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-overlay.show {
    display: flex;
}

/* =====================================================
   CUSTOM SCROLLBAR
   ===================================================== */
.activity-list::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.activity-list::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.activity-list::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.activity-list::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* =====================================================
   PRINT STYLES
   ===================================================== */
@media print {
    .sidebar,
    .header,
    .btn,
    .mobile-menu-toggle,
    .quick-actions {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .content {
        padding: 20px !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}