/* /public/admin.css */

/* =================================================================== */
/* 1. ROOT & COLOR PALETTE
/* This is the central control panel for your admin theme.
/* =================================================================== */
:root {
    --color-primary: #007aff;         /* A clean, professional blue */
    --color-primary-hover: #005ec4;
    --color-danger: #d92d20;           /* Your existing red */
    --color-danger-hover: #b92015;
    --color-secondary: #6c757d;
    --color-secondary-hover: #5a6268;

    --color-bg-main: #f4f5f7;        /* Soft gray for the main background */
    --color-bg-content: #ffffff;     /* White for cards and sidebars */
    --color-bg-subtle: #f9f9f9;       /* For striped tables, etc. */
    --color-border: #dee2e6;
    --color-border-subtle: #e9ecef;

    --color-text: #212529;            /* Dark primary text */
    --color-text-muted: #6c757d;      /* Lighter text for labels/help */
    --color-text-on-primary: #ffffff;
    --color-text-on-danger: #ffffff;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --radius: 8px;
    --radius-sm: 5px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* =================================================================== */
/* 2. GENERAL STYLES (Body, Typography)
/* =================================================================== */
body.full-page-container {
    background-color: var(--color-bg-main);
    color: var(--color-text);
    font-family: var(--font-sans);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

.muted, .geo-status {
    color: var(--color-text-muted);
    font-size: 0.9em;
}

.badge {
    display: inline-block;
    padding: .25em .6em;
    font-size: .8em;
    font-weight: 600;
    line-height: 1;
    color: var(--color-text-muted);
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--radius-sm);
    background-color: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
}

.success-text { color: green; }
.error-text, .error { color: var(--color-danger); }

/* =================================================================== */
/* 3. LAYOUT (Header, Sidebar, Main)
/* =================================================================== */
.site-header {
    background: var(--color-bg-content);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.sidebar {
    background: var(--color-bg-content);
    border-right: 1px solid var(--color-border);
}

.sidebar .nav-link {
    color: #495057;
    padding: 0.6rem 1.5rem;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    background-color: var(--color-bg-subtle);
    color: var(--color-primary);
}

.sidebar .nav-link.active {
    background-color: #e6f2ff;
    color: var(--color-primary);
    font-weight: 600;
    border-left-color: var(--color-primary);
}

/* =================================================================== */
/* 4. COMPONENTS (Cards, Forms, Buttons, Tables)
/* =================================================================== */

.card {
    background-color: var(--color-bg-content);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

/* --- Forms --- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: var(--color-bg-content);
    font-size: 0.9rem;
    color: var(--color-text);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.25);
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.75rem;
}
    label > .muted {
        font-weight: 400;
        font-size: 0.8em;
    }

/* --- Buttons (Inherits from style.css, but we add primary/secondary) --- */
button.primary,
button.secondary {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

button.primary {
    background-color: var(--color-primary);
    color: var(--color-text-on-primary);
    border: 1px solid var(--color-primary);
}
    button.primary:hover {
        background-color: var(--color-primary-hover);
        border-color: var(--color-primary-hover);
    }

button.secondary {
    background-color: var(--color-bg-content);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
    button.secondary:hover {
        background-color: var(--color-bg-subtle);
    }

button.danger {
    background-color: var(--color-danger);
    color: var(--color-text-on-danger);
    border-color: var(--color-danger);
}
    button.danger:hover {
        background-color: var(--color-danger-hover);
        border-color: var(--color-danger-hover);
    }

/* --- Tables --- */
.table-wrap {
    overflow-x: auto;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.table th,
.table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border-subtle);
    text-align: left;
    vertical-align: top;
}
.table th {
    font-weight: 600;
    background-color: var(--color-bg-subtle);
}
.table tbody tr:nth-child(odd) {
    background-color: var(--color-bg-subtle);
}
.table tbody tr:hover {
    background-color: #e6f2ff;
}
.table.simple th {
    background-color: transparent;
}
.table.simple tbody tr:nth-child(odd) {
    background-color: transparent;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1rem;
}
.tab-link {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 3px solid transparent;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-muted);
}
.tab-link:hover {
    color: var(--color-text);
}
.tab-link.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}


/* =================================================================== */
/* 5. MODALS
/* =================================================================== */
dialog {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
}
dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
}

.modal-search-list {
    padding: 0;
    margin: 0.5rem 0;
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

    .modal-search-list li {
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid var(--color-border-subtle);
    }
    .modal-search-list li:last-child {
        border-bottom: none;
    }


/* =================================================================== */
/* 6. VIEW-SPECIFIC STYLES (from old <style> block)
/* =================================================================== */

/* --- Dashboard & Analytics --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1rem;
}
    .metrics-grid .card canvas {
        max-height: 300px;
        width: 100%;
    }

/* --- Country Selector --- */
.country-selector {
    background-color: var(--color-bg-content);
    border: 1px solid var(--color-border);
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
    .country-selector label {
        margin: 0;
        font-weight: 600;
    }

/* --- SMTP Modal --- */
.smtp-field-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
    .smtp-field-grid label {
        font-weight: 500;
    }
    .smtp-field-grid .muted {
        grid-column: 2;
        margin-top: -0.75rem;
        font-size: 0.8rem;
    }

/* --- Geo Fencing (City Rates Modal) --- */
.rate-field-group {
    margin-bottom: 1.5rem;
}

.input-with-currency {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding-left: 0.75rem;
    background-color: var(--color-bg-subtle);
}
    .input-with-currency .currency-symbol {
        font-weight: 600;
        color: var(--color-text-muted);
        padding-right: 0.5rem;
    }
    .input-with-currency input {
        border: none;
        padding: 0.5rem;
        background-color: transparent;
        width: 100%;
    }
        .input-with-currency input:focus {
            outline: none;
            box-shadow: none;
        }

.rate-equivalents {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    display: flex;
    gap: 1rem;
    padding-left: 0.25rem;
}

/* =================================================================== */
/* 7. GLOBAL ACTIVITY PANEL (New Dashboard Component)
/* =================================================================== */
.global-activity-panel {
    background: linear-gradient(145deg, var(--color-bg-content), #fcfdff);
    border: 1px solid var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.1);
}

.global-activity-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.global-activity-columns .column {
    flex: 1;
    min-width: 300px;
}

.global-activity-columns h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border-subtle);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
}

.activity-list li {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--color-border-subtle);
    font-size: 0.9rem;
}

