@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
    --bg: #0c0c0d;
    --surface: #151517;
    --surface-2: #1b1b1e;
    --line: #26262a;
    --line-strong: #38383d;
    --ink: #f3f3f2;
    --muted: #a0a0a6;
    --faint: #6e6e75;
    --red: #d62839;
    --red-hover: #bd1f2f;
    --red-ink: #ff6b78;
    --red-tint: rgba(230, 57, 70, .15);
    --amber-ink: #e8c27a;
    --r-s: 10px;
    --r-m: 14px;
    --r-l: 20px;
    color-scheme: dark;
    --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
    /* legacy aliases */
    --asu-red: var(--red);
    --bg-base: var(--bg);
    --text-primary: var(--ink);
    --text-secondary: var(--muted);
    --text-faint: var(--faint);
    --surface-main: var(--surface);
    --surface-element: var(--surface-2);
    --surface-hover: #1f1f22;
    --border-subtle: var(--line);
    --border-strong: var(--line-strong);
    --radius-sm: var(--r-s);
    --radius-md: var(--r-m);
    --radius-lg: var(--r-l);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; }
html, body { width: 100%; background: var(--bg); }
body {
    min-height: 100dvh;
    font-family: var(--font);
    color: var(--ink);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }

.icon {
    width: 22px; height: 22px; flex: none;
    fill: none; stroke: currentColor;
    stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Header ---------- */
.navbar {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; max-width: 720px; margin: 0 auto;
    padding: 16px 20px 8px;
}
.logo-box { display: flex; align-items: center; gap: 14px; }
.logo-box img { height: 38px; object-fit: contain; }
.logo-box img + img { padding-inline-start: 14px; border-inline-start: 1px solid var(--line); }

/* ---------- Home ---------- */
.hero { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 12px 20px 24px; }
.ar-title { font-size: clamp(1.6rem, 6vw, 2.2rem); font-weight: 700; line-height: 1.25; margin-bottom: 6px; }
.hero-tagline { color: var(--muted); font-size: .95rem; margin-bottom: 20px; }

.search-field { position: relative; }
.search-field .icon {
    position: absolute; inset-inline-start: 16px; top: 50%;
    transform: translateY(-50%); color: var(--faint); pointer-events: none;
}
.search-input {
    width: 100%; height: 56px; padding: 0 48px;
    border: 1px solid var(--line-strong); border-radius: var(--r-m);
    background: var(--surface); color: var(--ink);
    font-family: var(--font); font-size: 1rem; outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.search-input:focus { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-tint); }
.search-input::placeholder { color: var(--faint); }

.semester-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: .8rem; color: var(--muted); }
.semester-note .icon { width: 16px; height: 16px; margin-top: 2px; }

#resultCard {
    display: none; margin-top: 14px; padding: 18px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
    animation: rise .25s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.prof-name { font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
.prof-detail { color: var(--muted); font-size: .9rem; margin-bottom: 6px; }
.prof-email { display: block; color: var(--red-ink); font-size: .9rem; text-decoration: none; direction: ltr; text-align: right; margin-bottom: 14px; word-break: break-all; }
.hours-btn {
    display: flex; align-items: center; justify-content: center;
    width: 100%; min-height: 48px; border: 0; border-radius: var(--r-s);
    background: var(--red); color: #fff; font: 600 .95rem var(--font); cursor: pointer;
}
.hours-btn:active { background: var(--red-hover); }

.section-label { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 28px 0 10px; }
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
    display: flex; flex-direction: column; gap: 14px; padding: 16px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
    text-decoration: none; transition: border-color .2s, transform .15s;
}
.tile:hover { border-color: var(--line-strong); }
.tile:active { transform: scale(.98); }
.tile-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: var(--r-s); background: var(--red-tint); color: var(--red-ink); }
.tile-title { font-weight: 600; font-size: .98rem; }
.tile-sub { display: flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--muted); }
.tile-sub .icon { width: 13px; height: 13px; }
.tile--soon { background: transparent; border-style: dashed; pointer-events: none; }
.tile--soon .tile-icon { background: var(--surface-2); color: var(--faint); }
.tile--soon .tile-title { color: var(--muted); }

/* ---------- Tab bar (top) ---------- */
.tabbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; justify-content: center;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top);
}
.tabbar-inner { display: flex; width: 100%; max-width: 520px; }
.tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 4px 8px; background: none; border: 0; color: var(--faint);
    font: 500 .7rem var(--font); text-decoration: none; cursor: pointer;
}
.tab .icon { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--red-ink); box-shadow: inset 0 -2px 0 var(--red); }

