/* ==========================================================================
   Admin dashboard. design.md 4.3 (1440 x 980).

   The quotation sells this as a dashboard that works on a phone, so the
   sidebar collapses to a scrolling top bar and the schedule keeps its own
   horizontal scroll rather than reflowing into something unreadable.
   ========================================================================== */

.admin {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-block-size: 100vh;
  background: var(--muted);
}

/* --- Sidebar ------------------------------------------------------------- */

.side {
  background: var(--ink-900);
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  inset-block-start: 0;
  block-size: 100vh;
}

.side__brand { display: flex; align-items: center; gap: 12px; }
.side__slot {
  inline-size: 48px;
  block-size: 48px;
  border-radius: 10px;
  background: var(--admin-logo-fill);
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
}
.side__slot img { inline-size: 76%; block-size: 76%; object-fit: contain; }
.side__name { font-size: 13px; font-weight: 700; color: #fff; letter-spacing: 0.02em; }
.side__role { font-size: 11px; font-weight: 500; color: var(--admin-meta); }
:root[lang='ar'] .side__name { letter-spacing: 0; }

.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 15px;
  color: var(--admin-menu-idle);
  cursor: pointer;
  text-align: start;
  min-block-size: 45px;
}
.menu-item:hover { background: var(--admin-user-fill); color: #fff; }
.menu-item[aria-current='page'] { background: var(--green-500); color: #fff; }

.side__foot { margin-block-start: auto; display: flex; flex-direction: column; gap: 12px; }

.side__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-btn);
  background: var(--admin-user-fill);
}
.side__avatar {
  inline-size: 32px;
  block-size: 32px;
  border-radius: 50%;
  background: var(--blue-600);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex: none;
}
.side__uname { font-size: 13px; font-weight: 500; color: #fff; }
.side__urole { font-size: 11px; color: var(--admin-meta); }

/* --- Main ---------------------------------------------------------------- */

.main { padding: 30px 32px; display: flex; flex-direction: column; gap: 24px; }

.ahead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.ahead__sub { margin-block-start: 6px; color: var(--ink-500); font-size: 15px; }
.ahead__actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* --- Stat cards ---------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.stat { padding: 20px 22px; border-radius: 13px; }
.stat__label { font-size: 13px; color: var(--ink-300); }
.stat__value { margin-block: 8px 6px; font-size: 30px; font-weight: 700; line-height: 1.4; }
.stat__sub   { font-size: 13px; color: var(--ink-300); }

/* --- Lower row ----------------------------------------------------------- */

.lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.acard { padding: 22px; border-radius: 13px; }
.acard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-block-end: 16px;
}
.acard__link { font-size: 14px; color: var(--green-500); }
.acard__link:hover { color: var(--green-600); text-decoration: underline; }

/* --- Schedule table ------------------------------------------------------
   One column per court, a 64px time column, cells on their own rows.       */

.sched__scroll { overflow-x: auto; }
.sched {
  inline-size: 100%;
  min-inline-size: 640px;
  border-collapse: separate;
  border-spacing: 8px 0;
  margin-inline: -8px;
}
.sched th {
  padding-block-end: 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink-300);
  text-align: start;
}
.sched th:first-child { inline-size: 64px; }
.sched td { padding-block: 6px; vertical-align: middle; }
.sched__time {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-700);
  white-space: nowrap;
}

/* --- Cash on the door ---------------------------------------------------- */

.cash__count { font-size: 13px; font-weight: 500; color: var(--amber-500); }
.cash__list { display: flex; flex-direction: column; }
.cash__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 13px;
  border-block-end: var(--stroke) solid var(--row-divider);
}
.cash__row:last-child { border-block-end: 0; }
.cash__who   { font-size: 14px; color: var(--ink-900); }
.cash__where { margin-block-start: 3px; font-size: 12px; color: var(--ink-300); }
.cash__right { display: flex; align-items: center; gap: 10px; }
.cash__amount { font-size: 14px; color: var(--ink-700); }

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lower { grid-template-columns: minmax(0, 1fr); }
}

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

  /* Two rows, so the language switch, the cross link and the account never
     scroll off the edge. Only the menu itself scrolls sideways. */
  .side {
    position: static;
    block-size: auto;
    display: grid;
    grid-template-areas: 'brand controls' 'menu menu';
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
  }
  .side__brand { grid-area: brand; }
  .side__slot { inline-size: 40px; block-size: 40px; }

  .side__foot {
    grid-area: controls;
    margin: 0;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }
  .side__user { padding: 6px; }
  .side__utext { display: none; }
  .lang--dark { min-block-size: 40px; padding: 8px 12px; }

  .menu {
    grid-area: menu;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-block-end: 2px;
  }
  .menu::-webkit-scrollbar { display: none; }
  .menu-item { white-space: nowrap; padding: 10px 14px; min-block-size: 44px; flex: none; }

  .main { padding: 20px var(--gutter-mobile); gap: 18px; }
  .ahead__actions { inline-size: 100%; }
  .ahead__actions .btn { flex: 1; }
}

@media (max-width: 600px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat__value { font-size: 26px; }

  /* The crest alone identifies the bar at this width, and dropping the
     wordmark leaves room for the controls instead of clipping them. */
  .side__brand > span:last-child { display: none; }
  .lang--dark { white-space: nowrap; }
}

/* --- The schedule on a phone ----------------------------------------------
   The quotation sells the day's schedule across all courts at a glance, so
   the five columns stay on screen rather than hiding four of them behind a
   sideways scroll. Column heads abbreviate and cells tighten to fit.      */

@media (max-width: 767px) {
  .acard { padding: 16px 14px; }
  .sched__scroll { overflow-x: visible; }
  .sched {
    min-inline-size: 0;
    table-layout: fixed;
    border-spacing: 4px 0;
    margin-inline: -4px;
  }
  .sched th { padding-block-end: 8px; font-size: 11px; letter-spacing: 0; text-align: center; }
  .sched th:first-child { inline-size: 34px; text-align: start; }
  .sched td { padding-block: 3px; }
  .sched__time { font-size: 11px; }

  .cell {
    justify-content: center;
    padding: 9px 4px;
    font-size: 10px;
    min-block-size: 36px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    line-height: 18px;
  }
}
