/**
 * هوية مستوحاة من QRCircle / Circle360
 * أزرق أساسي #0052FF — خلفيات فاتحة — Tajawal
 */

:root {
  --c360-blue: #0052ff;
  --c360-blue-hover: #0040cc;
  --c360-blue-soft: #e8efff;
  --c360-ink: #0f172a;
  --c360-muted: #64748b;
  --c360-border: #e2e8f0;
  --c360-surface: #ffffff;
  --c360-page: #f1f5f9;
  --c360-success: #059669;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 30px rgba(0, 82, 255, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --font: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--c360-ink);
  background: var(--c360-page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 120% 80% at 100% -20%, rgba(0, 82, 255, 0.12), transparent 50%),
    radial-gradient(ellipse 80% 60% at 0% 100%, rgba(0, 82, 255, 0.06), transparent 45%),
    linear-gradient(180deg, #eef2ff 0%, var(--c360-page) 35%, #f8fafc 100%);
  pointer-events: none;
}

/* ——— Top nav (مثل شريط منتج QRCircle) ——— */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c360-border);
  box-shadow: var(--shadow-sm);
}

.top-nav__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.brand__mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c360-blue) 0%, #3b82f6 100%);
  box-shadow: 0 2px 8px rgba(0, 82, 255, 0.35);
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.2;
}

.brand__name {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand__tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--c360-muted);
}

.top-nav__pill {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c360-blue);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--c360-blue-soft);
  border: 1px solid rgba(0, 82, 255, 0.15);
}

/* ——— Layout ——— */
.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

.card {
  background: var(--c360-surface);
  border: 1px solid var(--c360-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card--hero {
  padding: 1.75rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 82, 255, 0.08);
}

.hero__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--c360-ink);
}

.hero__badge {
  display: inline-block;
  margin-inline-start: 0.35rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.65em;
  font-weight: 700;
  vertical-align: middle;
  border-radius: 6px;
  background: var(--c360-blue-soft);
  color: var(--c360-blue);
  border: 1px solid rgba(0, 82, 255, 0.2);
}

.hero__lead {
  margin: 0;
  font-size: 1rem;
  color: var(--c360-muted);
  max-width: 58ch;
}

.hero__lead strong {
  color: var(--c360-ink);
}

/* ——— Notice ——— */
.notice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  border-inline-start: 4px solid #f59e0b;
  background: linear-gradient(90deg, #fffbeb 0%, #fff 40%);
}

.notice__icon {
  flex-shrink: 0;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: #fef3c7;
  color: #b45309;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.notice strong {
  color: var(--c360-ink);
}

/* ——— Settings panel ——— */
.settings-block {
  margin-bottom: 1rem;
  padding: 0.25rem 1.1rem 1rem;
  cursor: pointer;
}

.settings-block__summary {
  font-weight: 700;
  font-size: 1rem;
  color: var(--c360-blue);
  padding: 0.85rem 0;
  list-style-position: outside;
  cursor: pointer;
}

.settings-block__summary::-webkit-details-marker {
  color: var(--c360-blue);
}

.settings-inner {
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--c360-border);
  cursor: default;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin-bottom: 1rem;
}

.presets__label {
  font-size: 0.9rem;
  color: var(--c360-muted);
}

.data-page {
  margin-top: 0.25rem;
}

.data-toolbar {
  padding: 1.1rem 1.2rem;
  margin-bottom: 0.75rem;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1rem;
}

.search-field {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--c360-ink);
}

.search-field input[type="search"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--c360-border);
  background: #f8fafc;
  color: var(--c360-ink);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-field input[type="search"]:focus {
  outline: none;
  border-color: var(--c360-blue);
  box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.15);
  background: #fff;
}

.search-field input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.toolbar-check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--c360-muted);
  margin-bottom: 0.2rem;
  cursor: pointer;
}

.toolbar-check input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--c360-blue);
}

.export-btn {
  flex: 0 0 auto;
}

.toolbar-hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--c360-muted);
}

.toolbar-hint strong {
  color: var(--c360-ink);
}

.row-count {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--c360-blue);
}

/* ——— Pagination ——— */
.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
}

.pagination-bar[hidden] {
  display: none;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pg-info {
  font-size: 0.85rem;
  color: var(--c360-muted);
  min-width: 11rem;
  text-align: center;
  font-weight: 500;
}

.pg-size-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--c360-muted);
}

.pg-size-label select {
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c360-border);
  background: #fff;
  color: var(--c360-ink);
  font-family: inherit;
  font-weight: 500;
}

.pg-jump {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pg-jump input[type="number"] {
  width: 5.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c360-border);
  background: #fff;
  color: var(--c360-ink);
  font-family: inherit;
  font-weight: 500;
  font-size: 0.88rem;
}

.pg-jump input[type="number"]:focus {
  outline: none;
  border-color: var(--c360-blue);
  box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.12);
}

/* ——— Form grid ——— */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.85rem 1rem;
}

.grid label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c360-muted);
}

.grid input {
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c360-border);
  background: #f8fafc;
  color: var(--c360-ink);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.grid input:focus {
  outline: none;
  border-color: var(--c360-blue);
  box-shadow: 0 0 0 3px rgba(0, 82, 255, 0.12);
  background: #fff;
}

.span2 {
  grid-column: span 2;
}

@media (max-width: 640px) {
  .span2 {
    grid-column: span 1;
  }
}

.check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.1rem;
}

/* ——— Buttons ——— */
.btn {
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--c360-blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 82, 255, 0.35);
}

.btn--primary:hover:not(:disabled) {
  background: var(--c360-blue-hover);
  box-shadow: 0 6px 20px rgba(0, 82, 255, 0.4);
}

.btn--secondary {
  background: var(--c360-ink);
  color: #fff;
  border-color: var(--c360-ink);
}

.btn--secondary:hover:not(:disabled) {
  background: #1e293b;
}

.btn--outline {
  background: #fff;
  color: var(--c360-blue);
  border-color: rgba(0, 82, 255, 0.35);
}

.btn--outline:hover:not(:disabled) {
  background: var(--c360-blue-soft);
  border-color: var(--c360-blue);
}

.btn--ghost {
  background: transparent;
  color: var(--c360-blue);
  border-color: var(--c360-border);
  font-weight: 600;
}

.btn--ghost:hover:not(:disabled) {
  background: var(--c360-blue-soft);
  border-color: rgba(0, 82, 255, 0.25);
}

.status {
  color: var(--c360-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ——— Table ——— */
.card--table {
  padding: 0;
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.65rem 0.85rem;
  text-align: right;
  border-bottom: 1px solid var(--c360-border);
  vertical-align: top;
}

th {
  background: linear-gradient(180deg, #f1f5ff 0%, #eef2ff 100%);
  color: var(--c360-ink);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: none;
  letter-spacing: 0;
}

tbody tr {
  background: #fff;
  transition: background 0.12s;
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr:last-child td {
  border-bottom: none;
}

td a {
  color: var(--c360-blue);
  font-weight: 600;
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

.empty-state {
  margin: 0;
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--c360-muted);
  font-weight: 500;
  border-top: 1px dashed var(--c360-border);
}

.empty-state[hidden] {
  display: none;
}

/* ——— Footer ——— */
.site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--c360-muted);
}

.site-footer a {
  color: var(--c360-blue);
  font-weight: 600;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}
