/* ==========================================================================
   Alegria front — theme surfaces, branded alerts, responsive polish.
   Loaded after front-style.css. Every colour comes from the --al-* tokens,
   so light and dark themes follow automatically.
   ========================================================================== */

/* ---------- Theme-aware surfaces ---------- */
.bg-al-surface {
    background-color: var(--al-surface);
}

/* Bootstrap's bg-white/bg-light are hard-coded light colours. On the public
   site they must follow the theme, or dark mode shows white slabs with
   light text on them (the bug in the "menu" and "reviews" sections). */
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light {
    background-color: var(--al-surface) !important;
}

.badge-cart {
    background: var(--al-grad-gold);
    color: #1b1307;
    font-weight: 800;
}

/* ---------- Branded SweetAlert2 (forms, confirmations) ---------- */
.swal2-container {
    font-family: var(--font-ar);
}
.swal2-popup.al-swal {
    direction: rtl;
    background: var(--al-surface);
    color: var(--al-ink);
    border: 1px solid var(--al-line-strong);
    border-radius: var(--al-radius-lg);
    box-shadow: var(--al-shadow-lg);
    padding: 1.75rem 1.5rem 1.5rem;
    width: min(30rem, calc(100vw - 2rem));
}
.swal2-popup.al-swal::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    border-radius: var(--al-radius-lg) var(--al-radius-lg) 0 0;
    background: var(--al-grad-gold);
}
.swal2-popup.al-swal.al-swal-error::before {
    background: linear-gradient(90deg, var(--al-rose), #e0705f);
}
.al-swal .swal2-title {
    color: var(--al-ink);
    font-weight: 900;
    font-size: 1.35rem;
    padding-top: 0.25rem;
}
.al-swal .swal2-html-container {
    color: var(--al-ink-soft);
    font-size: 1rem;
    line-height: 1.8;
}
.al-swal .swal2-html-container ul {
    text-align: right;
    margin: 0.5rem 0 0;
    padding-inline-start: 1.2rem;
}
.al-swal .swal2-icon {
    margin-top: 0.75rem;
}
.al-swal .swal2-icon.swal2-success {
    border-color: var(--al-green);
    color: var(--al-green);
}
.al-swal .swal2-icon.swal2-success [class^="swal2-success-line"] {
    background-color: var(--al-green);
}
.al-swal .swal2-icon.swal2-success .swal2-success-ring {
    border-color: color-mix(in srgb, var(--al-green) 35%, transparent);
}
.al-swal .swal2-success-circular-line-left,
.al-swal .swal2-success-circular-line-right,
.al-swal .swal2-success-fix {
    background-color: var(--al-surface) !important;
}
.al-swal .swal2-actions {
    gap: 0.6rem;
    margin-top: 1.25rem;
}
.al-swal .al-swal-confirm,
.al-swal .al-swal-cancel {
    border-radius: 999px;
    padding: 0.6rem 1.8rem;
    font-weight: 800;
    min-width: 8rem;
}
.al-swal .al-swal-confirm {
    background: var(--al-grad-gold);
    color: #1b1307;
    border: 0;
}
.al-swal .al-swal-confirm:focus-visible,
.al-swal .al-swal-cancel:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--al-gold) 45%, transparent);
    outline-offset: 2px;
}
.al-swal .al-swal-cancel {
    background: transparent;
    color: var(--al-ink);
    border: 1px solid var(--al-line-strong);
}
.al-swal .swal2-timer-progress-bar {
    background: var(--al-gold);
}
div:where(.swal2-container).swal2-backdrop-show {
    background: rgba(10, 8, 4, 0.55);
    backdrop-filter: blur(3px);
}

/* Toasts: small, top of the screen, never covering the cart bar on phones. */
.swal2-popup.al-toast {
    direction: rtl;
    background: var(--al-surface);
    color: var(--al-ink);
    border: 1px solid var(--al-line-strong);
    border-inline-start: 4px solid var(--al-gold);
    border-radius: var(--al-radius);
    box-shadow: var(--al-shadow);
    padding: 0.65rem 0.9rem;
}
.swal2-popup.al-toast.al-toast-error {
    border-inline-start-color: var(--al-rose);
}
.swal2-popup.al-toast.al-toast-warning {
    border-inline-start-color: var(--al-amber);
}
.al-toast .swal2-title {
    color: var(--al-ink);
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0.5rem;
}
.al-toast .swal2-timer-progress-bar {
    background: var(--al-gold);
}

/* ---------- Social login ---------- */
.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    border-radius: 999px;
    padding: 0.6rem 1rem;
    font-weight: 700;
    background: var(--al-surface);
    color: var(--al-ink);
    border: 1px solid var(--al-line-strong);
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}
.btn-google:hover {
    color: var(--al-ink);
    border-color: var(--al-gold);
    box-shadow: var(--al-shadow-sm);
}
.btn-google svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--al-ink-faint);
    font-size: 0.85rem;
    margin: 1.25rem 0;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--al-line-strong);
}

