/* =========================================================================
   Lattakia Guide CMS — modern, friendly admin theme
   Brand: navy + sea (matches the public guide). Soft surfaces, gentle
   shadows, rounded corners, calm spacing. All class names used by the
   .razor pages are preserved; new helpers are additive.
   ========================================================================= */

:root {
    --navy: #0f2f4c;
    --navy-700: #163f63;
    --sea: #1b6ca8;
    --sea-600: #1a78bd;
    --sea-light: #e8f1f8;
    --sea-tint: #f2f8fc;
    --sand: #f4f6f9;
    --ink: #1d2733;
    --muted: #5b6b7a;
    --muted-soft: #8595a4;
    --line: #e4e9ef;
    --line-soft: #eef2f6;
    --danger: #c0392b;
    --danger-bg: #fdecea;
    --warn: #b9770e;
    --warn-bg: #fdf4e3;
    --ok: #2e7d4f;
    --ok-bg: #e8f5ed;
    --accent: #1FA4B8;

    --radius: 14px;
    --radius-sm: 9px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(15, 47, 76, .06), 0 1px 3px rgba(15, 47, 76, .05);
    --shadow-md: 0 4px 14px rgba(15, 47, 76, .08);
    --shadow-lg: 0 18px 48px rgba(15, 47, 76, .16);
    --ring: 0 0 0 3px rgba(27, 108, 168, .22);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--sand);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 .35rem; color: var(--navy); }
h2 { font-size: 1.12rem; font-weight: 700; margin: 1.5rem 0 .6rem; color: var(--navy); }
a { color: var(--sea); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--line-soft); padding: .08em .4em; border-radius: 5px; font-size: .85em; }

/* ---- Shell ------------------------------------------------------------- */
.cms-shell {
    display: grid;
    grid-template-columns: 252px 1fr;
    grid-template-rows: 60px 1fr;
    min-height: 100vh;
}

.cms-topbar {
    grid-column: 1 / -1;
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(100deg, var(--navy) 0%, var(--navy-700) 60%, var(--sea) 160%);
    color: #fff; padding: 0 1.5rem; height: 60px;
    box-shadow: var(--shadow-sm);
    position: sticky; top: 0; z-index: 20;
}
.cms-brand { display: flex; align-items: center; gap: .65rem; color: #fff; font-weight: 700; }
.cms-brand:hover { text-decoration: none; }
.cms-brand-mark {
    background: linear-gradient(140deg, var(--sea), var(--accent));
    width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center; font-size: .82rem; font-weight: 800; letter-spacing: .02em;
    box-shadow: 0 4px 12px rgba(31, 164, 184, .35);
}
.cms-brand-text { line-height: 1.05; display: flex; flex-direction: column; }
.cms-brand-text small { opacity: .7; font-weight: 600; font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; }
.cms-logout { display: flex; align-items: center; gap: .85rem; margin: 0; }
.cms-user {
    font-size: .82rem; opacity: .92;
    display: inline-flex; align-items: center; gap: .45rem;
}
.cms-user::before {
    content: ""; width: 26px; height: 26px; border-radius: 50%;
    background: rgba(255,255,255,.18); display: inline-block;
    background-image: radial-gradient(circle at 50% 38%, rgba(255,255,255,.9) 0 30%, transparent 31%), radial-gradient(circle at 50% 105%, rgba(255,255,255,.9) 0 45%, transparent 46%);
}

/* ---- Sidebar nav ------------------------------------------------------- */
.cms-nav {
    grid-row: 2; background: #fff; border-inline-end: 1px solid var(--line);
    padding: 1rem .7rem; display: flex; flex-direction: column; gap: 3px;
    overflow-y: auto;
}
.cms-nav-section {
    font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted-soft); padding: .9rem .8rem .35rem; margin: 0;
}
.cms-nav-link {
    display: flex; align-items: center; gap: .7rem; padding: .58rem .8rem;
    border-radius: var(--radius-sm); color: var(--ink); font-weight: 500;
    transition: background .14s ease, color .14s ease, transform .05s ease;
}
.cms-nav-link:hover { background: var(--sea-light); text-decoration: none; }
.cms-nav-link:active { transform: translateY(1px); }
.cms-nav-link.active {
    background: linear-gradient(100deg, var(--sea), var(--sea-600));
    color: #fff; box-shadow: 0 6px 16px rgba(27, 108, 168, .28);
}
.cms-nav-link.active .cms-nav-ico { opacity: 1; }
.cms-nav-ico {
    width: 1.35rem; height: 1.35rem; flex: none; display: grid; place-items: center;
    font-size: 1rem; opacity: .7;
}

