/* ════════════════════════════════════════════════════════════════
   ADMIN MODULE — Styles
   ════════════════════════════════════════════════════════════════ */

/* ── Container ──────────────────────────────────────────────── */
#admin-container {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: #0a0f1a;
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Top Bar ────────────────────────────────────────────────── */
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 20px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}
.admin-topbar-brand {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #38bdf8;
    text-transform: uppercase;
}
.admin-topbar-back {
    background: none;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
}
.admin-topbar-back:hover {
    color: #e2e8f0;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, .08);
}

/* ── Body (sidebar + main) ──────────────────────────────────── */
.admin-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.admin-sidebar {
    width: 220px;
    min-width: 220px;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}
.admin-nav {
    padding: 12px 0;
    flex: 1;
}
.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 13px;
    color: #94a3b8;
    cursor: pointer;
    transition: all .15s;
    border-left: 3px solid transparent;
}
.admin-nav-item:hover {
    color: #e2e8f0;
    background: rgba(56, 189, 248, .05);
}
.admin-nav-item.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, .08);
    border-left-color: #38bdf8;
}
.admin-nav-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}
.admin-nav-divider {
    height: 1px;
    background: #1e293b;
    margin: 8px 16px;
}

/* ── Sidebar Quick Stats ────────────────────────────────────── */
.admin-sidebar-stats {
    padding: 16px;
    border-top: 1px solid #1e293b;
}
.admin-sidebar-stats h6 {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin-bottom: 10px;
}
.admin-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 3px 0;
}
.admin-stat-row .stat-label { color: #94a3b8; }
.admin-stat-row .stat-value { color: #e2e8f0; font-weight: 600; }

/* ── Main Content ───────────────────────────────────────────── */
.admin-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    min-width: 0;
}

/* ── Breadcrumbs ────────────────────────────────────────────── */
.admin-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
}
.admin-breadcrumb a {
    color: #38bdf8;
    text-decoration: none;
    cursor: pointer;
}
.admin-breadcrumb a:hover { text-decoration: underline; }
.admin-breadcrumb .sep { color: #475569; }

/* ── Page Header ────────────────────────────────────────────── */
.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.admin-page-title {
    font-size: 22px;
    font-weight: 700;
    color: #e2e8f0;
    margin: 0;
}

/* ── Search ─────────────────────────────────────────────────── */
.admin-search {
    width: 100%;
    max-width: 360px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 8px 12px;
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
    margin-bottom: 16px;
    transition: border-color .2s;
}
.admin-search:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, .15);
}
.admin-search::placeholder { color: #64748b; }

/* ── Buttons ────────────────────────────────────────────────── */
.admin-btn {
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.admin-btn-primary {
    background: #38bdf8;
    color: #0a0f1a;
}
.admin-btn-primary:hover { background: #7dd3fc; }
.admin-btn-danger {
    background: #ef4444;
    color: #fff;
}
.admin-btn-danger:hover { background: #f87171; }
.admin-btn-glass {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
}
.admin-btn-glass:hover {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, .08);
}
.admin-btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}
.admin-btn-icon {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all .15s;
}
.admin-btn-icon:hover { color: #38bdf8; background: rgba(56, 189, 248, .1); }
.admin-btn-icon.danger:hover { color: #ef4444; background: rgba(239, 68, 68, .1); }

/* ── Tables ─────────────────────────────────────────────────── */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.admin-table thead th {
    background: #1e293b;
    color: #94a3b8;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid #334155;
    white-space: nowrap;
}
.admin-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #1e293b;
    color: #cbd5e1;
    vertical-align: middle;
}
.admin-table tbody tr:hover {
    background: rgba(56, 189, 248, .04);
}
.admin-table .link-cell {
    color: #38bdf8;
    cursor: pointer;
}
.admin-table .link-cell:hover { text-decoration: underline; }

/* ── Cards / Summary ────────────────────────────────────────── */
.admin-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.admin-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 16px;
}
.admin-card .card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #64748b;
    margin-bottom: 6px;
}
.admin-card .card-value {
    font-size: 24px;
    font-weight: 700;
    color: #e2e8f0;
}

/* ── Tabs ───────────────────────────────────────────────────── */
.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #1e293b;
    margin-bottom: 20px;
    overflow-x: auto;
}
.admin-tab {
    padding: 10px 18px;
    font-size: 13px;
    color: #94a3b8;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all .15s;
}
.admin-tab:hover { color: #e2e8f0; }
.admin-tab.active {
    color: #38bdf8;
    border-bottom-color: #38bdf8;
}

/* ── Badges ─────────────────────────────────────────────────── */
.admin-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(56, 189, 248, .15);
    color: #38bdf8;
    margin: 1px 2px;
}
.admin-badge-green { background: rgba(34, 197, 94, .15); color: #22c55e; }
.admin-badge-red   { background: rgba(239, 68, 68, .15); color: #ef4444; }
.admin-badge-amber { background: rgba(245, 158, 11, .15); color: #f59e0b; }
.admin-badge-gray  { background: rgba(148, 163, 184, .15); color: #94a3b8; }

/* ── Contact Cards ──────────────────────────────────────────── */
.admin-contact-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
}
.admin-contact-card .contact-name {
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 2px;
}
.admin-contact-card .contact-role {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
}
.admin-contact-card .contact-detail {
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

/* ── Modal ──────────────────────────────────────────────────── */
.admin-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: rgba(0, 0, 0, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.admin-modal {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 10px;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.admin-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #1e293b;
}
.admin-modal-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #e2e8f0;
}
.admin-modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.admin-modal-close:hover { color: #e2e8f0; }
.admin-modal-body {
    padding: 20px;
}
.admin-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid #1e293b;
}

/* ── Form Elements ──────────────────────────────────────────── */
.admin-form-group {
    margin-bottom: 14px;
}
.admin-form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 5px;
}
.admin-form-input,
.admin-form-select,
.admin-form-textarea {
    width: 100%;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 8px 12px;
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
    transition: border-color .2s;
    box-sizing: border-box;
}
.admin-form-input:focus,
.admin-form-select:focus,
.admin-form-textarea:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, .15);
}
.admin-form-textarea { resize: vertical; min-height: 80px; }
.admin-form-input::placeholder,
.admin-form-textarea::placeholder { color: #64748b; }
.admin-form-select option { background: #1e293b; }

.admin-form-row {
    display: flex;
    gap: 12px;
}
.admin-form-row .admin-form-group { flex: 1; }

.admin-form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #cbd5e1;
    cursor: pointer;
}
.admin-form-check input[type="checkbox"] {
    accent-color: #38bdf8;
    width: 16px;
    height: 16px;
}

/* ── Colour Picker ──────────────────────────────────────────── */
.admin-color-input {
    width: 40px;
    height: 32px;
    border: 1px solid #334155;
    border-radius: 6px;
    background: #1e293b;
    cursor: pointer;
    padding: 2px;
}

/* ── Range Slider ───────────────────────────────────────────── */
.admin-form-range {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: #334155;
    border-radius: 2px;
    outline: none;
}
.admin-form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #38bdf8;
    border-radius: 50%;
    cursor: pointer;
}

/* ── Empty State ────────────────────────────────────────────── */
.admin-empty {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
    font-size: 13px;
}
.admin-empty i {
    display: block;
    font-size: 32px;
    margin-bottom: 12px;
    opacity: .5;
}

/* ── Loading spinner ────────────────────────────────────────── */
.admin-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #64748b;
    gap: 10px;
    font-size: 13px;
}
.admin-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #334155;
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: admin-spin .6s linear infinite;
}
@keyframes admin-spin { to { transform: rotate(360deg); } }

