/* لوحة الإدارة بهوية "شراع المكلا" نفسها (docs/brand/tokens.json): قائمة جانبية على اليمين، والمحتوى جداول قابلة للمسح */

@font-face {
    font-family: "Readex Pro";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/readex-pro-arabic.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
    font-family: "Readex Pro";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/readex-pro-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --color-bg: #f5f9fb;
    --color-surface: #ffffff;
    --color-text: #0b1f2a;
    --color-muted: #5a6e78;
    --color-border: #dce7ec;
    --color-soft: #e4eef2;
    --color-primary: #0f4c6b;
    --color-primary-text: #ffffff;
    --color-accent: #f07a55;
    --color-success: #13795b;
    --color-danger: #b3261e;
    --color-danger-soft: #fdecea;
    --radius: 12px;
    --font: "Readex Pro", "Segoe UI", Tahoma, system-ui, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    font-size: 15px;
}

a {
    color: var(--color-primary);
}

h1 {
    font-size: 1.5rem;
    margin: 0 0 12px;
}

h1:focus {
    outline: none;
}

h2 {
    font-size: 1.1rem;
    margin: 24px 0 10px;
}

p {
    margin: 0 0 10px;
}

.muted {
    color: var(--color-muted);
}

.nowrap {
    white-space: nowrap;
}

.boot {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--color-muted);
}

/* الهيكل */

.shell {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: var(--color-primary);
    color: var(--color-primary-text);
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 14px;
    border-inline-start: 3px solid var(--color-accent);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav a {
    color: inherit;
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 8px;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav a.active {
    background: var(--color-surface);
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-user {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.9rem;
}

.sidebar-user .muted {
    color: #b9d0dc;
}

.sidebar-user .link-button {
    color: var(--color-primary-text);
    align-self: flex-start;
}

.content {
    padding: 24px 28px 48px;
    min-width: 0;
}

@media (max-width: 860px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px 16px;
        padding: 12px 16px;
        border-inline-start: 0;
        border-bottom: 3px solid var(--color-accent);
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        order: 3;
        width: 100%;
    }

    .sidebar-nav a {
        white-space: nowrap;
    }

    .sidebar-user {
        margin-top: 0;
        margin-inline-start: auto;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .content {
        padding: 18px 16px 40px;
    }
}

/* الأزرار والنماذج */

.button,
.button-danger,
.button-secondary {
    font: inherit;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 16px;
    cursor: pointer;
    border: 1px solid transparent;
}

.button {
    background: var(--color-primary);
    color: var(--color-primary-text);
}

.button-danger {
    background: var(--color-danger);
    color: #ffffff;
}

.button-secondary {
    background: var(--color-surface);
    color: var(--color-primary);
    border-color: var(--color-border);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.link-button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--color-primary);
    text-decoration: underline;
    cursor: pointer;
}

.link-danger {
    color: var(--color-danger);
}

input, select, textarea {
    font: inherit;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    color: var(--color-text);
}

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.input-ltr {
    text-align: left;
}

.input-code {
    letter-spacing: 0.4em;
    font-size: 1.2rem;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form label {
    font-weight: 600;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.filters input[type=search],
.filters input[type=tel] {
    flex: 1 1 220px;
    min-width: 0;
}

.form-error {
    background: var(--color-danger-soft);
    border: 1px solid #f5c2bd;
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--color-danger);
}

.notice {
    background: var(--color-soft);
    border-radius: var(--radius);
    padding: 10px 14px;
}

/* الدخول */

.blank {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-card h1 {
    font-size: 1.3rem;
    margin: 0;
}

/* الأرقام */

.stat-group h2 {
    margin-top: 8px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: inherit;
    text-decoration: none;
}

a.stat:hover {
    border-color: var(--color-primary);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
}

.stat-attention .stat-value {
    color: var(--color-danger);
}

.stat-label {
    color: var(--color-muted);
    font-size: 0.9rem;
}

/* الجداول */

.table-wrap {
    overflow-x: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

th, td {
    text-align: right;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

th {
    font-weight: 500;
    color: var(--color-muted);
    font-size: 0.85rem;
    background: var(--color-bg);
}

tr:last-child td {
    border-bottom: 0;
}

.cell-sub {
    display: block;
    font-size: 0.82rem;
}

.row-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.row-title img {
    width: 48px;
    height: 36px;
    object-fit: cover;
    border-radius: 6px;
    flex: none;
}

.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
}

.badge {
    display: inline-block;
    padding: 1px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-active {
    background: #dff3ea;
    color: var(--color-success);
}

.badge-sold {
    background: var(--color-soft);
    color: var(--color-primary);
}

.badge-hidden {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.badge-removed {
    background: #eceff1;
    color: var(--color-muted);
}

/* صفحات التفاصيل */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.page-head h1 {
    margin: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
}

.panel h2 {
    margin-top: 0;
}

.panel-attention {
    background: var(--color-danger-soft);
    border-color: #f5c2bd;
    margin-bottom: 14px;
}

.facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px 14px;
    margin: 0 0 10px;
}

.facts dt {
    color: var(--color-muted);
}

.facts dd {
    margin: 0;
}

.ltr-cell {
    text-align: right;
}

.description {
    white-space: pre-line;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.gallery img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
}

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

.reason-form label {
    font-weight: 600;
}

.reason-form .actions {
    display: flex;
    gap: 8px;
}

/* خطأ غير متوقع من Blazor */

#blazor-error-ui {
    background: #fff4e5;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    left: 0.75rem;
    top: 0.5rem;
}

@media (prefers-reduced-motion: no-preference) {
    .sidebar-nav a, a.stat {
        transition: background-color 0.15s, border-color 0.15s;
    }
}
