/* ============================================================
   MyVehicle — Nathan Logistics Vehicle Lease Management
   Color Scheme: Navy #1a3a5c + Orange #f97316
   ============================================================ */

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

:root {
    --primary: #1a3a5c;
    --primary-light: #234b76;
    --primary-dark: #0f2236;
    --accent: #f97316;
    --accent-light: #fb923c;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg: #f1f5f9;
    --white: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-w: 260px;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

a { text-decoration: none; color: inherit; }

/* ============ LAYOUT ============ */
.layout { display: flex; min-height: 100vh; }

.main-content { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; transition: margin-left 0.3s; }

.content { padding: 24px; flex: 1; }

/* ============ SIDEBAR ============ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
}

.sidebar-brand {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: var(--primary-dark);
}

.brand-icon {
    width: 42px; height: 42px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}

.sidebar-brand h2 { font-size: 15px; font-weight: 700; color: var(--white); line-height: 1.2; }
.sidebar-brand span { font-size: 11px; color: rgba(255,255,255,0.55); }

.sidebar-menu { padding: 16px 8px; flex: 1; }

.menu-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    padding: 12px 12px 4px;
    margin-top: 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.75);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 2px;
    position: relative;
}

.sidebar-menu a:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.sidebar-menu a.active { background: var(--accent); color: var(--white); box-shadow: 0 4px 12px rgba(249,115,22,0.4); }

.sidebar-menu .icon { font-size: 16px; width: 20px; text-align: center; }

.badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

/* ============ TOP HEADER ============ */
.top-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.page-title h1 { font-size: 18px; font-weight: 700; color: var(--primary); }
.page-title p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.header-actions { display: flex; align-items: center; gap: 12px; }

.notif-btn {
    width: 38px; height: 38px;
    background: var(--bg);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    cursor: pointer;
    position: relative;
}

.notif-btn .dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg);
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
}

.avatar {
    width: 30px; height: 30px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

/* ============ ALERTS ============ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ============ CARDS ============ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

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

.card-header h3 { font-size: 15px; font-weight: 700; color: var(--primary); }
.card-body { padding: 20px; }

/* ============ STAT CARDS ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); }
.stat-card.blue { border-left-color: var(--info); }
.stat-card.green { border-left-color: var(--success); }
.stat-card.red { border-left-color: var(--danger); }
.stat-card.yellow { border-left-color: var(--warning); }
.stat-card.purple { border-left-color: #8b5cf6; }

.stat-icon { font-size: 28px; flex-shrink: 0; }
.stat-info h3 { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-info p { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ============ TABLE ============ */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
table th {
    background: var(--bg);
    padding: 11px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}
table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
}
table tr:hover td { background: #fafafa; }
table tr:last-child td { border-bottom: none; }

/* ============ BADGES / STATUS ============ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-active, .badge-paid { background: #d1fae5; color: #065f46; }
.badge-expired { background: #fee2e2; color: #991b1b; }
.badge-terminated { background: #f3f4f6; color: #6b7280; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-overdue { background: #fee2e2; color: #991b1b; }
.badge-partial { background: #dbeafe; color: #1e40af; }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-light); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }

/* ============ FORMS ============ */
.form-section {
    background: var(--bg);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.form-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group label .req { color: var(--danger); }

.form-control {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    background: white;
    color: var(--text);
    transition: border-color 0.2s;
    width: 100%;
    font-family: inherit;
}

.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,58,92,0.1); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.upload-box {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}
.upload-box:hover { border-color: var(--primary); background: #f8fafc; }
.upload-box input { display: none; }
.upload-box label { cursor: pointer; display: block; }
.upload-box .upload-icon { font-size: 24px; margin-bottom: 6px; }
.upload-box .upload-text { font-size: 12px; color: var(--text-muted); }
.upload-box .upload-hint { font-size: 11px; color: var(--text-muted); opacity: 0.7; margin-top: 2px; }

/* ============ PHOTO PREVIEW ============ */
.preview-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preview-item { position: relative; }
.preview-item img {
    width: 80px; height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border);
}
.preview-item .remove-btn {
    position: absolute;
    top: -6px; right: -6px;
    width: 18px; height: 18px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
    cursor: pointer;
    border: 2px solid white;
}

/* ============ EXPIRY COLORS ============ */
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-success { color: var(--success) !important; }
.text-muted { color: var(--text-muted) !important; }
.fw-bold { font-weight: 700 !important; }

/* ============ LOGIN PAGE ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-icon {
    width: 64px; height: 64px;
    background: var(--accent);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    margin: 0 auto 12px;
}

.login-logo h2 { font-size: 20px; font-weight: 800; color: var(--primary); }
.login-logo p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ============ VEHICLE CARD ============ */
.vehicle-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
}
.vehicle-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.vehicle-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 16px 20px;
    color: white;
}

.vehicle-card-header h4 { font-size: 16px; font-weight: 800; letter-spacing: 1px; }
.vehicle-card-header p { font-size: 11px; opacity: 0.7; margin-top: 2px; }

.vehicle-card-body { padding: 16px 20px; }
.vehicle-info-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; }
.vehicle-info-row span:first-child { color: var(--text-muted); }
.vehicle-info-row span:last-child { font-weight: 600; }

.vehicle-card-footer {
    padding: 12px 20px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============ TABS ============ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover { color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============ DETAILS VIEW ============ */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.detail-item { }
.detail-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; margin-bottom: 3px; }
.detail-value { font-size: 14px; font-weight: 600; color: var(--text); }

.doc-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}
.doc-link:hover { background: var(--primary); color: white; }

.photo-thumb {
    width: 90px; height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border);
    cursor: pointer;
}

/* ============ OWNER PORTAL ============ */
.owner-portal { background: #f8fafc; min-height: 100vh; }
.owner-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 16px 20px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.owner-header h2 { font-size: 16px; font-weight: 700; }

/* ============ UTILITIES ============ */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 10px; }
.gap-2 { gap: 8px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-100 { width: 100%; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; }

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.search-bar .form-control { flex: 1; }

/* ============ STEPS WIZARD ============ */
.steps-nav {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.step-item {
    flex: 1;
    padding: 14px 10px;
    text-align: center;
    border-right: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    transition: all 0.2s;
}
.step-item:last-child { border-right: none; }
.step-item.active { background: var(--primary); color: white; }
.step-item.done { background: var(--success); color: white; }
.step-num { font-size: 18px; font-weight: 800; display: block; }

/* ============ MODAL ============ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: white;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--primary); }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .content { padding: 16px; }
}
