/* ApusFleet - Modern Admin Panel Styles */
/* Inspired by Odoo ERP Design with Modern Gradients */

:root {
    --primary: #714B67;
    --primary-dark: #5a3c52;
    --primary-light: #8a6180;
    --primary-gradient: linear-gradient(135deg, #714B67 0%, #8a6180 100%);
    --primary-gradient-hover: linear-gradient(135deg, #5a3c52 0%, #714B67 100%);

    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --secondary: #64748b;

    --bg-dark: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.8);

    --text-dark: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 40px rgba(113, 75, 103, 0.15);

    --header-height: 64px;
    --sidebar-width: 260px;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Header */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg-light);
    color: var(--primary);
    transform: scale(1.05);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(113, 75, 103, 0.3));
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    transition: var(--transition);
}

.header-icon-btn:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.header-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.dropdown-toggle:hover {
    background: var(--bg-light);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

.user-name {
    font-weight: 500;
    color: var(--text-dark);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 8px;
    display: none;
    z-index: 1001;
    border: 1px solid var(--border-light);
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-dark);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.dropdown-item.text-danger {
    color: var(--danger);
}

.dropdown-item.text-danger:hover {
    background: var(--danger-light);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 8px 0;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-sidebar) 100%);
    overflow-y: auto;
    transition: var(--transition-slow);
    z-index: 999;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-nav ul {
    list-style: none;
    padding: 20px 12px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    margin-bottom: 4px;
}

.sidebar-nav li a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: translateX(4px);
}

.sidebar-nav li.active a {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(113, 75, 103, 0.4);
}

.sidebar-nav .nav-divider {
    padding: 24px 16px 10px;
}

.sidebar-nav .nav-divider span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-light);
    opacity: 0.5;
    font-weight: 600;
}

.sidebar-nav .nav-badge {
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* Main Content */
.main-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: var(--header-height);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    transition: var(--transition-slow);
}

.sidebar.collapsed + .main-content {
    margin-left: 0;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--text-dark) 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    color: var(--text-muted);
    font-size: 15px;
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
    transition: var(--transition);
    /* overflow: hidden; */
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-white) 100%);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.card-body {
    padding: 24px;
}

.card-danger {
    border-color: var(--danger-light);
}

.card-danger .card-header {
    background: linear-gradient(135deg, var(--danger-light) 0%, #fff5f5 100%);
    color: var(--danger);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.stat-icon.bg-primary {
    background: var(--primary-gradient);
    box-shadow: 0 4px 14px rgba(113, 75, 103, 0.4);
}
.stat-icon.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}
.stat-icon.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}
.stat-icon.bg-info {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}
.stat-icon.bg-danger {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.stat-info p {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--bg-light) 0%, #f1f5f9 100%);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: linear-gradient(135deg, #faf5ff 0%, #f8fafc 100%);
}

.driver-info {
    display: flex;
    flex-direction: column;
}

.driver-info strong {
    font-weight: 600;
    color: var(--text-dark);
}

.driver-info small {
    color: var(--text-muted);
    font-size: 12px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(113, 75, 103, 0.1);
}

.form-control:disabled {
    background: var(--bg-light);
    cursor: not-allowed;
    opacity: 0.7;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(113, 75, 103, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(113, 75, 103, 0.4);
    color: white;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-dark);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    animation: alertSlideIn 0.3s ease;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: linear-gradient(135deg, var(--success-light) 0%, #ecfdf5 100%);
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: linear-gradient(135deg, var(--danger-light) 0%, #fef2f2 100%);
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: linear-gradient(135deg, var(--warning-light) 0%, #fffbeb 100%);
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: linear-gradient(135deg, var(--info-light) 0%, #eff6ff 100%);
    color: #1e40af;
    border-left: 4px solid var(--info);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.status-online {
    background: linear-gradient(135deg, var(--success-light) 0%, #d1fae5 100%);
    color: #065f46;
}

.status-idle {
    background: linear-gradient(135deg, var(--warning-light) 0%, #fef3c7 100%);
    color: #92400e;
}

.status-offline {
    background: linear-gradient(135deg, var(--danger-light) 0%, #fee2e2 100%);
    color: #991b1b;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.badge-success {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: white;
}

.badge-secondary {
    background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
    color: white;
}

/* Filters */
.filters {
    margin-bottom: 0;
}

.filter-tabs {
    display: flex;
    gap: 8px;
}

.filter-tab {
    padding: 10px 20px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid transparent;
}

.filter-tab:hover {
    background: var(--bg-light);
    color: var(--text-dark);
    border-color: var(--border-color);
}

.filter-tab.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(113, 75, 103, 0.3);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state svg {
    color: var(--text-light);
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 15px;
}

/* Info List */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.info-value {
    font-weight: 600;
    color: var(--text-dark);
}

.token-code {
    background: linear-gradient(135deg, var(--bg-light) 0%, #f1f5f9 100%);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 11px;
    word-break: break-all;
    border: 1px solid var(--border-color);
}

/* Page background decoration */
body::before {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    width: 50%;
    height: 50%;
    background: radial-gradient(ellipse at top right, rgba(113, 75, 103, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Responsive */
@media (max-width: 1024px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        gap: 16px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
    }

    .stat-info h3 {
        font-size: 22px;
    }

    .user-name {
        display: none;
    }

    .top-header {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-actions .btn {
        width: 100%;
    }

    .filter-tabs {
        flex-wrap: wrap;
    }
}

/* Small Stats Grid (for driver edit page) */
.stats-grid-small {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-item-small {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: var(--radius);
}

.stat-item-small .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-item-small .stat-content {
    display: flex;
    flex-direction: column;
}

.stat-item-small .stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-item-small .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Stats Table for History */
.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th,
.stats-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.stats-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
}

.stats-table tbody tr:hover {
    background: var(--bg-light);
}

.stats-table .stat-highlight {
    font-weight: 600;
    color: var(--primary);
}

@media (max-width: 768px) {
    .stats-grid-small {
        grid-template-columns: 1fr;
    }
}

/* Login Page Override - keep original for login */
.login-page {
    background: transparent;
}

.login-page::before {
    display: none;
}