/* ---------- Footer ---------- */
.footer { padding: 24px 20px; text-align: center; border-top: 1px solid var(--line); }
.footer-header { font-weight: 600; font-size: .85rem; margin-bottom: 6px; }
.admin-credits { color: var(--muted); font-size: .78rem; line-height: 1.7; margin-bottom: 12px; }
.admin-credits span { color: var(--red-ink); }
.copyright { font-size: .72rem; color: var(--faint); }

/* ---------- Bottom sheet modals ---------- */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 1000;
    align-items: flex-end; justify-content: center;
    background: rgba(0, 0, 0, .65);
}
.modal-content {
    position: relative; width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto;
    background: var(--surface); border-radius: var(--r-l) var(--r-l) 0 0;
    padding: 28px 20px calc(24px + env(safe-area-inset-bottom)); text-align: right;
    animation: sheet .28s cubic-bezier(.16, 1, .3, 1);
}
.modal-content::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: -14px auto 14px; }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.close-btn {
    position: absolute; top: 14px; left: 14px; width: 36px; height: 36px;
    display: grid; place-items: center; border: 0; border-radius: 50%;
    background: var(--bg); color: var(--muted); font-size: 1rem; cursor: pointer;
}

/* search.js writes light-on-dark inline colors; override for the light theme */
#modalHoursContent, #modalHoursContent p, #modalHoursContent strong { color: var(--ink) !important; }
#modalHoursContent a, #modalHoursContent span[dir="ltr"] { color: var(--red-ink) !important; }
#modalHoursContent [style*="border-bottom"] { border-bottom-color: var(--line) !important; }
#modalHoursContent [style*="94a3b8"] { color: var(--muted) !important; }
#modalHoursContent [style*="fde047"] { color: var(--amber-ink) !important; }

.portal-row { padding: 16px 0; border-top: 1px solid var(--line); }
.portal-row:first-of-type { border-top: 0; }
.portal-label { display: flex; gap: 12px; margin-bottom: 14px; }
.portal-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: var(--r-s); background: var(--red-tint); color: var(--red-ink); }
.portal-name { font-weight: 600; }
.portal-name-en { font-size: .75rem; font-weight: 400; color: var(--muted); direction: ltr; unicode-bidi: isolate; margin-inline-start: 6px; }
.portal-desc { font-size: .83rem; color: var(--muted); }
.portal-actions { display: flex; gap: 10px; }
.mini-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 46px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r-s);
    background: var(--surface); color: var(--ink); font: 600 .88rem var(--font); text-decoration: none;
}
.mini-btn:active { background: var(--bg); }
.mini-btn--primary { background: var(--red); border-color: var(--red); color: #fff; }
.mini-btn--primary:active { background: var(--red-hover); }
.mini-btn .icon { width: 18px; height: 18px; }
.store-row { display: flex; gap: 10px; margin-top: 10px; }
.store-icon { width: 46px; height: 46px; display: block; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-s); }
.store-icon img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Sub-pages (community, plans, registration) ---------- */
.navbar--sub { max-width: 720px; }
.nav-back {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px;
    border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface);
    color: var(--ink); font-size: .88rem; font-weight: 500; text-decoration: none;
}
.nav-back:active { background: var(--bg); }
.page-hero { max-width: 720px; margin: 0 auto; padding: 12px 20px 20px; }
.page-hero h1 { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 700; line-height: 1.25; margin-bottom: 6px; }
.page-hero p { color: var(--muted); font-size: .92rem; }
.en-subtitle { direction: ltr; text-align: right; font-size: .85rem; color: var(--faint); }
.badge-highlight { display: inline-block; margin-top: 12px; padding: 6px 12px; border-radius: 8px; background: var(--red-tint); color: var(--red-ink); font-size: .85rem; font-weight: 600; }
.content { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 0 20px 40px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; margin-bottom: 20px; }
.panel-header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.panel-header h2 { font-size: 1rem; font-weight: 700; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.list-row:last-child { border-bottom: 0; }
.list-row:not(.list-row--disabled):active { background: var(--bg); }
.list-row-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.list-icon { flex: none; width: 42px; height: 42px; display: grid; place-items: center; font-size: 1.3rem; background: var(--red-tint); border-radius: var(--r-s); }
.list-text h3 { font-size: .98rem; font-weight: 600; }
.list-text p { font-size: .78rem; color: var(--muted); direction: ltr; text-align: right; }
.list-action { flex: none; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-s); color: var(--red-ink); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.list-row--disabled { opacity: .6; }
.badge-soon { flex: none; padding: 6px 10px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); font-size: .78rem; white-space: nowrap; }

