/* =========================================================
   Locations Admin — Colorful RTL Arabic Design System
   Self-contained (no build step needed). Served from /public.
   ========================================================= */

:root {
    --font: 'Cairo', 'Segoe UI', Tahoma, sans-serif;

    --brand-1: #6d28d9;   /* violet-700 */
    --brand-2: #4f46e5;   /* indigo-600 */
    --brand-3: #2563eb;   /* blue-600  */

    --ink: #1e2440;
    --ink-soft: #5b6478;
    --muted: #8a93a6;
    --line: #e9ecf5;
    --bg: #eef1f9;
    --card: #ffffff;

    --emerald: #059669;
    --emerald-soft: #d1fae5;
    --amber: #d97706;
    --amber-soft: #fef3c7;
    --rose: #e11d48;
    --rose-soft: #ffe4e6;
    --sky: #0284c7;
    --sky-soft: #e0f2fe;
    --violet-soft: #ede9fe;

    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 10px 30px -12px rgba(31, 41, 84, .25);
    --shadow-sm: 0 4px 14px -8px rgba(31, 41, 84, .35);
    --shadow-lg: 0 24px 50px -20px rgba(79, 70, 229, .45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.app-body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 100% -10%, #e5ddff 0, transparent 55%),
        radial-gradient(1000px 500px at -10% 10%, #d9ecff 0, transparent 45%),
        var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 268px;
    flex-shrink: 0;
    color: #eae7ff;
    background: linear-gradient(200deg, #2a1466 0%, #4321a0 45%, #3b2bb3 100%);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 40;
}

.app-brand {
    padding: 22px 22px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.app-brand .logo {
    width: 44px; height: 44px;
    border-radius: 14px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #a78bfa, #38bdf8);
    box-shadow: 0 8px 20px -6px rgba(56, 189, 248, .7);
    flex-shrink: 0;
}
.app-brand .logo svg { width: 24px; height: 24px; color: #fff; }
.app-brand .title { font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.app-brand .subtitle { font-size: .72rem; color: #b9b1f0; margin-top: 2px; }

.app-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; }
.app-nav .section-label {
    font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
    color: #9d94e0; padding: 12px 12px 6px;
}
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 13px;
    border-radius: 13px;
    font-size: .92rem; font-weight: 600;
    color: #d5cff5;
    transition: all .18s ease;
    position: relative;
}
.nav-link svg { width: 20px; height: 20px; flex-shrink: 0; opacity: .85; }
.nav-link:hover { background: rgba(255, 255, 255, .09); color: #fff; transform: translateX(-3px); }
.nav-link.active {
    background: linear-gradient(120deg, rgba(167, 139, 250, .28), rgba(56, 189, 248, .22));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.nav-link.active::before {
    content: ""; position: absolute; inset-inline-start: -12px; top: 50%; transform: translateY(-50%);
    width: 5px; height: 60%; border-radius: 0 6px 6px 0;
    background: linear-gradient(#a78bfa, #38bdf8);
}
.nav-link.active svg { opacity: 1; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    position: sticky; top: 0; z-index: 30;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    padding: 12px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.app-topbar .page-title { font-weight: 800; font-size: 1.05rem; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-chip {
    display: flex; align-items: center; gap: 10px;
    background: var(--violet-soft); color: var(--brand-1);
    padding: 6px 12px 6px 6px; border-radius: 999px; font-weight: 700; font-size: .85rem;
}
.user-chip .avatar {
    width: 30px; height: 30px; border-radius: 999px;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
    color: #fff; display: grid; place-items: center; font-size: .8rem;
}

.icon-btn {
    display: grid; place-items: center;
    width: 40px; height: 40px; border-radius: 12px;
    background: #fff; border: 1px solid var(--line); color: var(--ink-soft);
    cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
.menu-toggle { display: none; }

.app-content { padding: 24px 20px 40px; }
@media (min-width: 768px) { .app-content { padding: 28px; } }

/* ---------- Page header ---------- */
.page-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 14px; margin-bottom: 22px;
}
.page-head h1 { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; }
.page-head .sub { color: var(--ink-soft); font-size: .9rem; margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 12px; border: none; cursor: pointer;
    font-family: var(--font); font-weight: 700; font-size: .9rem; line-height: 1;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn-primary {
    color: #fff;
    background: linear-gradient(120deg, var(--brand-1), var(--brand-3));
    box-shadow: var(--shadow-lg);
}
.btn-primary:hover { box-shadow: 0 26px 44px -18px rgba(79, 70, 229, .65); transform: translateY(-1px); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: #cdd3e6; }
.btn-success { color: #fff; background: linear-gradient(120deg, #059669, #10b981); box-shadow: 0 16px 30px -16px rgba(5, 150, 105, .7); }
.btn-danger-soft { background: var(--rose-soft); color: var(--rose); }
.btn-sm { padding: 7px 12px; font-size: .82rem; border-radius: 10px; }

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(233, 236, 245, .8);
    overflow: hidden;
}
.card-pad { padding: 20px; }
.card-head {
    padding: 16px 20px; border-bottom: 1px solid var(--line);
    font-weight: 800; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 16px; margin-bottom: 26px; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

.stat {
    position: relative; overflow: hidden;
    border-radius: var(--radius);
    padding: 20px;
    color: #fff;
    box-shadow: var(--shadow);
}
.stat .stat-icon {
    position: absolute; inset-inline-end: 16px; top: 16px;
    width: 46px; height: 46px; border-radius: 14px;
    background: rgba(255, 255, 255, .22);
    display: grid; place-items: center;
}
.stat .stat-icon svg { width: 24px; height: 24px; color: #fff; }
.stat .stat-label { font-size: .86rem; opacity: .92; font-weight: 600; }
.stat .stat-value { font-size: 2.1rem; font-weight: 800; margin-top: 6px; line-height: 1.1; }
.stat .stat-value small { font-size: .8rem; font-weight: 600; opacity: .85; }
.stat::after {
    content: ""; position: absolute; inset-inline-start: -30px; bottom: -40px;
    width: 130px; height: 130px; border-radius: 50%;
    background: rgba(255, 255, 255, .12);
}
.stat.g-violet { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.stat.g-blue   { background: linear-gradient(135deg, #2563eb, #38bdf8); }
.stat.g-emerald{ background: linear-gradient(135deg, #059669, #34d399); }
.stat.g-amber  { background: linear-gradient(135deg, #ea580c, #f59e0b); }
.stat.g-rose   { background: linear-gradient(135deg, #e11d48, #fb7185); }

/* ---------- Filters bar ---------- */
.filter-bar {
    display: grid; grid-template-columns: repeat(1, 1fr); gap: 12px;
    margin-bottom: 18px;
}
@media (min-width: 768px) { .filter-bar.cols-4 { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) { .filter-bar.inline { display: flex; flex-wrap: wrap; } }

.field label { display: block; font-size: .8rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.input, .select, select.select, input.input {
    width: 100%;
    font-family: var(--font); font-size: .9rem; color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 13px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, select.select:focus, input.input:focus {
    outline: none; border-color: #b3a5f0; box-shadow: 0 0 0 4px rgba(109, 40, 217, .12);
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table thead th {
    text-align: start; font-weight: 700; color: var(--ink-soft);
    background: #f6f7fc;
    padding: 13px 16px; white-space: nowrap;
    border-bottom: 1px solid var(--line);
    font-size: .82rem;
}
.table tbody td { padding: 13px 16px; border-bottom: 1px solid #f1f3fa; vertical-align: middle; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #faf9ff; }
.table tbody tr:last-child td { border-bottom: none; }
.table .row-link { color: var(--brand-2); font-weight: 700; }
.table .actions { display: flex; gap: 8px; white-space: nowrap; }
.link-action { color: var(--brand-2); font-weight: 700; font-size: .85rem; }
.link-muted { color: var(--ink-soft); font-weight: 700; font-size: .85rem; }
.link-danger { color: var(--rose); font-weight: 700; font-size: .85rem; background: none; border: none; cursor: pointer; font-family: var(--font); }

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

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 11px; border-radius: 999px; font-size: .76rem; font-weight: 700;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--emerald-soft); color: var(--emerald); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-info { background: var(--sky-soft); color: var(--sky); }
.badge-violet { background: var(--violet-soft); color: var(--brand-1); }
.badge-rose { background: var(--rose-soft); color: var(--rose); }
.badge-muted { background: #eef1f7; color: var(--ink-soft); }

/* ---------- Alerts ---------- */
.alert { border-radius: 14px; padding: 13px 16px; margin-bottom: 18px; font-weight: 600; font-size: .9rem; display: flex; gap: 10px; align-items: flex-start; }
.alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--emerald-soft); color: #065f46; }
.alert-error { background: var(--rose-soft); color: #9f1239; }
.alert ul { margin: 0; padding-inline-start: 18px; }

/* ---------- Definition list (show page) ---------- */
.def-list { display: grid; grid-template-columns: 1fr; gap: 2px; }
.def-row { display: flex; gap: 10px; padding: 11px 4px; border-bottom: 1px dashed #eceffa; }
.def-row:last-child { border-bottom: none; }
.def-row .k { color: var(--muted); min-width: 120px; font-size: .85rem; font-weight: 600; }
.def-row .v { font-weight: 700; }

/* ---------- Attachments ---------- */
.attach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 768px) { .attach-grid { grid-template-columns: repeat(4, 1fr); } }
.attach-item {
    border: 1px solid var(--line); border-radius: 14px; padding: 12px;
    display: flex; flex-direction: column; gap: 6px; background: #fff;
    transition: box-shadow .15s ease, transform .15s ease;
}
.attach-item:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.attach-item .fname { font-size: .82rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-item .frow { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }

/* ---------- Report cards ---------- */
.report-grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 16px; }
@media (min-width: 640px) { .report-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .report-grid { grid-template-columns: repeat(3, 1fr); } }
.report-card {
    display: flex; align-items: center; gap: 14px;
    background: #fff; border-radius: var(--radius); padding: 18px;
    box-shadow: var(--shadow); border: 1px solid rgba(233, 236, 245, .8);
    transition: transform .15s ease, box-shadow .15s ease;
}
.report-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.report-card .r-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; }
.report-card .r-icon svg { width: 24px; height: 24px; color: #fff; }
.report-card .r-title { font-weight: 800; }
.report-card .r-sub { font-size: .82rem; color: var(--ink-soft); margin-top: 2px; }
.ic-violet { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.ic-blue { background: linear-gradient(135deg, #2563eb, #38bdf8); }
.ic-emerald { background: linear-gradient(135deg, #059669, #34d399); }
.ic-amber { background: linear-gradient(135deg, #ea580c, #f59e0b); }
.ic-rose { background: linear-gradient(135deg, #e11d48, #fb7185); }
.ic-sky { background: linear-gradient(135deg, #0284c7, #38bdf8); }

/* ---------- Form grid ---------- */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); } }
.form-grid .col-span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ---------- Pagination (Laravel Tailwind fallback) ---------- */
.pagination-wrap { margin-top: 20px; }
.pagination-wrap nav > div:last-child span[aria-current] span,
.pagination-wrap nav a { border-radius: 10px !important; }

/* ---------- Map ---------- */
.map-canvas { height: 70vh; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }

/* ---------- Sidebar backdrop (mobile) ---------- */
.sidebar-backdrop { display: none; }

@media (max-width: 767px) {
    .app-sidebar {
        position: fixed; inset-block: 0; inset-inline-end: 0;
        transform: translateX(100%);
        transition: transform .25s ease;
        box-shadow: -20px 0 60px -20px rgba(0,0,0,.5);
    }
    .app-shell.nav-open .app-sidebar { transform: translateX(0); }
    .app-shell.nav-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0; z-index: 35;
        background: rgba(20, 12, 50, .5); backdrop-filter: blur(2px);
    }
    .menu-toggle { display: grid; }
}

/* ---------- Auth ---------- */
.auth-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 20px;
    background:
        radial-gradient(900px 500px at 90% -10%, #7c3aed 0, transparent 50%),
        radial-gradient(900px 500px at -10% 110%, #2563eb 0, transparent 50%),
        #1a1140;
}
.auth-card {
    width: 100%; max-width: 420px;
    background: rgba(255,255,255,.97);
    border-radius: 24px; padding: 34px 30px;
    box-shadow: 0 40px 80px -30px rgba(0,0,0,.6);
}
.auth-logo {
    width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 14px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
    box-shadow: var(--shadow-lg);
}
.auth-logo svg { width: 32px; height: 32px; color: #fff; }
.auth-card h1 { text-align: center; font-size: 1.4rem; font-weight: 800; margin: 0 0 4px; }
.auth-card .auth-sub { text-align: center; color: var(--ink-soft); font-size: .88rem; margin-bottom: 22px; }
.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 6px; }
.auth-error { color: var(--rose); font-size: .8rem; margin-top: 6px; font-weight: 600; }
.auth-status { background: var(--emerald-soft); color: #065f46; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-size: .85rem; font-weight: 600; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 20px; font-size: .85rem; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-weight: 600; }
