/* ══════════════════════════════════════════════
   DRIVERS PAGE — drivers.css
   Extends the vans design system.
   Requires: base.css loaded before this file.
   ══════════════════════════════════════════════ */

/* ── LAYOUT ──────────────────────────────────── */
.drivers-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}

/* ── TOOLBAR ─────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .09);
    border-radius: 8px;
    padding: 0 12px;
    height: 38px;
    flex: 1;
    max-width: 300px;
    transition: border .2s, box-shadow .2s;
}

.search-box:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .08);
}

.search-box i {
    font-size: 12px;
    color: #c0c0c0;
}

.search-box input {
    border: none;
    outline: none;
    font-size: 13px;
    width: 100%;
    background: transparent;
    color: #333;
    font-family: inherit;
}

.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: .2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.btn-add:hover {
    background: var(--color-brand);
    box-shadow: 0 4px 12px rgba(46, 58, 77, .2);
}

/* ── DRIVERS CARD ───────────────────────────────── */
.drivers-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .07);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .05);
}

.drivers-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
}

.drivers-card-header h2 {
    font-size: var(--text-xl);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    color: var(--color-primary);
    margin: 0;
    letter-spacing: var(--ls-tight);
}

.drivers-card-header span {
    font-size: var(--text-xs);
    font-weight: var(--fw-medium);
    color: var(--text-muted);
    background: rgba(0, 0, 0, .04);
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: var(--ls-wide);
}

.drivers-table-wrap {
    overflow-x: auto;
}

.drivers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    line-height: var(--lh-normal);
}

.drivers-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
    background: #fafafa;
    border-bottom: 2px solid rgba(0, 0, 0, .08);
    white-space: nowrap;
}

.drivers-table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, .04);
    transition: background .15s;
    cursor: pointer;
}

.drivers-table tbody tr:last-child {
    border-bottom: none;
}

.drivers-table tbody tr:hover {
    background: #fafafa;
}

.drivers-table tbody tr.selected {
    background: rgba(249, 115, 22, .04);
    border-left: 3px solid var(--color-accent);
}

.drivers-table td,
.drivers-table th {
    padding: 14px 12px;
    white-space: nowrap;
}

.drivers-table tbody td {
    color: var(--color-primary);
    vertical-align: middle;
    font-weight: var(--fw-regular);
}

/* ── NAME DISPLAY ───────────────────────────── */
.name-display {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

/* ── LICENSE DISPLAY ───────────────────────────── */
.license-display {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.license-number {
    font-size: var(--text-sm);
    font-weight: var(--fw-bold);
    color: var(--color-primary);
    letter-spacing: var(--ls-wider);
    font-family: var(--font-mono);
    background: rgba(46, 58, 77, .06);
    padding: 4px 8px;
    border-radius: 5px;
    border: 1px solid rgba(46, 58, 77, .1);
}

/* ── STATUS BADGES ───────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

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

.badge.active {
    background: rgba(22, 163, 74, .08);
    color: #16a34a;
}

.badge.active::before {
    background: #16a34a;
}

.badge.inactive {
    background: rgba(239, 68, 68, .08);
    color: #ef4444;
}

.badge.inactive::before {
    background: #ef4444;
}

/* ── ROW ACTIONS ─────────────────────────────── */
.row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.icon-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12.5px;
    transition: background .15s, color .15s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, .06);
    color: var(--color-primary);
}

.icon-btn.edit {
    background: rgba(249, 115, 22, .08);
    color: var(--color-accent);
}

.icon-btn.edit:hover {
    transform: translateY(-1px);
}

.icon-btn.delete {
    background: rgba(239, 68, 68, .08);
    color: #ef4444;
}

.icon-btn.delete:hover {
    transform: translateY(-1px);
}

.icon-btn.toggle {
    background: rgba(22, 163, 74, .08);
    color: #16a34a;
}

.icon-btn.toggle:hover {
    transform: translateY(-1px);
}

/* ── EMPTY STATE ─────────────────────────────── */
.empty-state {
    padding: 48px 20px;
    text-align: center;
    color: #d1d5db;
}

.empty-state i {
    font-size: 36px;
    margin-bottom: 10px;
    display: block;
}

.empty-state p {
    font-size: 13px;
    margin: 0;
}

.text-muted-sm {
    font-size: 12px;
    color: #9ca3af;
}

/* ── DRIVER PREVIEW CARD ───────────────────────── */
.driver-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .07);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .05);
    position: sticky;
    top: 80px;
    isolation: isolate;
}

.driver-card-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
    display: flex;
    align-items: center;
    gap: 10px;
}

.driver-card-header i {
    font-size: 13px;
    color: var(--color-accent);
}

.driver-card-header p {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    flex: 1;
}

.driver-card-header span {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary);
    max-width: 120px;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Empty state */
.driver-empty {
    height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #d1d5db;
}

.driver-empty i {
    font-size: 32px;
}

.driver-empty p {
    font-size: 13px;
    margin: 0;
}

/* Driver preview */
#driver-preview {
    padding: 20px;
}

.driver-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-brand));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: #fff;
    font-size: 24px;
}

