/* ============================================================
   app.css — Time Manager Shared Design System
   RTL · Mobile-First · Dark
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Background */
  --bg:        #080d18;
  --bg-card:   rgba(255,255,255,.055);
  --bg-card-2: rgba(255,255,255,.08);
  --bg-input:  rgba(0,0,0,.28);
  --bg-nav:    rgba(8,13,24,.88);

  /* Text */
  --text:      rgba(255,255,255,.92);
  --text-2:    rgba(255,255,255,.60);
  --text-3:    rgba(255,255,255,.38);

  /* Borders */
  --stroke:    rgba(255,255,255,.10);
  --stroke-2:  rgba(255,255,255,.16);

  /* Accent — a single warm amber for quick recognition */
  --accent:    #f59e0b;
  --accent-dim: rgba(245,158,11,.15);
  --accent-glow: rgba(245,158,11,.28);

  /* Semantic */
  --blue:      #4f8cff;
  --blue-dim:  rgba(79,140,255,.16);
  --green:     #22c55e;
  --green-dim: rgba(34,197,94,.14);
  --red:       #f43f5e;
  --red-dim:   rgba(244,63,94,.14);

  /* Shadows */
  --shadow:     0 20px 48px rgba(0,0,0,.45);
  --shadow-sm:  0 8px 22px rgba(0,0,0,.26);

  /* Shape */
  --radius:    20px;
  --radius-sm: 14px;
  --radius-xs: 10px;

  /* Focus ring */
  --ring: 0 0 0 3px rgba(245,158,11,.38);

  /* Nav height — used for body padding */
  --nav-h: 68px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  direction: rtl;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", "Vazirmatn", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(900px 600px at 10% 5%,  rgba(245,158,11,.12), transparent 55%),
    radial-gradient(700px 500px at 90% 15%,  rgba(79,140,255,.10), transparent 55%),
    radial-gradient(800px 550px at 50% 100%, rgba(34,197,94,.08),  transparent 55%),
    linear-gradient(180deg, #060b16 0%, #080d18 50%, #060b16 100%);
  overflow-x: hidden;
  padding-bottom: var(--nav-h);
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
p { margin: 0; }
button { font-family: inherit; }

/* ---------- Layout ---------- */
.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.container {
  width: min(900px, 100%);
  margin-inline: auto;
  padding-inline: 16px;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--stroke);
}

.topbar__inner {
  padding: 14px 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.topbar__title h1 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.3px;
}

.topbar__sub {
  margin-top: 2px;
  font-size: .82rem;
  color: var(--text-2);
}

/* ---------- Bottom Nav ---------- */
.bottom-nav {
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--bg-nav);
  border-top: 1px solid var(--stroke);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  color: var(--text-3);
  transition: color .2s ease;
  position: relative;
  cursor: pointer;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

.nav-item span {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .01em;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card--padded { padding: 16px; }
.card--raised {
  background: var(--bg-card-2);
  border-color: var(--stroke-2);
  box-shadow: var(--shadow);
}

/* ---------- Alerts ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: var(--bg-card);
  margin-top: 14px;
  font-size: .9rem;
}

.alert--error  { border-color: rgba(244,63,94,.38);  background: var(--red-dim);   }
.alert--success{ border-color: rgba(34,197,94,.38);  background: var(--green-dim); }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-2);
  background: var(--bg-card);
  color: var(--text);
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, filter .15s, background .15s, border-color .15s;
  user-select: none;
  white-space: nowrap;
}

.btn:hover  { background: var(--bg-card-2); border-color: rgba(255,255,255,.22); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn--primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: rgba(245,158,11,.5);
  color: #1a0e00;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(245,158,11,.22);
}
.btn--primary:hover  { filter: brightness(1.06); background: linear-gradient(135deg, #f59e0b, #d97706); }

.btn--ghost  { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--bg-card); }

.btn--danger {
  background: var(--red-dim);
  border-color: rgba(244,63,94,.35);
  color: #fda4b4;
}

.btn--back {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: .85rem;
}

.btn--full { width: 100%; justify-content: center; }

.btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

/* ---------- Form Elements ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field__label {
  font-size: .88rem;
  font-weight: 800;
  color: rgba(255,255,255,.80);
  letter-spacing: .01em;
}

.req { color: var(--red); }

.field__hint {
  font-size: .80rem;
  color: var(--text-2);
}

.input, .select, .textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-2);
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
  font-size: .92rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input[readonly] { cursor: pointer; }

.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(245,158,11,.55);
  box-shadow: var(--ring);
  background: rgba(0,0,0,.36);
}

.textarea { resize: vertical; min-height: 90px; }

/* ---------- Duration Quick-Picks ---------- */
.duration-picks {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.pick-btn {
  appearance: none;
  padding: 10px 4px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--stroke-2);
  background: var(--bg-input);
  color: var(--text-2);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}

.pick-btn:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.pick-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.pick-btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------- Icon Buttons ---------- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--stroke-2);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}

.icon-btn:hover { background: var(--bg-card-2); color: var(--text); border-color: rgba(255,255,255,.22); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.icon-btn--danger { border-color: rgba(244,63,94,.32); background: var(--red-dim); color: #fda4b4; }
.icon-btn--danger:hover { background: rgba(244,63,94,.22); border-color: rgba(244,63,94,.5); }

/* ---------- Section headers ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.2px;
}

/* ---------- Empty State ---------- */
.empty {
  padding: 32px 16px;
  text-align: center;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--stroke-2);
}

.empty__icon { font-size: 2rem; opacity: .7; }
.empty__title { margin: 10px 0 6px; font-size: 1rem; font-weight: 800; }
.empty__text { color: var(--text-2); font-size: .88rem; line-height: 1.8; }

/* ---------- Table (Reports) ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 var(--radius) var(--radius);
}

.table {
  width: 100%;
  min-width: 600px;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  text-align: right;
  padding: 11px 14px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-2);
  background: rgba(255,255,255,.04);
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  background: transparent;
  vertical-align: middle;
  font-size: .88rem;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: rgba(255,255,255,.04); }
.table .col-num { font-weight: 800; font-variant-numeric: tabular-nums; }
.table .col-actions { white-space: nowrap; }
.table .col-desc { color: var(--text-2); max-width: 280px; }

/* Mobile table → cards */
@media (max-width: 639px) {
  .table { min-width: 0; }
  .table-wrap { overflow: visible; border-radius: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }

  .table tbody tr {
    background: var(--bg-card);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    overflow: hidden;
  }

  .table tbody td {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px;
    align-items: start;
    border-bottom: 1px solid rgba(255,255,255,.06);
    padding: 11px 14px;
  }

  .table tbody td:last-child { border-bottom: none; }

  .table tbody td::before {
    content: attr(data-label);
    font-size: .78rem;
    font-weight: 800;
    color: var(--text-2);
    padding-top: 1px;
  }

  .table tbody td.col-actions {
    grid-template-columns: 100px 1fr;
    display: grid;
    gap: 8px;
    align-items: center;
  }

  .table tbody td.col-actions::after {
    display: none;
  }
}

/* ---------- Color Dot ---------- */
.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- Muted ---------- */
.muted { color: var(--text-2); }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .topbar__title h1 { font-size: 1.2rem; }
  .card--padded { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
