/* ===== دوري كرة القدم - مسجد الرضوان — أنماط الموقع (RTL) ===== */
:root {
  --green-900: #063d22;
  --green-800: #0b6b3a;
  --green-600: #16a34a;
  --green-100: #e7f6ec;
  --gold: #f5b700;
  --ink: #14231b;
  --muted: #62706a;
  --line: #dfe8e2;
  --bg: #f3f7f4;
  --card: #ffffff;
  --danger: #c62828;
  --warn: #b26a00;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(6, 61, 34, .08);
  font-family: "Cairo", "Segoe UI", Tahoma, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); line-height: 1.7; font-size: 16px;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--green-800); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5rem; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
img { max-width: 100%; }
.wrap { width: min(1100px, 100% - 1.5rem); margin-inline: auto; }
.main { flex: 1; padding-block: 1.2rem 2.5rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.hidden { display: none !important; }

/* ----- الترويسة ----- */
.site-header {
  background: linear-gradient(135deg, var(--green-900), var(--green-800));
  color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 12px rgba(0,0,0,.18);
}
.header-inner { display: flex; align-items: center; gap: 1rem; padding-block: .6rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .ball { font-size: 1.9rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 1.05rem; } .brand-text small { opacity: .8; font-size: .78rem; }
.nav-toggle { margin-inline-start: auto; background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 10px; padding: .4rem .8rem; font-size: 1.3rem; cursor: pointer; display: none; }
.main-nav { display: flex; gap: .25rem; margin-inline-start: auto; flex-wrap: wrap; }
.main-nav a { color: #e9fff1; padding: .45rem .85rem; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.main-nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.main-nav a.active { background: var(--gold); color: #3a2c00; }
.main-nav .admin-link { border: 1px solid rgba(255,255,255,.35); }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .main-nav { display: none; width: 100%; flex-direction: column; margin: 0; padding-bottom: .5rem; }
  .main-nav.open { display: flex; }
  .main-nav a { padding: .7rem 1rem; border-radius: 10px; }
}

/* ----- الواجهة العامة ----- */
.hero {
  background: radial-gradient(circle at 15% 20%, rgba(255,255,255,.08) 0 40px, transparent 41px),
              repeating-linear-gradient(90deg, #0d7a42 0 70px, #0b6b3a 70px 140px);
  color: #fff; border-radius: var(--radius); padding: 1.6rem 1.4rem; margin-bottom: 1.2rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; box-shadow: var(--shadow);
}
.hero h1 { font-size: 1.9rem; margin-bottom: .2rem; }
.hero .eyebrow { margin: 0; opacity: .85; font-weight: 600; }
.hero-sub { margin: .2rem 0 .6rem; opacity: .92; }
.hero-ball { font-size: 4.2rem; animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hero-ball { animation: none; } }
@media (max-width: 560px) { .hero-ball { display: none; } .hero h1 { font-size: 1.5rem; } }

.page-title { margin: .3rem 0 1rem; }
.section-title { margin: 1.4rem 0 .6rem; }
.grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.team-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 800px) { .grid.two { grid-template-columns: 1fr; } }

.card { background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); border: 1px solid var(--line); margin-bottom: 1rem; }
.grid .card { margin-bottom: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; margin-bottom: .7rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head.sub { margin-top: 1.1rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.card-head a { font-size: .9rem; }

.empty { background: var(--green-100); color: var(--green-900); border: 1px dashed #b7dcc4; border-radius: 12px; padding: 1rem; text-align: center; }
.empty.big { padding: 2.2rem 1rem; font-size: 1.1rem; }
.notice { background: #fff8e1; border: 1px solid #f3dc8a; border-radius: 10px; padding: .55rem .8rem; color: #6b4e00; }

.badge { display: inline-block; padding: .1rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #e8eeea; color: #34453c; }
.badge.completed { background: #d9f2e1; color: #14663a; }
.badge.in_progress { background: #fff0c2; color: #8a5a00; }
.badge.scheduled { background: #e5ecf7; color: #2a4a7c; }
.badge.closed { background: #eee; color: #555; }
.dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; margin-inline-end: .45rem; vertical-align: middle; border: 1px solid rgba(0,0,0,.15); }

/* جداول */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.standings { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 420px; }
table.standings th, table.standings td { padding: .55rem .5rem; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.standings th { background: var(--green-100); color: var(--green-900); font-weight: 700; position: relative; }
table.standings th[data-sort] { cursor: pointer; user-select: none; }
table.standings th[data-sort]:hover { background: #d5eede; }
table.standings th.sorted-asc::after { content: " ▲"; font-size: .7rem; }
table.standings th.sorted-desc::after { content: " ▼"; font-size: .7rem; }
table.standings .col-name { text-align: start; font-weight: 600; }
table.standings .col-points { font-weight: 800; color: var(--green-800); }
table.standings tr.leader td { background: #fff9e0; }
table.standings tr.leader .col-name { font-weight: 800; }
table.standings tr.inactive td { opacity: .6; }
.pos-num { font-weight: 700; color: var(--muted); }
.gd.pos { color: #14663a; } .gd.neg { color: var(--danger); }
table.compact { min-width: 0; font-size: .92rem; }
.mini-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-inline-end: .4rem; }

/* مباريات */
.matches { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .8rem; }
.match { border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; background: #fcfefd; }
.match.live { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(245,183,0,.25); }
.match-date { color: var(--muted); font-size: .82rem; margin-bottom: .3rem; }
.match-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; }
.match .side { font-weight: 700; display: flex; align-items: center; }
.match .side.away { justify-content: flex-end; text-align: end; }
.match .score { font-size: 1.5rem; font-weight: 800; background: var(--green-900); color: #fff; padding: .1rem .8rem; border-radius: 10px; min-width: 76px; text-align: center; }
.match .score.pending { background: #e5ecf7; color: #2a4a7c; font-size: 1rem; font-weight: 700; }
.match-meta { display: flex; gap: .6rem; align-items: center; justify-content: center; margin-top: .4rem; font-size: .8rem; }
.goal-list { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-top: .45rem; font-size: .82rem; color: var(--muted); }
.goal-list .g { display: block; }
.mini-result { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); text-align: center; }
.mini-result span:first-child { text-align: start; } .mini-result span:last-child { text-align: end; }
.round-date { font-weight: 700; color: var(--green-800); margin: 0 0 .3rem; }
.award-line { margin: .7rem 0 0; background: #fff9e0; border-radius: 10px; padding: .4rem .7rem; }
.champion { font-size: 1.1rem; }

/* هدافون وجوائز */
.scorers { list-style: none; margin: 0; padding: 0; }
.scorers li { display: flex; align-items: center; gap: .7rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.scorers .rank { width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--green-100); display: grid; place-items: center; font-weight: 800; color: var(--green-800); }
.scorers li:first-child .rank { background: var(--gold); color: #3a2c00; }
.scorers .who { flex: 1; display: flex; flex-direction: column; line-height: 1.3; font-weight: 700; }
.scorers .who small { color: var(--muted); font-weight: 400; }
.scorers .goals { font-weight: 800; }
.award-box { display: flex; gap: .8rem; align-items: center; background: linear-gradient(135deg, #fff9e0, #ffefb0); border-radius: 12px; padding: .8rem 1rem; }
.award-box.tie { background: linear-gradient(135deg, #eef3ff, #dfe8ff); }
.award-box .trophy { font-size: 2.2rem; }
.award-box strong { display: block; font-size: 1.1rem; } .award-box small { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.chip { background: var(--green-100); border-radius: 999px; padding: .3rem .9rem; font-weight: 700; color: var(--green-900); }
.chip:hover { text-decoration: none; background: #d5eede; }

.league-picker { display: flex; gap: .6rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
select, input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=color], textarea {
  font: inherit; padding: .55rem .7rem; border: 1px solid #c4d3ca; border-radius: 10px; background: #fff; color: var(--ink); max-width: 100%;
}
input[type=color] { padding: .15rem; height: 2.6rem; width: 3.4rem; }
select:focus, input:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(22,163,74,.35); outline-offset: 1px; }

/* فرق */
.team-hero { --team: #16a34a; display: flex; align-items: center; gap: 1rem; background: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; border-inline-start: 8px solid var(--team); box-shadow: var(--shadow); margin-bottom: 1rem; }
.team-logo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--team, #16a34a); }
.team-logo.small { width: 44px; height: 44px; }
.team-logo.fallback { display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.6rem; background: var(--team, #16a34a); }
.team-logo.small.fallback { font-size: 1.1rem; }
.team-card { --team: #16a34a; border-top: 6px solid var(--team); color: inherit; display: block; }
.team-card:hover { text-decoration: none; transform: translateY(-2px); transition: transform .15s; }
.team-card-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .4rem; }
.team-card-head h2 { margin: 0; }
.archive-card { color: inherit; display: block; } .archive-card:hover { text-decoration: none; border-color: var(--green-600); }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: .2rem 0; }
.roster { list-style: none; padding: 0; margin: 0; }
.roster li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px dashed var(--line); }
.roster img, .avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.avatar { display: grid; place-items: center; background: var(--green-100); color: var(--green-800); font-weight: 800; }
.role { margin-inline-start: auto; font-style: normal; font-size: .75rem; padding: .05rem .55rem; border-radius: 999px; background: #e8eeea; }
.role.substitute { background: #fff0c2; color: #8a5a00; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.stat-grid div { background: var(--green-100); border-radius: 12px; text-align: center; padding: .6rem .2rem; }
.stat-grid b { display: block; font-size: 1.5rem; color: var(--green-800); } .stat-grid span { font-size: .8rem; color: var(--muted); }

/* ----- التذييل ----- */
.site-footer { background: var(--green-900); color: #d9f2e1; text-align: center; padding: 1.2rem 0; margin-top: auto; }
.site-footer p { margin: .1rem 0; } .site-footer .muted { color: #9fcdb1; font-size: .85rem; }

/* ===== أزرار ونماذج (مشتركة مع الإدارة) ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: .65rem 1.2rem; cursor: pointer; background: var(--green-800); color: #fff; min-height: 44px; }
.btn:hover { background: var(--green-900); text-decoration: none; }
.btn.secondary { background: #e8eeea; color: var(--ink); } .btn.secondary:hover { background: #d9e3dd; }
.btn.danger { background: var(--danger); } .btn.danger:hover { background: #9f1d1d; }
.btn.gold { background: var(--gold); color: #3a2c00; } .btn.gold:hover { background: #dfa600; }
.btn.small { padding: .35rem .8rem; min-height: 36px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .8rem; }
.field label { font-weight: 700; font-size: .92rem; }
.field .hint { color: var(--muted); font-size: .8rem; }
.field .err { color: var(--danger); font-size: .82rem; }
.field input, .field select, .field textarea { width: 100%; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; } .row > * { flex: 1 1 200px; }

/* ===== لوحة الإدارة ===== */
body.admin { background: #eef3f0; }
.admin-bar { background: var(--green-900); color: #fff; position: sticky; top: 0; z-index: 30; }
.admin-bar .wrap { display: flex; align-items: center; gap: .8rem; padding-block: .5rem; flex-wrap: wrap; }
.admin-bar a { color: #e9fff1; font-weight: 600; padding: .35rem .7rem; border-radius: 999px; font-size: .92rem; }
.admin-bar a.active { background: var(--gold); color: #3a2c00; } .admin-bar a:hover { text-decoration: none; background: rgba(255,255,255,.15); }
.admin-bar .spacer { margin-inline-start: auto; }
.admin-bar nav { display: flex; gap: .15rem; flex-wrap: wrap; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.quick-actions .btn { padding: 1rem .6rem; font-size: 1rem; }
.alert { border-radius: 10px; padding: .7rem 1rem; margin-bottom: .8rem; }
.alert.warn { background: #fff4d6; border: 1px solid #f1d27a; color: #6b4e00; }
.alert.error { background: #fde8e8; border: 1px solid #f2b8b8; color: #8a1c1c; }
.alert.info { background: var(--green-100); border: 1px solid #b7dcc4; color: var(--green-900); }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar .spacer { margin-inline-start: auto; }
.list-item { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1 1 180px; } .list-item .actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .4rem; }
.checks label { display: flex; align-items: center; gap: .5rem; background: #f6faf7; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; cursor: pointer; }
.checks input { width: 1.2rem; height: 1.2rem; }

/* نافذة */
dialog { border: 0; border-radius: 16px; padding: 1.2rem; width: min(560px, 94vw); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { margin-bottom: .8rem; }
dialog .dialog-actions { display: flex; gap: .6rem; justify-content: flex-start; margin-top: 1rem; flex-wrap: wrap; }

/* إشعارات */
.toasts { position: fixed; bottom: 1rem; inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: .5rem; z-index: 100; pointer-events: none; }
.toast { background: #123c27; color: #fff; padding: .7rem 1.2rem; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 92vw; animation: pop .2s ease-out; pointer-events: auto; }
.toast.error { background: #9f1d1d; } .toast.success { background: #14663a; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }
.spinner { width: 1.1rem; height: 1.1rem; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: rot .7s linear infinite; }
.loading-box { text-align: center; padding: 2rem; color: var(--muted); }
.loading-box .spinner { border-color: #c8d8ce; border-top-color: var(--green-800); width: 1.6rem; height: 1.6rem; }
@keyframes rot { to { transform: rotate(360deg); } }

/* إدخال النتيجة (تركيز على الجوال) */
.entry { border: 2px solid var(--line); border-radius: 16px; padding: .9rem; background: #fff; margin-bottom: 1rem; }
.entry.completed { border-color: #9bd5b0; } .entry.in_progress { border-color: var(--gold); }
.entry-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; gap: .5rem; flex-wrap: wrap; }
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; gap: .6rem; align-items: center; }
.team-score { text-align: center; }
.team-score .tname { font-weight: 800; margin-bottom: .3rem; display: flex; justify-content: center; align-items: center; }
.stepper { display: flex; align-items: center; justify-content: center; gap: .5rem; }
.stepper button { width: 52px; height: 52px; border-radius: 50%; border: 0; font-size: 1.8rem; font-weight: 800; cursor: pointer; background: var(--green-800); color: #fff; line-height: 1; }
.stepper button.minus { background: #e8eeea; color: var(--ink); }
.stepper button:active { transform: scale(.94); }
.stepper .val { font-size: 2.4rem; font-weight: 800; min-width: 2.2ch; text-align: center; }
.vs { font-weight: 800; color: var(--muted); }
.entry-controls { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; align-items: end; }
.entry-controls .field { margin: 0; flex: 1 1 130px; }
.goal-chip { display: inline-flex; align-items: center; gap: .4rem; background: #eef6f0; border-radius: 999px; padding: .2rem .4rem .2rem .8rem; margin: .15rem; font-size: .88rem; }
.goal-chip button { border: 0; background: #d7e6dc; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; }
details.more { margin-top: .8rem; border-top: 1px dashed var(--line); padding-top: .6rem; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--green-800); padding: .3rem 0; }
.login-box { max-width: 420px; margin: 3rem auto; }
.sample-badge { background: #ffe0e0; color: #8a1c1c; border-radius: 999px; padding: .05rem .6rem; font-size: .75rem; font-weight: 700; }

@media print { .site-header, .site-footer, .admin-bar, .toasts { display: none; } body { background: #fff; } }