/* ---- Main -------------------------------------------------------------- */
.cms-main { grid-row: 2; overflow: auto; }
.cms-content { padding: 2rem 2.25rem 3.5rem; max-width: 1040px; }
.page-sub { color: var(--muted); margin: 0 0 1.25rem; max-width: 70ch; }

/* ---- Cards & surfaces -------------------------------------------------- */
.card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.4rem 1.5rem; margin-bottom: 1.15rem; box-shadow: var(--shadow-sm);
}
.card > h2:first-child, .card > h1:first-child { margin-top: 0; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.stat {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.25rem 1.35rem; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::before {
    content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px;
    background: linear-gradient(var(--sea), var(--accent));
}
.stat .n { font-size: 2.1rem; font-weight: 800; color: var(--navy); line-height: 1; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: .82rem; margin-top: .4rem; font-weight: 500; }
.stat.warn::before { background: linear-gradient(var(--warn), #e0a44a); }
.stat.warn .n { color: var(--warn); }

/* ---- Tables ------------------------------------------------------------ */
table {
    width: 100%; border-collapse: separate; border-spacing: 0; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow-sm);
}
th, td { text-align: start; padding: .7rem .95rem; border-bottom: 1px solid var(--line-soft); }
th {
    background: var(--sea-tint); font-size: .72rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--muted); font-weight: 700;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s ease; }
tbody tr:hover td { background: var(--sea-tint); }

/* ---- Forms ------------------------------------------------------------- */
.field { margin-bottom: 1.1rem; }
.field > label { display: block; font-weight: 600; font-size: .84rem; margin-bottom: .35rem; color: var(--navy); }
.field .hint { color: var(--muted); font-size: .78rem; margin-top: .3rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
input[type=text], input[type=number], input[type=password], input[type=url], input[type=email], select, textarea {
    width: 100%; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
    font: inherit; color: var(--ink); background: #fff; transition: border-color .14s ease, box-shadow .14s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted-soft); }
textarea { resize: vertical; min-height: 4.5rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sea); box-shadow: var(--ring); }
.ar input, .ar textarea { direction: rtl; }
.inline-check { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.inline-check input { width: auto; accent-color: var(--sea); }

/* ---- Buttons ----------------------------------------------------------- */
.cms-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem; cursor: pointer;
    border: 1px solid transparent; border-radius: var(--radius-sm); padding: .58rem 1.05rem;
    font: inherit; font-weight: 600; background: var(--sea); color: #fff;
    box-shadow: 0 2px 6px rgba(27, 108, 168, .25);
    transition: filter .14s ease, transform .05s ease, box-shadow .14s ease;
}
.cms-btn:hover { filter: brightness(1.07); text-decoration: none; box-shadow: 0 4px 12px rgba(27, 108, 168, .32); }
.cms-btn:active { transform: translateY(1px); }
.cms-btn:disabled { opacity: .55; cursor: default; box-shadow: none; filter: none; }
.cms-btn-ghost { background: transparent; border-color: rgba(255,255,255,.45); color: #fff; box-shadow: none; }
.cms-btn-ghost:hover { background: rgba(255,255,255,.12); filter: none; box-shadow: none; }
.cms-btn-outline { background: #fff; color: var(--sea); border-color: var(--line); box-shadow: var(--shadow-sm); }
.cms-btn-outline:hover { border-color: var(--sea); background: var(--sea-tint); filter: none; }
.cms-btn-danger { background: var(--danger); box-shadow: 0 2px 6px rgba(192, 57, 43, .25); }
.cms-btn-sm { padding: .36rem .7rem; font-size: .8rem; }
.toolbar { display: flex; gap: .65rem; align-items: center; margin: 1.15rem 0; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---- Badges & alerts --------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem;
    border-radius: 999px; font-size: .72rem; font-weight: 700; line-height: 1.2;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.muted { background: var(--line-soft); color: var(--muted); }
.alert {
    border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1.1rem; font-size: .9rem;
    display: flex; align-items: flex-start; gap: .6rem;
}
.alert.error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f3c9c3; }
.alert.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe3cd; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0dcb4; }

/* ---- Hero / welcome ---------------------------------------------------- */
.welcome {
    background: linear-gradient(115deg, var(--navy) 0%, var(--sea) 100%);
    color: #fff; border-radius: var(--radius-lg); padding: 1.75rem 2rem; margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.welcome::after {
    content: ""; position: absolute; inset-block: -40%; inset-inline-end: -10%;
    width: 320px; background: radial-gradient(circle, rgba(255,255,255,.14), transparent 70%);
}
.welcome h1 { color: #fff; font-size: 1.7rem; margin: 0 0 .35rem; }
.welcome p { margin: 0; opacity: .9; max-width: 60ch; }

/* ---- Login ------------------------------------------------------------- */
.login-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background: linear-gradient(150deg, var(--navy) 0%, var(--sea) 70%, var(--accent) 140%);
}
.login-card {
    background: #fff; border-radius: var(--radius-lg); padding: 2.25rem 2.25rem 2rem;
    width: 360px; box-shadow: var(--shadow-lg);
}
.login-card h1 { text-align: center; }
.login-brand {
    width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 1rem;
    background: linear-gradient(140deg, var(--sea), var(--accent));
    display: grid; place-items: center; color: #fff; font-weight: 800; letter-spacing: .02em;
    box-shadow: 0 8px 20px rgba(31, 164, 184, .4);
}
.login-sub { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: 1.5rem; }

/* ---- Misc -------------------------------------------------------------- */
.muted { color: var(--muted); }
.repeater-item {
    border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem;
    margin-bottom: .85rem; background: var(--sea-tint); position: relative;
}
.repeater-item .rm { position: absolute; inset-inline-end: .7rem; top: .7rem; }

/* ---- Import: drop zone & helpers -------------------------------------- */
.dropzone {
    border: 2px dashed var(--line); border-radius: var(--radius);
    padding: 2.25rem 1.5rem; text-align: center; background: var(--sea-tint);
    transition: border-color .14s ease, background .14s ease; cursor: pointer; position: relative;
}
.dropzone:hover { border-color: var(--sea); background: var(--sea-light); }
.dropzone .dz-ico { font-size: 2.4rem; line-height: 1; margin-bottom: .5rem; }
.dropzone .dz-title { font-weight: 700; color: var(--navy); }
.dropzone .dz-hint { color: var(--muted); font-size: .85rem; margin-top: .35rem; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.format-pills { display: flex; gap: .5rem; flex-wrap: wrap; margin: .4rem 0 0; }
.format-pill {
    font-size: .72rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px;
    background: #fff; border: 1px solid var(--line); color: var(--muted);
}

.import-row-new td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.import-row-update td:first-child { box-shadow: inset 3px 0 0 var(--sea); }
.import-row-error td { background: var(--danger-bg) !important; }
.import-row-error td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

.steps { display: flex; gap: .5rem; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: .5rem; color: var(--muted-soft); font-weight: 600; font-size: .85rem; }
.step .step-n {
    width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    background: var(--line-soft); color: var(--muted); font-size: .78rem;
}
.step.active { color: var(--navy); }
.step.active .step-n { background: var(--sea); color: #fff; }
.step.done .step-n { background: var(--ok); color: #fff; }
.step-sep { width: 28px; height: 2px; background: var(--line); border-radius: 2px; }

/* ---- Blazor error UI --------------------------------------------------- */
#blazor-error-ui {
    background: #fff3cd; color: #664d03; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 820px) {
    .cms-shell { grid-template-columns: 1fr; grid-template-rows: 60px auto 1fr; }
    .cms-nav { grid-row: 2; flex-direction: row; flex-wrap: wrap; border-inline-end: none; border-bottom: 1px solid var(--line); }
    .cms-nav-section { width: 100%; padding: .4rem .8rem .1rem; }
    .cms-main { grid-row: 3; }
    .cms-content { padding: 1.5rem 1.25rem 3rem; }
    .row2, .row3 { grid-template-columns: 1fr; }
}
