/* ===========================================================
   Aldewaniah App — theme & layout
   Brand palette sourced live from aldewaniah.com:
     cream #F5F0E6 · navy #1A2744 · maroon #722F37 · gold #C2A050 · ink #1D1E20
   =========================================================== */
:root {
  /* --- brand source-of-truth --- */
  --navy:        #1A2744;
  --navy-d:      #121b30;
  --maroon:      #722F37;
  --gold:        #C2A050;
  --gold-d:      #a8863c;
  --cream:       #F5F0E6;
  --ink:         #1D1E20;
  --ink-soft:    #6b675f;
  --line:        #e4ddcf;
  --bg:          #F5F0E6;
  --card:        #fffdf8;
  --radius:      16px;
  --shadow:      0 2px 12px rgba(26,39,68,.08);
  --header-h:    58px;
  --nav-h:       64px;
  --font-ar: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-en: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* --- backward-compatible aliases (modules reference these) --- */
  --brand-blue:   var(--navy);
  --brand-blue-d: var(--navy);
  --brand-green:  var(--gold);
  --brand-red:    var(--maroon);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ar);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  padding-top: var(--header-h);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
html[lang="en"] body { font-family: var(--font-en); }

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

/* ---------- Header ---------- */
.app-header {
  position: fixed; top: 0; inset-inline: 0; height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; z-index: 20;
  background: var(--navy);
  color: var(--cream);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 30px; height: 30px; }
.brand-name { font-weight: 700; font-size: 1.15rem; color: var(--cream); }
.lang-toggle {
  background: rgba(245,240,230,.12); color: var(--cream); border: 1px solid rgba(194,160,80,.6);
  border-radius: 999px; padding: 6px 14px; font-weight: 600; cursor: pointer; font-size: .85rem;
}
.lang-toggle:active { transform: scale(.96); }

/* ---------- View ---------- */
.view { max-width: 720px; margin: 0 auto; padding: 16px; }
.page-title { font-size: 1.4rem; font-weight: 700; margin: 4px 0 16px; color: var(--navy); }
.page-sub { color: var(--ink-soft); margin: -8px 0 16px; font-size: .95rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px; border: 1px solid var(--line);
}
.card-title { font-weight: 700; margin: 0 0 6px; font-size: 1.05rem; color: var(--navy); }
.card-meta { color: var(--ink-soft); font-size: .82rem; }
.card-body { margin: 8px 0 0; line-height: 1.6; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--navy); color: var(--cream); border: none; border-radius: 12px;
  padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn-green { background: var(--gold); color: var(--navy-d); }      /* "primary action" gold */
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--navy); }
.btn-block { width: 100%; }
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; color: var(--navy); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; background: #fff; color: var(--ink);
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(194,160,80,.25);
}

/* ---------- Avatars / chips ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; color: var(--cream); font-weight: 700; background: var(--navy);
}
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem;
  background: rgba(194,160,80,.2); color: var(--gold-d); font-weight: 600;
}
.chip-blue { background: rgba(26,39,68,.1); color: var(--navy); }
.chip-red  { background: rgba(114,47,55,.12); color: var(--maroon); }

/* ---------- Empty & helpers ---------- */
.empty { text-align: center; color: var(--ink-soft); padding: 40px 16px; }
.empty svg { opacity: .5; margin-bottom: 8px; }
.spacer { height: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--ink-soft); }
.add-fab-wrap { margin: 4px 0 18px; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--card); border-top: 1px solid var(--line); z-index: 20;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: none; border: none; cursor: pointer; color: var(--ink-soft);
  font: inherit; font-size: .72rem; font-weight: 600; padding: 8px 2px;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active { color: var(--navy); }
.nav-item.active svg { stroke: var(--gold-d); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(18,27,48,.45); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--card); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0;
  padding: 20px; max-height: 88vh; overflow-y: auto;
}
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 20px; }
}
.modal h3 { margin: 0 0 14px; color: var(--navy); }

/* ---------- Home hero ---------- */
.hero { text-align: center; padding: 28px 8px 8px; }
.hero-logo { width: 110px; height: 110px; margin: 0 auto 14px; display: block; }
.hero-title { font-size: 2rem; font-weight: 700; color: var(--navy); margin: 0 0 6px; line-height: 1.3; }
.hero-tagline { color: var(--maroon); font-weight: 600; margin: 0 0 8px; }
@media (min-width: 640px) { .hero-title { font-size: 2.6rem; } }

.section-head { text-align: center; color: var(--maroon); font-size: 1.2rem; font-weight: 700; margin: 22px 0 14px; }

/* ---------- Idea form ---------- */
.idea-form { max-width: 520px; margin: 0 auto 8px; }
.fld {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; background: #fff; color: var(--ink); margin: 0;
}
.fld:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(194,160,80,.25); }
textarea.fld { min-height: 110px; resize: vertical; }

/* ---------- Tournament cards ---------- */
.trn-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .trn-grid { grid-template-columns: 1fr 1fr; } }
.trn-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 16px; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  transition: transform .12s ease, border-color .12s ease;
}
.trn-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.trn-card-suits { display: flex; gap: 8px; font-size: 1.5rem; line-height: 1; }
.trn-card-suits .suit { color: var(--navy); }
.trn-card-suits .suit.red { color: var(--maroon); }
.trn-card-name { font-weight: 700; color: var(--navy); font-size: 1.05rem; }
.trn-card-cta { color: var(--gold-d); font-weight: 600; font-size: .85rem; }

/* ---------- Bracket modal ---------- */
.modal-wide { max-width: 960px; }
.bracket-frame { width: 100%; height: 70vh; border: 0; border-radius: 12px; background: #fff; }

/* ---------- Locked (members-only) ---------- */
.locked { text-align: center; padding: 44px 18px; color: var(--ink-soft); }
.locked-icon { color: var(--gold-d); margin-bottom: 8px; }
.locked-title { color: var(--navy); margin: 0 0 8px; }

/* ---------- Contact ---------- */
.contact-email { display: inline-block; margin-top: 6px; font-size: 1.1rem; font-weight: 700; color: var(--maroon); text-decoration: none; }
.site-footer { text-align: center; color: var(--ink-soft); font-size: .8rem; margin: 28px 0 8px; }

/* fade */
/* ---------- Auth (header) ---------- */
.header-actions { display: flex; align-items: center; gap: 8px; }
.auth-box { display: inline-flex; }
.auth-btn {
  background: var(--gold); color: var(--navy-d); border: none;
  border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 700;
  font-size: .82rem; cursor: pointer; max-width: 46vw; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.auth-btn:active { transform: scale(.96); }
.auth-err { color: var(--maroon); font-size: .85rem; margin: 6px 0 0; min-height: 1em; }
#recaptcha-container { position: fixed; bottom: 0; left: 0; }

.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