.timeline { position: relative; }
.timeline::before { content: ""; position: absolute; top: 8px; bottom: 8px; right: 9px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding: 0 36px 20px 0; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; top: 6px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--red); }
.timeline-card, .info-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px; }
.timeline-card h3, .info-card h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.step-note { font-size: .8rem; font-weight: 400; color: var(--muted); margin-right: auto; }
.timeline-card p, .info-card p { font-size: .9rem; color: var(--muted); line-height: 1.7; }
.timeline-card p + p { margin-top: 8px; }
.info-card p { margin-bottom: 10px; }
.timeline-card b, .info-card b { color: var(--ink); }
.timeline-img { display: block; width: 100%; max-width: 420px; margin: 14px auto 6px; border-radius: var(--r-s); border: 1px solid var(--line); }
.timeline-img-caption { font-size: .78rem; color: var(--muted); text-align: center; margin-bottom: 12px; }
.timeline-video-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 12px auto 0; max-width: 280px; min-height: 46px;
    border: 1px solid var(--line-strong); border-radius: var(--r-s);
    color: var(--red-ink); font-size: .9rem; font-weight: 600; text-decoration: none;
}
.info-grid { display: grid; gap: 12px; margin-bottom: 8px; }
.info-note { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border-right: 3px solid var(--red); font-size: .82rem; }
.info-note--warning { border-right-color: #c98a00; color: var(--amber-ink); }
.section-title { margin: 8px 0 20px; }
.section-title h2 { font-size: 1.25rem; font-weight: 700; }
.section-title p { color: var(--muted); font-size: .88rem; direction: ltr; text-align: right; }
.cta-card { display: flex; flex-direction: column; align-items: center; padding: 28px 20px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.cta-card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.cta-card p { color: var(--muted); font-size: .9rem; margin-bottom: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px; border: 1px solid var(--line-strong); border-radius: var(--r-s); background: var(--surface); color: var(--ink); font-size: 1rem; font-weight: 600; text-decoration: none; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:active { background: var(--red-hover); }

.list-row-info { flex: 1; }
.list-icon { color: var(--red-ink); }
.list-text p.desc { direction: rtl; text-align: right; font-size: .8rem; line-height: 1.55; margin-top: 2px; }

.feedback-banner {
    background-color: #1e1515; /* Dark reddish-tinted background */
    border: 1px solid #4d1a1a; /* Subtle dark red border */
    border-right: 4px solid #ff3333; /* Vibrant red accent bar on the right (for RTL) */
    color: #f1f5f9; /* Light text for dark mode */
    padding: 14px 18px;
    border-radius: 10px;
    margin: 16px auto;
    max-width: 850px;
    font-size: 0.95rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.feedback-banner span {
    color: #cbd5e1;
}

.feedback-banner a {
    color: #ff4d4d; /* Bright red link matching your icons */
    font-weight: bold;
    text-decoration: none;
    direction: ltr;
    transition: color 0.2s ease;
}

.feedback-banner a:hover {
    color: #ff1a1a;
    text-decoration: underline;
}

@media (min-width: 768px) {
    .modal-overlay { align-items: center; }
    .modal-content { border-radius: var(--r-l); }
    .modal-content::before { display: none; }
    .tile-grid { grid-template-columns: repeat(4, 1fr); }
    .info-grid { grid-template-columns: 1fr 1fr; }
}


/* ---------- Language switcher ---------- */
html.i18n-pending body { visibility: hidden; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.lang-btn {
    min-height: 38px; padding: 0 14px;
    border: 1px solid var(--line-strong); border-radius: var(--r-s);
    background: var(--surface); color: var(--ink);
    font: 600 .85rem var(--font); cursor: pointer; white-space: nowrap;
}
.lang-btn:hover { border-color: var(--red); }
.lang-btn:active { background: var(--bg); }

/* English mode: hide the built-in English sub-labels (the main text is already English) */
html[lang="en"] .en-subtitle,
html[lang="en"] .step-note,
html[lang="en"] .section-title p,
html[lang="en"] .list-text p:not(.desc) { display: none; }

/* English mode: flip every physical left/right rule written for RTL */
html[dir="ltr"] .modal-content { text-align: left; }
html[dir="ltr"] #modalHoursContent { text-align: left !important; direction: ltr !important; }
html[dir="ltr"] .close-btn { left: auto; right: 14px; }
html[dir="ltr"] .prof-email { text-align: left; }
html[dir="ltr"] .list-text p.desc { direction: ltr; text-align: left; }
html[dir="ltr"] .timeline::before { right: auto; left: 9px; }
html[dir="ltr"] .timeline-item { padding: 0 0 20px 36px; }
html[dir="ltr"] .timeline-item:last-child { padding-bottom: 0; }
html[dir="ltr"] .timeline-item::before { right: auto; left: 2px; }
html[dir="ltr"] .info-note { border-right: 0; border-left: 3px solid var(--red); }
html[dir="ltr"] .info-note--warning { border-left-color: #c98a00; }
html[dir="ltr"] .feedback-banner { border-right: 1px solid #4d1a1a; border-left: 4px solid #ff3333; }
html[dir="ltr"] .nav-back .icon { transform: scaleX(-1); }