/* ---------- Responsive polish ---------- */
html,
body {
    overflow-x: clip;
}
img,
video,
iframe {
    max-width: 100%;
}
/* Long unbroken strings (emails, order codes) wrap instead of pushing the
   layout sideways. break-word — not `anywhere` — so normal Arabic words are
   never split mid-letter: `anywhere` also shrinks min-content sizing. */
.panel-card,
.lead,
p {
    overflow-wrap: break-word;
}

/* .section-title is a flex row (ornament ◆ + text + underline). A title made
   of text plus accent <span>s becomes several flex items; without wrapping
   they were squeezed side by side into one-word columns on phones. */
.section-title {
    flex-wrap: wrap;
    row-gap: 0.15rem;
}
.section-title.center,
.text-center > .section-title {
    justify-content: center;
}
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 991.98px) {
    .section {
        padding-top: 3.5rem;
        padding-bottom: 3.5rem;
    }
}

@media (max-width: 575.98px) {
    :root {
        --bs-font-size-root: 16px;
    }
    .container {
        padding-inline: 1rem;
    }
    .section {
        padding-top: 2.75rem;
        padding-bottom: 2.75rem;
    }
    .display-6 {
        font-size: calc(1.35rem + 1.2vw);
    }
    .display-5,
    .display-4 {
        font-size: calc(1.5rem + 1.6vw);
    }
    .panel-card.p-4,
    .panel-card.p-lg-5 {
        padding: 1.15rem !important;
    }
    /* Big call-to-action buttons go full width instead of overflowing. */
    .btn-lg {
        padding-inline: 1.25rem;
        font-size: 1rem;
    }
    .media-frame[style*="height:300px"],
    .media-frame[style*="height:340px"] {
        height: 220px !important;
    }
    /* Tables of order lines collapse to readable cards spacing. */
    .table > :not(caption) > * > * {
        padding: 0.45rem 0.4rem;
    }
    .swal2-popup.al-toast {
        width: calc(100vw - 1.5rem) !important;
    }
    .footer-legal {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 0.25rem;
    }
}

/* Header actions wrap gracefully inside the collapsed mobile nav. */
@media (max-width: 991.98px) {
    .navbar-alegria .navbar-collapse .d-flex {
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .swal2-popup {
        animation: none !important;
    }
}

/* ---------- Centered titles read as one sentence ----------
   A centered title used to be a flex row: the ◆, each <span> and the
   underline were separate items, so on phones a long title broke into
   ragged pieces with the ornaments stranded between them. Centered titles
   are now plain centered text: ornaments sit inline, the underline sits
   centered below, and lines are balanced. */
.section-title.center,
.text-center > .section-title {
    display: block;
    text-align: center;
    text-wrap: balance;
}
.section-title.center::before,
.text-center > .section-title::before {
    display: inline-block;
    margin-inline-end: 0.5rem;
    vertical-align: 0.2em;
}
.section-title.center::after,
.text-center > .section-title::after {
    margin: 0.78rem auto 0;
}
/* a title followed by its own decorative rule needs no underline */
.section-title.no-rule::after {
    display: none;
}
.section-title .arabesque {
    margin-inline: 0.35rem;
    vertical-align: 0.1em;
}

@media (max-width: 575.98px) {
    .section-title.display-5 {
        font-size: calc(1.45rem + 1.6vw);
        line-height: 1.6 !important;
    }
}

/* ---------- Header stays with the visitor ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
}
.navbar-alegria .nav-cta-mobile {
    display: none;
}
@media (max-width: 991.98px) {
    /* the menu is the first thing a phone visitor wants: a button, not a burger item */
    .navbar-alegria .nav-cta-mobile {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        margin-inline-start: auto;
        padding: 0.7rem 0.85rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    .navbar-alegria .navbar-toggler {
        margin-inline-start: 0.5rem !important;
    }
}

/* ---------- Footer branches (from Settings → الفروع) ---------- */
.footer-branches {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 2.5rem;
    margin: 1.5rem 0 0.5rem;
}
.footer-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.85rem;
    text-align: center;
}
.footer-branch strong {
    font-weight: 800;
}
.footer-branch strong i {
    color: var(--al-gold);
    margin-inline-end: 0.2rem;
}
.footer-branch small {
    opacity: 0.75;
}
.footer-branch a {
    color: inherit;
    opacity: 0.85;
    text-decoration: none;
}
.footer-branch a:hover {
    color: var(--al-gold);
    opacity: 1;
}
