/* ---- Fleet Common Styles ---- */
/* Extends the design system from style.css */

/* Fleet main content area */
.fleet-main {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 20px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--green-dark);
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 6px;
    letter-spacing: 0;
}

.stat-detail {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.stat-badge {
    display: inline-block;
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    letter-spacing: 0.01em;
    vertical-align: middle;
}

.badge-green { background: var(--accent-green-dim); color: var(--accent-green); }
.badge-amber { background: var(--accent-amber-dim); color: #b47a00; }
.badge-red { background: var(--accent-red-dim); color: var(--accent-red); }
.badge-blue { background: var(--accent-blue-dim); color: var(--accent-blue); }

/* ---- Health Card ---- */
.health-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.health-good {
    border: 2px solid var(--accent-green);
}
.health-good .health-status {
    color: var(--accent-green);
}
.health-problem {
    border: 2px solid var(--accent-red);
}
.health-problem .health-status {
    color: var(--accent-red);
}
.health-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}

/* ---- Clickable Unit Badge ---- */
.unit-badge-link {
    text-decoration: none;
    color: inherit;
}
.unit-badge-link:hover .unit-badge {
    background: var(--green-dark);
    color: #fff;
}

/* ---- Fleet Sections ---- */
.fleet-section {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

/* A section heading that carries a count chip (e.g. "Your active
   rentals · 3"). Keeps the main label confident and makes the count
   recede as metadata instead of competing. */
.section-title-with-count {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-count {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    background: var(--bg-subtle, #f3f4f6);
    padding: 2px 10px;
    border-radius: 999px;
    line-height: 1.6;
}

/* Account identity — company name sitting at the top of the customer
   info card. Heavier than .section-title because it IS the identity,
   not a subsection. */
.account-identity-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 18px;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

/* Lighter empty-state line for sections where there's nothing yet —
   "No active rentals right now" etc. Calmer than a centered bold p. */
.empty-state-line {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 6px 0 0;
    padding: 10px 0 2px;
}

/* Intro paragraph under the topbar page title — gives context without
   repeating the title as a body H1. Shared pattern across portal
   pages that have a single-sentence description. */
.portal-page-lede {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 20px;
    max-width: 720px;
}

/* Welcome-nudge card grid: 3 across on full width, 1 stack below 720px.
   The previous auto-fit + minmax approach produced an awkward 2-col
   layout at tablet widths with the 3rd card orphaning alone on its
   own row. Explicit breakpoints read more predictably. */
.welcome-nudge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
@media (max-width: 720px) {
    .welcome-nudge-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- Fleet Table ---- */
.fleet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.fleet-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text-primary); }
th.sortable .sort-icon { font-size: 0.7rem; opacity: 0.5; margin-left: 2px; }
th.sortable:hover .sort-icon { opacity: 1; }

.fleet-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
}

.fleet-table tbody tr:hover {
    background: var(--bg-primary);
}

.fleet-table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
}

.empty-row {
    text-align: center;
    padding: 40px 12px !important;
    color: var(--text-muted);
}

/* ---- Badges ---- */
.unit-badge {
    display: inline-block;
    background: var(--green-dark);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* TBD rentals where no unit has been assigned yet — visible but dimmer so
   customers know the unit is pending assignment on delivery day. */
.unit-badge-tbd {
    background: transparent;
    color: var(--text-muted);
    border: 1px dashed var(--border-color, #ccc);
}

/* Pink-finish units — same shape as default unit-badge, hot pink background.
   Used everywhere unit_code is shown so drivers, admins, and customers can
   tell at a glance the unit is a pink Standard. */
.unit-badge-pink {
    background: #ec4899;
    color: #fff;
}
.unit-badge-link:hover .unit-badge-pink {
    background: #db2777;
}

/* Driver task card unit code — pill style matching unit-badge. */
.task-unit-code {
    display: inline-block;
    background: var(--green-dark);
    color: #fff;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}
.task-unit-code-pink {
    background: #ec4899;
}

.info-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.status-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    text-transform: capitalize;
}

.status-available { background: var(--accent-green-dim); color: var(--accent-green); }
.status-rented { background: var(--accent-amber-dim); color: #b47a00; }
.status-maintenance { background: var(--accent-red-dim); color: var(--accent-red); }
.status-scheduled { background: var(--accent-blue-dim); color: var(--accent-blue); }
.status-active { background: var(--accent-green-dim); color: var(--accent-green); }
.status-completed { background: var(--bg-tertiary); color: var(--text-secondary); }
.status-cancelled { background: var(--accent-red-dim); color: var(--accent-red); }
.status-pending { background: var(--accent-amber-dim); color: #b47a00; }

.type-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    text-transform: capitalize;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.type-standard { background: var(--bg-tertiary); }
.type-deluxe { background: var(--accent-blue-dim); color: var(--accent-blue); }
.type-ada { background: var(--accent-green-dim); color: var(--accent-green); }
.type-trailer { background: var(--accent-amber-dim); color: #b47a00; }

.service-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    text-transform: capitalize;
}

.service-delivery { background: var(--accent-blue-dim); color: var(--accent-blue); }
.service-pickup { background: var(--accent-amber-dim); color: #b47a00; }
.service-cleaning { background: var(--accent-green-dim); color: var(--accent-green); }
.service-relocation { background: #e8e0f0; color: #6b4fa0; }
.service-repair { background: var(--accent-red-dim); color: var(--accent-red); }
.service-inspection { background: var(--bg-tertiary); color: var(--text-secondary); }

.freq-badge {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* ---- Fleet Filters ---- */
.fleet-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.fleet-filters select,
.fleet-filters input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    min-height: 38px;
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--bg-primary);
}

.modal-body {
    padding: 20px;
}

/* ---- Form Styles ---- */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 0;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--green-mid);
    box-shadow: 0 0 0 3px var(--accent-green-dim);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row.form-row--3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-row.form-row--4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* ---- Form sections (grouped fields inside modals) ---- */
.form-section + .form-section {
    margin-top: 18px;
}

.form-section-title {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}

/* Small hint text rendered below an input (replaces inline parenthetical
 * descriptions inside labels, which caused ragged label heights). */
.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* ---- Wider form modal (opt-in via .modal--form-lg) ---- */
.modal.modal--form-lg {
    max-width: 680px;
}

/* ---- Sticky action footer inside a scrolling modal-body ----
 * Bleeds out to the body padding edges (margins = -padding) so the border
 * runs the full modal width. Relies on .modal-body padding:20px. */
.modal-footer-sticky {
    position: sticky;
    bottom: -20px;
    margin: 16px -20px -20px;
    padding: 14px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    z-index: 2;
}

/* ---- Read-only status pill (swaps in for a disabled <select>) ---- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    min-height: 42px;
    box-sizing: border-box;
    line-height: 1;
}

.status-pill--completed {
    background: var(--accent-green-dim);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.status-pill--cancelled {
    background: rgba(127, 127, 127, 0.1);
    border-color: var(--border);
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .form-row.form-row--3,
    .form-row.form-row--4 {
        grid-template-columns: 1fr;
    }
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: 16px;
}

.empty-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ---- Flash Messages ---- */
.flash-messages {
    margin-bottom: 16px;
}

.flash {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.flash-error {
    background: var(--accent-red-dim);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.flash-success {
    background: var(--accent-green-dim);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

/* ---- Sidebar User Section ---- */
.sidebar-user-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--green-dark);
    font-size: 0.85rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-user-role {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 1.2;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.45);
    background: transparent;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    cursor: pointer;
}

.sidebar-logout-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.text-muted {
    color: var(--text-muted);
}

/* ---- Detail Page (shared across admin, portal, driver) ---- */
.detail-page {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
}

.detail-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.detail-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.005em;
}

/* ---- Info Grid (read-only label/value pairs) ---- */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 32px;
}

.info-grid .info-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-weight: 500;
    letter-spacing: 0;
}

.info-grid .info-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ---- Section Toggle ---- */
.section-toggle {
    cursor: pointer;
    user-select: none;
}

.section-toggle .chevron {
    transition: transform 0.2s;
    display: inline-block;
    font-size: 0.7rem;
}

.section-toggle.collapsed .chevron {
    transform: rotate(-90deg);
}

.section-body.collapsed {
    display: none;
}

/* ---- Timeline ---- */
.timeline {
    list-style: none;
    padding: 0;
    margin: 0;
}

.timeline-item {
    position: relative;
    padding-left: 28px;
    padding-bottom: 20px;
    border-left: 2px solid var(--border-light);
    margin-left: 8px;
}

.timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -7px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--green-mid);
    border: 2px solid var(--bg-card);
}

.timeline-dot.cleaning, .timeline-dot.service { background: var(--accent-green); }
.timeline-dot.delivery { background: var(--accent-blue); }
.timeline-dot.pickup { background: #b47a00; }
.timeline-dot.repair { background: var(--accent-red); }
.timeline-dot.inspection { background: var(--text-secondary); }

/* Upcoming services */
.upcoming-stops { padding: 0 16px 16px; }
.upcoming-stop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    margin-bottom: 8px;
}
.upcoming-stop-row:last-child { margin-bottom: 0; }
.upcoming-stop-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upcoming-stop-date { font-size: 0.85rem; color: var(--text-secondary); }
.btn-text-danger {
    background: none; border: none; color: var(--accent-red);
    font-size: 0.82rem; cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.btn-text-danger:hover { background: rgba(220,53,69,0.08); }

.timeline-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 14px 16px;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.timeline-unit {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--green-dark);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

.timeline-driver {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

.timeline-notes {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-top: 6px;
    line-height: 1.5;
}

.timeline-photo {
    margin-top: 10px;
}

.timeline-photo img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.timeline-photo img:hover {
    opacity: 0.85;
}

/* ---- Before/After Side-by-Side Photos ---- */
.ba-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    border-radius: 8px;
    overflow: hidden;
}
.ba-pair-item {
    position: relative;
}
.ba-pair-item img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
    border-radius: 6px;
}
.ba-pair-label {
    position: absolute;
    bottom: 6px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
}

/* Photo label tag (used in driver capture previews and single-photo displays) */
.photo-label-tag {
    position: absolute;
    bottom: 8px; left: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Photo Lightbox ---- */
.photo-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: pointer;
}

.photo-lightbox.open {
    display: flex;
}

.photo-lightbox img {
    max-width: 95%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.photo-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 6px;
    line-height: 1;
}

.photo-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ---- Notification Bell ---- */
.notif-bell-wrap {
    position: relative;
}

.notif-bell {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: var(--text-secondary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.notif-bell:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 0;
    background: var(--accent-red);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

.notif-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 340px;
    max-height: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 500;
    overflow: hidden;
}

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

.notif-dropdown-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notif-mark-all {
    background: none;
    border: none;
    font-size: 0.75rem;
    color: var(--green-dark);
    cursor: pointer;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.notif-mark-all:hover {
    background: var(--accent-green-dim);
}

.notif-dropdown-body {
    max-height: 340px;
    overflow-y: auto;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.1s;
}
a.notif-item {
    display: block;
    text-decoration: none;
    color: inherit;
}

.notif-item:hover {
    background: var(--bg-primary);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item.unread {
    background: var(--accent-blue-dim);
}

.notif-item.unread:hover {
    background: rgba(59, 130, 246, 0.12);
}

.notif-item-title {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    line-height: 1.3;
}

.notif-item-message {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ---- Action Bar & Overflow Menu ---- */
.action-bar {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.action-overflow-wrap {
    position: relative;
}

.action-overflow-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    min-width: 36px;
}

.action-overflow-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 500;
    padding: 4px 0;
}

.action-overflow-menu.open {
    display: block;
}

.action-overflow-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-family);
}

.action-overflow-item:hover {
    background: var(--bg-primary);
}

/* ---- Sortable table headers ---- */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 18px !important;
}

.sortable::after {
    content: "⇅";
    position: absolute;
    right: 2px;
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.4;
}

.sortable.sort-asc::after {
    content: "▲";
    opacity: 1;
    color: var(--green-dark);
}

.sortable.sort-desc::after {
    content: "▼";
    opacity: 1;
    color: var(--green-dark);
}

.sortable:hover {
    color: var(--green-dark);
}

/* ---- Small button variant ---- */
.btn-sm {
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* Desktop: hide mobile-only elements */
.show-mobile-only {
    display: none;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .fleet-main {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .col-hide-mobile {
        display: none;
    }

    .hide-mobile {
        display: none !important;
    }

    .show-mobile-only {
        display: block;
    }

    .fleet-table {
        font-size: 0.8rem;
    }

    .fleet-filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .fleet-filters select,
    .fleet-filters input {
        min-width: 0;
        width: 100%;
    }
    .fleet-filters input[type="text"] {
        grid-column: 1 / -1;
    }

    .form-row {
        grid-template-columns: 1fr !important;
    }

    .modal {
        max-width: calc(100% - 20px);
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .notif-dropdown {
        position: fixed;
        top: 56px;
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        max-height: 70vh;
        border-radius: 12px;
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    }
    .notif-dropdown-body {
        max-height: calc(70vh - 50px);
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .action-overflow-menu {
        position: fixed;
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 12px;
        width: auto;
        max-width: none;
        border-radius: 12px;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
    }

    .action-overflow-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    /* Ensure touch targets are >= 44px */
    .btn-sm,
    .btn-small {
        min-height: 44px;
        padding: 10px 16px;
    }

    .btn-task {
        min-height: 44px;
        padding: 10px 16px;
    }

    /* Photo pairs stack on very small screens */
    .ba-pair {
        grid-template-columns: 1fr 1fr;
    }
}

/* Small phone breakpoint */
@media (max-width: 480px) {
    .fleet-main {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .fleet-table {
        font-size: 0.75rem;
    }

    .notif-dropdown {
        width: calc(100vw - 16px);
        right: -12px;
    }
}

/* ---- Bottom Navigation (mobile only) ---- */
.bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        z-index: 100;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 0.65rem;
        font-weight: 600;
        padding: 6px 0;
        min-height: 44px;
        transition: color 0.15s;
    }

    .bottom-nav-item.active {
        color: var(--green-dark);
    }

    .bottom-nav-item svg {
        flex-shrink: 0;
    }

    /* Only pad for the bottom-nav when it's actually rendered (admin/manager) */
    .app-shell:has(.bottom-nav) .fleet-main {
        padding-bottom: 72px;
    }
}

/* Driver unit cards (mobile) */
.driver-unit-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s;
}
.driver-unit-card:active {
    border-color: var(--green-dark);
}
.driver-unit-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.driver-unit-card-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}
.driver-unit-card-label {
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-right: 12px;
}
