/* ==========================================================================
   Al-Furqan Tutors — Design Tokens
   --------------------------------------------------------------------------
   Concept: "the horizon between night and dawn" — the platform serves
   students across every timezone, so someone somewhere is always meeting
   their tutor at first light. The hero gradient, the ink/gold pairing, and
   the geometric interlace divider (the page's signature element, echoing
   the geometric tradition in Islamic art without literal ornamentation)
   all draw from that idea rather than a generic "education site" template.
   ========================================================================== */

:root {
    /* Colour */
    --color-ink: #16233a;         /* night-sky ink -- headings, primary text */
    --color-brand: #0f3d3a;       /* deep teal -- links, primary UI */
    --color-brand-dark: #082a27;  /* darker teal -- hero gradient, hover states */
    --color-accent: #c9932f;      /* dawn gold -- CTAs, the signature accent */
    --color-accent-soft: #e3b57e; /* first-light rose-gold -- gradient warmth only */
    --color-bg: #f2ede1;          /* parchment -- page background */
    --color-surface: #fffcf6;     /* warm white -- cards, forms */
    --color-muted: #5c6a66;       /* muted sage-slate -- secondary text */
    --color-border: #e2d9c6;      /* hairline borders on parchment */
    --color-danger: #a13d2b;

    /* Type */
    --font-display: "Fraunces", Georgia, serif;
    --font-body: "Work Sans", -apple-system, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;

    /* Layout */
    --radius: 10px;
    --shadow-card: 0 2px 10px rgba(22, 35, 58, 0.07);
    --shadow-lift: 0 8px 24px rgba(22, 35, 58, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-ink);
    margin: 0 0 0.5rem;
}
h1 { font-size: 2.5rem; line-height: 1.1; }
h2 { font-size: 1.7rem; margin-top: 2rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }

a { color: var(--color-brand); }
a:hover { color: var(--color-accent); }

::selection { background: var(--color-accent-soft); color: var(--color-ink); }

/* Visible keyboard focus everywhere -- accessibility floor for a 7-80 age range. */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
}

/* --------------------------------------------------------------------------
   Loading splash (index.html, before Blazor boots)
   -------------------------------------------------------------------------- */
.loading-splash {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 0.75rem;
    background: linear-gradient(180deg, var(--color-brand-dark) 0%, var(--color-brand) 55%, var(--color-accent-soft) 100%);
    color: #fdf8ee;
    font-family: var(--font-body);
}
.loading-mark { font-family: var(--font-display); font-size: 2rem; opacity: 0.9; }

/* --------------------------------------------------------------------------
   Signature element: geometric interlace divider
   -------------------------------------------------------------------------- */
.divider-pattern {
    height: 14px;
    margin: 0;
    opacity: 0.4;
    background-image:
        linear-gradient(45deg, var(--color-accent) 25%, transparent 25%),
        linear-gradient(-45deg, var(--color-accent) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--color-accent) 75%),
        linear-gradient(-45deg, transparent 75%, var(--color-accent) 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0px;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
    position: relative;
    background: linear-gradient(180deg, var(--color-brand-dark) 0%, var(--color-brand) 60%, var(--color-accent-soft) 130%);
    color: #fdf8ee;
    padding: 5rem 1.5rem 4rem;
    text-align: center;
    overflow: hidden;
}
.hero h1 {
    color: #fff;
    font-size: clamp(2.1rem, 4vw, 3rem);
    max-width: 720px;
    margin: 0 auto 1rem;
}
.hero p {
    font-size: 1.1rem;
    max-width: 620px;
    margin: 0 auto 1.75rem;
    color: #eee6d3;
}
.hero .cta-button {
    background: var(--color-accent);
    color: var(--color-ink);
}
.hero .cta-button:hover { background: #dba645; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.cta-button, button, input[type="submit"] {
    display: inline-block;
    background: var(--color-brand);
    color: #fdf8ee;
    border: none;
    padding: 0.65rem 1.4rem;
    border-radius: 999px;
    text-decoration: none;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}
.cta-button:hover, button:hover, input[type="submit"]:hover { background: var(--color-brand-dark); transform: translateY(-1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Secondary/plain buttons (e.g. "Cancel Edit", table row actions) read as
   understated text-buttons rather than competing with the primary CTA style. */
table button, .site-footer button {
    background: transparent;
    color: var(--color-brand);
    border: 1px solid var(--color-border);
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
}
table button:hover { background: var(--color-bg); color: var(--color-danger); transform: none; }

/* --------------------------------------------------------------------------
   Offerings grid
   -------------------------------------------------------------------------- */
.offerings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}
.offering-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.offering-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.offering-card h3 { color: var(--color-brand); }

/* --------------------------------------------------------------------------
   Content feed
   -------------------------------------------------------------------------- */
.feed { max-width: 680px; margin: 0 auto; padding: 0.5rem 1.5rem 2rem; }
.feed-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.feed-card img, .feed-card video { width: 100%; display: block; background: var(--color-bg); }
.feed-card .body { padding: 1.1rem 1.3rem; }
.feed-card .body h4 { margin-bottom: 0.35rem; font-family: var(--font-body); font-weight: 700; font-size: 1.05rem; }
.feed-card .meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--color-muted); letter-spacing: 0.02em; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.3rem; color: var(--color-ink); }
input, select, textarea {
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--color-accent); }

fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    background: var(--color-surface);
}
legend {
    font-family: var(--font-display);
    font-weight: 600;
    padding: 0 0.5rem;
    color: var(--color-brand);
}

/* --------------------------------------------------------------------------
   Tables (schedule, bookings, admin lists) -- mono type for scannable data
   -------------------------------------------------------------------------- */
table { font-size: 0.9rem; width: 100%; border-collapse: collapse; }
table th {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted);
    text-align: left;
    border-bottom: 2px solid var(--color-border);
}
table td { font-family: var(--font-body); padding: 0.6rem 0.4rem; vertical-align: top; border-bottom: 1px solid var(--color-border); }
table th { padding: 0.5rem 0.4rem; }

/* --------------------------------------------------------------------------
   Testimonials
   -------------------------------------------------------------------------- */
blockquote {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent);
    border-radius: var(--radius);
    padding: 1.1rem 1.5rem;
    margin: 0 0 1rem;
    box-shadow: var(--shadow-card);
    font-family: var(--font-display);
    font-size: 1.05rem;
}
blockquote footer { font-family: var(--font-mono); font-size: 0.8rem; color: var(--color-muted); margin-top: 0.5rem; }

/* --------------------------------------------------------------------------
   Layout chrome: nav + footer
   -------------------------------------------------------------------------- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.75rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
    gap: 0.75rem;
}
.brand {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.3rem;
    color: var(--color-brand);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}
.brand-logo { height: 2.75rem; width: auto; display: block; }
.links { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: center; }
.links a { color: var(--color-ink); text-decoration: none; font-size: 0.92rem; font-weight: 500; }
.links a.active { color: var(--color-accent); }
/* Logout is a <button> (it acts rather than navigates) but should read like the nav links. */
.links .link-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
    color: var(--color-ink);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transform: none;
}
.links .link-button:hover { background: none; color: var(--color-accent); transform: none; }

/* Account dropdown: guest/user label with Login, Register, About, Donate, Admin, Logout. */
.account-menu { position: relative; }
.links .account-toggle {
    background: var(--color-surface);
    color: var(--color-brand);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.4rem 0.8rem;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transform: none;
}
.links .account-toggle:hover,
.links .account-toggle[aria-expanded="true"] { background: var(--color-bg); color: var(--color-brand-dark); transform: none; }
.account-caret { font-size: 0.8em; margin-left: 0.25rem; }
.account-backdrop { position: fixed; inset: 0; z-index: 20; }
.account-dropdown {
    position: absolute;
    top: calc(100% + 0.4rem);
    /* Narrow screens: the nav wraps and the button can start a row, so open rightwards. */
    left: 0;
    z-index: 21;
    min-width: 12rem;
    max-width: calc(100vw - 2rem);
    display: flex;
    flex-direction: column;
    padding: 0.4rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lift);
}
/* Wide screens: the button is the right-most item, so open leftwards to stay on screen. */
@media (min-width: 960px) {
    .account-dropdown { left: auto; right: 0; }
}
/* Narrow screens: the button can land anywhere in a wrapped row (e.g. beside "Free Trial"),
   so size the dropdown against the navbar instead of the button. With top left at auto it sits
   directly below the button's line, and left/right keep it inside the screen gutters. */
@media (max-width: 959px) {
    .navbar { position: relative; }
    .account-menu { position: static; }
    .account-dropdown {
        top: auto;
        left: 1rem;
        right: auto;
        width: min(16rem, calc(100vw - 2rem));
        min-width: 0;
        max-width: none;
        margin-top: 0.4rem;
    }
}
.account-dropdown a,
.account-dropdown .link-button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-radius: calc(var(--radius) - 4px);
}
.account-dropdown a:hover,
.account-dropdown .link-button:hover { background: var(--color-bg); color: var(--color-brand-dark); }
.account-dropdown hr { border: 0; border-top: 1px solid var(--color-border); margin: 0.3rem 0; }

.site-footer {
    text-align: center;
    padding: 2rem 1.5rem 1.5rem;
    font-size: 0.85rem;
    color: var(--color-muted);
    background: var(--color-ink);
}
.site-footer p { color: #cdd6d2; margin: 0.3rem 0; }
.site-footer a { color: var(--color-accent-soft); }
.site-footer a:hover { color: var(--color-accent); }

/* --------------------------------------------------------------------------
   Blazor error UI (unchanged behaviour, restyled)
   -------------------------------------------------------------------------- */
#blazor-error-ui {
    background: #fdf1dc;
    border-top: 1px solid var(--color-accent);
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-family: var(--font-body);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.6rem; }

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .hero { padding: 3.5rem 1.25rem 3rem; }
    .navbar { flex-direction: column; align-items: flex-start; }
}
