/* Malek Center — admin UI (RTL, no build step) */
:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #f8fafb;
    --border: #e2e7ec;
    --text: #1d2733;
    --muted: #64707d;
    --primary: #0f5fa8;
    --primary-hover: #0c4f8c;
    --primary-soft: #e7f0f9;
    --success: #1a7f4b;
    --success-soft: #e5f5ec;
    --warning: #a35c00;
    --warning-soft: #fdf1df;
    --danger: #b42318;
    --danger-soft: #fdeceb;
    --info: #3b4fb8;
    --info-soft: #eceffc;
    --sidebar: #12263a;
    --sidebar-text: #c9d5e1;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, "Noto Kufi Arabic", "Geeza Pro", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.3; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: embed; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text);
    padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { color: #fff; font-weight: 700; font-size: 1.1rem; padding: .25rem .5rem 1rem; display: block; }
.brand small { display: block; font-weight: 400; color: var(--sidebar-text); font-size: .78rem; }
.nav a {
    display: block; color: var(--sidebar-text); padding: .5rem .75rem; border-radius: 8px; margin-bottom: 2px;
}
.nav a:hover { background: rgba(255, 255, 255, .07); text-decoration: none; color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav .section { font-size: .75rem; text-transform: uppercase; opacity: .6; padding: .9rem .75rem .25rem; }
.main { flex: 1; min-width: 0; }
.topbar {
    background: var(--surface); border-bottom: 1px solid var(--border); padding: .6rem 1.25rem;
    display: flex; align-items: center; gap: 1rem; justify-content: space-between;
}
.topbar form.search { flex: 1; max-width: 420px; }
.topbar .user { display: flex; align-items: center; gap: .75rem; }
.menu-toggle { display: none; }
.content { padding: 1.25rem; max-width: 1280px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Cards & grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: .75rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.45rem; font-weight: 700; }
.stat .hint { font-size: .8rem; color: var(--muted); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); padding: .45rem .9rem; border-radius: 8px; font: inherit; font-size: .92rem; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.95); background: var(--success); }
.btn-danger { background: var(--surface); border-color: #f1b8b3; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: .25rem .6rem; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.inline { display: inline; }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.field { margin-bottom: .85rem; }
.field .hint { font-size: .8rem; color: var(--muted); font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
input[type=tel], input[type=search], input[type=month], select, textarea {
    width: 100%; padding: .5rem .65rem; border: 1px solid #cfd6dd; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.error { color: var(--danger); font-size: .85rem; margin-top: .2rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.checkbox input { width: auto; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 140px; }
.filters .grow { flex: 1; min-width: 200px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); text-align: right; vertical-align: middle; }
.table th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .82rem; white-space: nowrap; }
.table tbody tr:hover { background: #fafcfe; }
.table td.actions { white-space: nowrap; text-align: left; }
.table tfoot td { font-weight: 700; background: var(--surface-2); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
dl.details { display: grid; grid-template-columns: 150px 1fr; gap: .35rem 1rem; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; }

/* Badges & alerts */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-primary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }

/* Pagination */
.pagination { display: flex; gap: .25rem; list-style: none; padding: 0; margin: 1rem 0 0; flex-wrap: wrap; }
.pagination a, .pagination span { display: block; padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.pagination .active span { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled span { color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .9rem; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs a.active { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth .card { width: 100%; max-width: 380px; padding: 1.75rem; }

.photos { display: flex; gap: .5rem; flex-wrap: wrap; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

@media (max-width: 900px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .shell { display: block; }
    .sidebar { position: fixed; inset: 0 0 0 auto; z-index: 20; transform: translateX(100%); transition: transform .2s; height: 100vh; }
    .sidebar.open { transform: none; box-shadow: -8px 0 24px rgba(0, 0, 0, .2); }
    .menu-toggle { display: inline-flex; }
    .topbar { padding: .6rem 1rem; flex-wrap: wrap; }
    .topbar form.search { order: 3; max-width: none; flex-basis: 100%; }
    .content { padding: 1rem; }
    .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
    dl.details { grid-template-columns: 110px 1fr; }
}
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    body { background: #fff; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 0; }
}
