/* ═══════════════════════════════════════════════════════════════════════════
   Drivers Page Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page Header ───────────────────────────────────────────────────────── */
.drivers-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
}

.drivers-top-row {
    flex-wrap: nowrap;
}

@media (max-width: 768px) {
    .drivers-top-row {
        flex-wrap: wrap;
        flex-direction: column-reverse;
    }
    .drivers-header-actions {
        width: 100%;
        margin-bottom: 0 !important;
        justify-content: flex-end;
    }
    .drivers-metrics {
        width: 100%;
    }
}

.drivers-header::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 0;
    right: 0;
    height: 30px;
    background: var(--bg-primary);
}

.drivers-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* ── Metrics Row ───────────────────────────────────────────────────────── */
.drivers-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.drivers-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}

.drivers-tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    position: relative;
    top: 1px;
}

.drivers-tab:hover {
    color: var(--text-primary);
}

.drivers-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

.drivers-tab .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.drivers-tab.active .tab-count {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* ── Tab Content Container ─────────────────────────────────────────────── */
.drivers-tab-content {
    display: none;
}

.drivers-tab-content.active {
    display: block;
}

/* ── Drivers Grid ──────────────────────────────────────────────────────── */
.drivers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

/* ── Driver Card ───────────────────────────────────────────────────────── */
.driver-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.15s;
    cursor: pointer;
}

.driver-card:hover {
    border-color: var(--text-tertiary);
}

.driver-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.driver-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-hover);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}

.driver-info {
    flex: 1;
    min-width: 0;
}

.driver-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.driver-email {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.driver-card-stats {
    display: flex;
    gap: 16px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}

.driver-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.driver-stat strong {
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Invite Card ───────────────────────────────────────────────────────── */
.invite-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.15s;
}

.invite-card:hover {
    border-color: var(--border-strong);
}

.invite-info {
    flex: 1;
    min-width: 0;
}

.invite-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.invite-email {
    font-size: 12px;
    color: var(--text-tertiary);
}

.invite-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.invite-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Invite Form (inline) ─────────────────────────────────────────────── */
.invite-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 18px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
}

.invite-form .form-group {
    flex: 1;
    margin-bottom: 0;
}

.invite-form label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: block;
}

/* ── Active Deliveries Grid ────────────────────────────────────────────── */
.deliveries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}

/* ── Delivery Card ─────────────────────────────────────────────────────── */
.delivery-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.15s;
}

.delivery-card:hover {
    border-color: var(--border-strong);
}

.delivery-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.delivery-driver-info {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.delivery-driver-info svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

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

/* ── Driver Detail Slideout ────────────────────────────────────────────── */
.driver-detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.driver-detail-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-hover);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    flex-shrink: 0;
}

.driver-detail-info .driver-name {
    font-size: 16px;
}

.driver-detail-info .driver-email {
    font-size: 13px;
}

.driver-detail-section {
    margin-bottom: 22px;
}

.driver-detail-section h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}

/* ── Driver stats grid in slideout ─────────────────────────────────────── */
.driver-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.driver-stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
}

.driver-stat-card .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.driver-stat-card .stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
    display: block;
}

/* ── Live location placeholder in slideout ─────────────────────────────── */
.driver-location-placeholder {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 30px 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}

.driver-location-placeholder svg {
    display: block;
    margin: 0 auto 8px;
    width: 28px;
    height: 28px;
    stroke-width: 1.4;
}

/* ── Driver order history list in slideout ──────────────────────────────── */
.driver-order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

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

.driver-order-id {
    font-weight: 600;
    color: var(--text-primary);
}

.driver-order-meta {
    color: var(--text-tertiary);
    font-size: 12px;
}

.driver-order-total {
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Invites list (stacked) ────────────────────────────────────────────── */
.invites-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .drivers-metrics {
        grid-template-columns: 1fr 1fr;
    }

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

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

    .invite-form {
        flex-direction: column;
        align-items: stretch;
    }

    .invite-form .btn {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .drivers-metrics {
        grid-template-columns: 1fr;
    }

    .drivers-tabs {
        overflow-x: auto;
    }
}