.activity-list li:last-child {
    border-bottom: none;
}

.activity-list .activity-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s;
}

.activity-list .activity-item:hover {
    background-color: #e6f2ff;
    color: var(--color-primary);
}

/* You can replace these with actual icon font classes if you have one */
.activity-item .icon {
    display: inline-block;
    width: 1.25em;
    height: 1.25em;
    line-height: 1.25em;
    text-align: center;
    border-radius: 50%;
    font-weight: 600;
    flex-shrink: 0;
}

.icon-new-user {
    background-color: #e6f2ff;
    color: var(--color-primary);
}
.icon-new-booking {
    background-color: #e0f8e9;
    color: #008a2e;
}

/* =================================================================== */
/* 8. LIVE TRACKING BOARD (NEW)
/* =================================================================== */
#live-tracking-container {
    display: grid;
    grid-template-columns: 1fr 300px; /* Main map | List */
    gap: 1rem;
    min-height: 70vh;
}

#live-map-container {
    background: #f4f4f4;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

#live-map {
    height: 100%;
    width: 100%;
    border-radius: var(--radius-sm);
}

#live-ride-list-container {
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    background: var(--color-bg-subtle);
}

#live-ride-list .card {
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}

#live-ride-list .card:hover {
    background-color: #e6f2ff;
    box-shadow: 0 0 0 2px var(--color-primary);
}

/* Ensure Leaflet popups match the admin theme */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-sm);
}
.leaflet-popup-content {
    font-family: var(--font-sans);
    font-size: 0.9rem;
}
.leaflet-popup-content strong {
    color: var(--color-primary);
}

/* =================================================================== */
/* 9. RATING MANAGEMENT MODAL (NEW)
/* =================================================================== */
.ratings-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-top: 1rem;
}
.rating-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border-subtle);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1rem;
}
.rating-item:last-child {
    border-bottom: none;
}
.rating-stars-display {
    font-size: 1.2rem;
    color: #ffc107; /* Gold */
}
.rating-stars-display .muted {
    color: #ccc;
}
.rating-item .rating-comment {
    grid-column: 1 / -1;
    font-size: 0.9rem;
    color: var(--color-text);
    background: var(--color-bg-subtle);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    word-break: break-word;
}
.rating-item .rating-date {
    grid-column: 1;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.rating-item .rating-actions {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    gap: 0.5rem;
}
.rating-edit-form {
    background: #e6f2ff;
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
}
.rating-edit-form label {
    margin-bottom: 0.5rem;
}
.rating-edit-form .rating-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* =================================================================== */
/* 10. DISPATCH MANAGEMENT MODAL (NEW)
/* =================================================================== */
#dispatch-modal-actions h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
#dispatch-modal-actions label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}
#dispatch-modal-actions select {
    margin-top: 0.25rem;
}
#dispatch-modal-status {
    margin-top: 0.75rem;
}

/* =================================================================== */
/* 11. DRIVER INQUIRY MODAL (NEW)
/* =================================================================== */
#inquiry-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.inquiry-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border-subtle);
}
.inquiry-item:last-child {
    border-bottom: none;
}

.inquiry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
.inquiry-header strong {
    font-size: 1.05em;
    font-weight: 600;
}

.inquiry-body {
    font-size: 0.9rem;
    line-height: 1.5;
}
.inquiry-body p {
    margin: 0;
}

.inquiry-note {
    font-style: italic;
    color: var(--color-text);
    background: var(--color-bg-subtle);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    margin-top: 0.5rem !important;
}

.inquiry-contact {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}