/* =====================================================
   DriveOn Admin Dashboard - Premium Apple-Inspired Design
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0071E3;
    --primary-hover: #0077ED;
    --primary-light: rgba(0, 113, 227, 0.1);
    --green: #34C759;
    --green-light: rgba(52, 199, 89, 0.12);
    --yellow: #FF9F0A;
    --yellow-light: rgba(255, 159, 10, 0.12);
    --red: #FF3B30;
    --red-light: rgba(255, 59, 48, 0.12);
    --bg-primary: #F5F5F7;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #FAFAFA;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --text-tertiary: #AEAEB2;
    --border: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --blur-bg: saturate(180%) blur(20px);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: var(--blur-bg);
    -webkit-backdrop-filter: var(--blur-bg);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-header { padding: 24px 20px; border-bottom: 1px solid var(--border); }

.sidebar-logo { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.sidebar-logo span {
    background: linear-gradient(135deg, var(--green) 0%, #30D158 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav { padding: 16px 12px; flex: 1; display: flex; flex-direction: column; }

.nav-section { margin-bottom: 24px; }
.nav-section:last-child { margin-top: auto; margin-bottom: 0; padding-top: 16px; border-top: 1px solid var(--border); }

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.nav-link:hover { background: var(--border); color: var(--text-primary); text-decoration: none; }
.nav-link.active { background: var(--primary-light); color: var(--primary); }
.nav-link svg { width: 20px; height: 20px; opacity: 0.7; }
.nav-link.active svg { opacity: 1; }

/* Main Content */
.main-content { flex: 1; margin-left: 260px; min-height: 100vh; }

/* Header */
.header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: var(--blur-bg);
    -webkit-backdrop-filter: var(--blur-bg);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 6px 6px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

.user-info { text-align: right; }
.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #5AC8FA 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.content { padding: 32px; max-width: 1600px; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 24px;
    border: 1px solid var(--border);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, #5AC8FA 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card:hover::before { opacity: 1; }

.stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
}

.stat-icon svg { width: 22px; height: 22px; color: var(--text-secondary); }

.stat-value { font-size: 36px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* Pulse Overview */
.pulse-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }

.pulse-stat {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 24px;
    text-align: center;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.pulse-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.pulse-stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.pulse-stat.green::before { background: var(--green); }
.pulse-stat.yellow::before { background: var(--yellow); }
.pulse-stat.red::before { background: var(--red); }
.pulse-stat.pending::before { background: var(--text-tertiary); }

.pulse-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.pulse-stat.green .pulse-stat-icon { background: var(--green-light); }
.pulse-stat.yellow .pulse-stat-icon { background: var(--yellow-light); }
.pulse-stat.red .pulse-stat-icon { background: var(--red-light); }
.pulse-stat.pending .pulse-stat-icon { background: var(--bg-tertiary); }

.pulse-stat-icon svg { width: 24px; height: 24px; }
.pulse-stat.green .pulse-stat-icon svg { color: var(--green); }
.pulse-stat.yellow .pulse-stat-icon svg { color: var(--yellow); }
.pulse-stat.red .pulse-stat-icon svg { color: var(--red); }
.pulse-stat.pending .pulse-stat-icon svg { color: var(--text-tertiary); }

.pulse-stat-value { font-size: 42px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin-bottom: 4px; }
.pulse-stat.green .pulse-stat-value { color: var(--green); }
.pulse-stat.yellow .pulse-stat-value { color: var(--yellow); }
.pulse-stat.red .pulse-stat-value { color: var(--red); }
.pulse-stat.pending .pulse-stat-value { color: var(--text-tertiary); }

.pulse-stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; margin-bottom: 8px; }
.pulse-stat-percent { font-size: 12px; color: var(--text-tertiary); font-weight: 600; }

/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title { font-size: 17px; font-weight: 600; }
.card-body { padding: 24px; }

/* Charts */
.chart-container { position: relative; height: 280px; width: 100%; }

.chart-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.chart-center-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.chart-center-label { font-size: 12px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }

th {
    padding: 12px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

td { padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 14px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-tertiary); }

.table-vehicle-name { font-weight: 600; }
.table-vehicle-plate { font-size: 12px; color: var(--text-tertiary); font-family: monospace; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }

.badge-green { background: var(--green-light); color: var(--green); }
.badge-green::before { background: var(--green); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }
.badge-yellow::before { background: var(--yellow); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-red::before { background: var(--red); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-blue::before { background: var(--primary); }
.badge-gray { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-gray::before { background: var(--text-tertiary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: scale(1.02); box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3); }

.btn-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-tertiary); }

.btn-sm { padding: 6px 14px; font-size: 13px; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
}

.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2386868B' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1D1D1F 0%, #2C2C2E 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 48px 40px;
}

.login-logo { text-align: center; margin-bottom: 40px; }
.login-logo h1 { font-size: 32px; font-weight: 700; }
.login-logo h1 span {
    background: linear-gradient(135deg, var(--green) 0%, #30D158 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-logo p { color: var(--text-tertiary); margin-top: 8px; }

.login-error { background: var(--red-light); color: var(--red); padding: 14px 18px; border-radius: var(--radius-md); margin-bottom: 24px; font-size: 14px; }

/* Alerts */
.alert { padding: 16px 20px; border-radius: var(--radius-md); margin-bottom: 20px; font-size: 14px; font-weight: 500; }
.alert-success { background: var(--green-light); color: var(--green); }
.alert-warning { background: var(--yellow-light); color: var(--yellow); }
.alert-danger { background: var(--red-light); color: var(--red); }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-tertiary); }
.empty-state h3 { color: var(--text-primary); margin-bottom: 8px; }

/* Vehicle Detail */
.vehicle-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
}

.vehicle-title h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.vehicle-meta { display: flex; gap: 24px; }
.vehicle-meta-item { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 14px; }

.pulse-indicator {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    box-shadow: var(--shadow-md);
}

.pulse-indicator.green { background: linear-gradient(135deg, var(--green) 0%, #30D158 100%); color: white; }
.pulse-indicator.yellow { background: linear-gradient(135deg, var(--yellow) 0%, #FFD60A 100%); color: #1D1D1F; }
.pulse-indicator.red { background: linear-gradient(135deg, var(--red) 0%, #FF6961 100%); color: white; }
.pulse-indicator.pending { background: linear-gradient(135deg, #8E8E93 0%, #AEAEB2 100%); color: white; }

.analysis-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.analysis-item { background: var(--bg-tertiary); border-radius: var(--radius-md); padding: 16px; text-align: center; border: 1px solid var(--border); }
.analysis-item-label { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.card, .stat-card, .pulse-stat { animation: fadeIn 0.4s ease forwards; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid, .pulse-overview { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .stats-grid, .pulse-overview, .grid-2 { grid-template-columns: 1fr; }
    .content { padding: 20px; }
}