/* ── AOI Map in Admin ───────────────────────────────────────── */
.admin-aoi-map {
    width: 100%;
    height: 320px;
    border-radius: 8px;
    border: 1px solid #1e293b;
    margin-bottom: 16px;
}

/* ── Inline Module Badges ───────────────────────────────────── */
.admin-module-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ── Toast (reuses app container) ───────────────────────────── */
.admin-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    border: 1px solid #1e293b;
    color: #e2e8f0;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    animation: admin-toast-in .3s ease;
}
.admin-toast.success { border-left: 3px solid #22c55e; }
.admin-toast.error   { border-left: 3px solid #ef4444; }
@keyframes admin-toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Logo in client list ────────────────────────────────────── */
.admin-client-logo {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: contain;
    background: #1e293b;
}

/* ── Toggle switch (admin version) ──────────────────────────── */
.admin-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}
.admin-toggle input { opacity: 0; width: 0; height: 0; }
.admin-toggle .slider {
    position: absolute;
    inset: 0;
    background: #334155;
    border-radius: 20px;
    cursor: pointer;
    transition: background .2s;
}
.admin-toggle .slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    bottom: 3px;
    background: #e2e8f0;
    border-radius: 50%;
    transition: transform .2s;
}
.admin-toggle input:checked + .slider { background: #38bdf8; }
.admin-toggle input:checked + .slider::before { transform: translateX(16px); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        left: -240px;
        top: 52px;
        bottom: 0;
        z-index: 9100;
        transition: left .25s;
    }
    .admin-sidebar.open { left: 0; }
    .admin-main { padding: 16px; }
    .admin-page-header { flex-wrap: wrap; gap: 10px; }
    .admin-topbar-menu-btn { display: inline-flex !important; }
    .admin-modal { max-width: 95vw; }
}
@media (min-width: 769px) {
    .admin-topbar-menu-btn { display: none !important; }
}

/* ── Mobile menu button ─────────────────────────────────────── */
.admin-topbar-menu-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    margin-right: 10px;
}

/* ── User bar admin button ──────────────────────────────────── */
#btn-admin {
    /* Inherits user-bar-icon styles from app.css */
}

/* ── Scrollbar styling ──────────────────────────────────────── */
.admin-sidebar::-webkit-scrollbar,
.admin-main::-webkit-scrollbar {
    width: 6px;
}
.admin-sidebar::-webkit-scrollbar-thumb,
.admin-main::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}
.admin-sidebar::-webkit-scrollbar-track,
.admin-main::-webkit-scrollbar-track {
    background: transparent;
}