.driver-details h3 {
    font-size: var(--text-xl);
    font-weight: var(--fw-bold);
    text-align: center;
    margin: 0 0 20px;
    color: var(--color-primary);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.detail-label {
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: #6b7280;
}

.detail-value {
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    color: var(--color-primary);
}

.detail-badge {
    font-size: var(--text-xs);
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
}

/* ── SEARCHABLE SELECT, MODAL STYLES (same as vans) ── */
select.ss {
    display: none !important;
}

.ss-wrap {
    position: relative;
    width: 100%;
}

.ss-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 38px;
    padding: 0 11px;
    background: var(--input-bg);
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    font-family: inherit;
    transition: border .18s, box-shadow .18s, background .18s;
    text-align: left;
    gap: 8px;
}

.ss-btn:hover {
    border-color: rgba(0, 0, 0, .18);
    background: #fff;
}

.ss-btn.is-open {
    border-color: var(--color-accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .08);
}

.ss-btn.is-placeholder .ss-btn-txt {
    color: #aaa;
}

.ss-btn-txt {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.ss-btn-arr {
    font-size: 10px;
    color: #aaa;
    flex-shrink: 0;
    transition: transform .2s;
}

.ss-btn.is-open .ss-btn-arr {
    transform: rotate(180deg);
}

.ss-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .1);
    z-index: 9999;
    overflow: hidden;
    display: none;
}

.ss-panel.is-open {
    display: block;
}

.ss-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: 180px;
    overflow-y: auto;
}

.ss-list::-webkit-scrollbar {
    width: 4px;
}

.ss-list::-webkit-scrollbar-track {
    background: transparent;
}

.ss-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, .12);
    border-radius: 4px;
}

.ss-item {
    padding: 8px 12px;
    font-size: 12.5px;
    color: #374151;
    cursor: pointer;
    transition: background .12s;
}

.ss-item:hover {
    background: rgba(249, 115, 22, .06);
    color: var(--color-primary);
}

.ss-item.is-sel {
    background: rgba(249, 115, 22, .08);
    color: var(--color-accent);
    font-weight: 600;
}

.ss-item.is-sel::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    float: right;
    margin-top: 1px;
}

.ss-item.is-placeholder {
    color: #aaa;
    font-style: italic;
}

.ss-no-results {
    padding: 14px 12px;
    font-size: 12px;
    color: #aaa;
    text-align: center;
}

.rmodal {
    border: 0 !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18) !important;
    overflow: hidden;
}

.rmodal-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 20px 0;
}

.rmodal-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: rgba(249, 115, 22, .09);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent);
    font-size: 14px;
}

.rmodal-icon.edit {
    background: rgba(46, 58, 77, .07);
    color: var(--color-primary);
}

.rmodal-title {
    font-size: var(--text-lg);
    font-weight: var(--fw-bold);
    color: var(--color-primary);
    margin: 0 0 4px;
    line-height: var(--lh-tight);
    letter-spacing: var(--ls-tight);
}

.rmodal-sub {
    font-size: var(--text-sm);
    font-weight: var(--fw-regular);
    color: var(--text-muted);
    margin: 0;
    line-height: var(--lh-normal);
}

.rmodal-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 60vh;
    overflow-y: auto;
}

.rmodal-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(0, 0, 0, .06);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.modal-dialog-scrollable .modal-content {
    max-height: 90vh;
}

.rfield {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rfield-label {
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
    display: flex;
    align-items: center;
    gap: 6px;
}

.rfield-label i {
    color: #c0c0c0;
    font-size: 10px;
}

.rbtn {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: var(--transition);
    white-space: nowrap;
    letter-spacing: var(--ls-normal);
}

.rbtn-ghost {
    background: transparent;
    color: #6b7280;
    border: 1px solid rgba(0, 0, 0, .1);
}

.rbtn-ghost:hover {
    background: rgba(0, 0, 0, .04);
    color: var(--color-primary);
}

.rbtn-primary {
    background: var(--color-primary);
    color: #fff;
}

.rbtn-primary:hover {
    background: var(--color-brand);
    box-shadow: 0 4px 12px rgba(46, 58, 77, .2);
}

.rinput {
    width: 100%;
    height: 38px;
    padding: 0 11px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 0, 0, .1);
    background: var(--input-bg);
    font-size: 13px;
    font-family: inherit;
    color: #374151;
    outline: none;
    transition: border .18s, box-shadow .18s, background .18s;
}

.rinput::placeholder {
    color: #bbb;
}

.rinput:hover {
    border-color: rgba(0, 0, 0, .18);
    background: #fff;
}

.rinput:focus {
    border-color: var(--color-accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .08);
}

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 900px) {
    .drivers-wrapper {
        grid-template-columns: 1fr;
    }

    .driver-card {
        position: static;
    }
}

@media (max-width: 600px) {
    .toolbar {
        flex-wrap: wrap;
    }

    .search-box {
        max-width: 100%;
    }
}

/* Dark mode overrides for modal */
.admin-dark-mode .rmodal {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.07) !important;
}

.admin-dark-mode .rmodal-header {
    background: #263347;
}

.admin-dark-mode .rmodal-title {
    color: white !important;
}

.admin-dark-mode .rmodal-sub {
    color: #94a3b8 !important;
}

.admin-dark-mode .rmodal-body {
    background: transparent;
}

.admin-dark-mode .rmodal-footer {
    border-top-color: rgba(255, 255, 255, 0.07) !important;
    background: #263347;
}

