:root {
    --bs-brand: #111827;
    --bs-accent: #d4a24e;
}

html {
    height: 100%;
}

body {
    min-height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
    flex: 1 0 auto;
    padding-bottom: 3rem;
}

.bs-navbar {
    background: var(--bs-brand);
}

.bs-navbar .navbar-brand {
    color: var(--bs-accent) !important;
    white-space: nowrap;
}

.bs-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, .35);
    padding: .4rem .55rem;
}
.bs-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 .2rem rgba(212, 162, 78, .35);
}

.bs-navbar .btn-accent,
.bs-nav-offcanvas .btn-accent {
    background: var(--bs-accent);
    border-color: var(--bs-accent);
    color: #111;
    font-weight: 600;
}
.bs-navbar .btn-accent:hover,
.bs-navbar .btn-accent:focus,
.bs-nav-offcanvas .btn-accent:hover,
.bs-nav-offcanvas .btn-accent:focus {
    background: #e0b56a;
    border-color: #e0b56a;
    color: #111;
}

.bs-nav-offcanvas .text-accent { color: var(--bs-accent); }

/* Mobile offcanvas menu: taller tap targets, stacked actions */
@media (max-width: 991.98px) {
    .bs-nav-offcanvas {
        width: min(20rem, 88vw);
        color: #fff;
        background: var(--bs-brand) !important;
    }
    .bs-nav-offcanvas .navbar-nav .nav-link {
        color: rgba(255, 255, 255, .85);
    }
    .bs-nav-offcanvas .navbar-nav .nav-link:hover,
    .bs-nav-offcanvas .navbar-nav .nav-link:focus {
        color: #fff;
    }
    .bs-nav-offcanvas .offcanvas-body {
        padding-top: .75rem;
        gap: .35rem;
        height: 100%;
    }
    .bs-nav-offcanvas .navbar-nav {
        width: 100%;
    }
    .bs-nav-offcanvas .offcanvas-body > .navbar-nav:last-child {
        margin-top: auto;
    }
    .bs-nav-offcanvas .nav-link {
        padding: .7rem .85rem;
        border-radius: .375rem;
        font-size: 1.05rem;
    }
    .bs-nav-offcanvas .nav-link:hover,
    .bs-nav-offcanvas .nav-link:focus {
        background: rgba(255, 255, 255, .08);
    }
    .bs-nav-offcanvas .dropdown-menu {
        position: static !important;
        transform: none !important;
        background: rgba(0, 0, 0, .25);
        border: 0;
        border-radius: .375rem;
        margin: .25rem 0 .5rem;
        padding: .35rem;
    }
    .bs-nav-offcanvas .dropdown-item {
        color: #e5e7eb;
        border-radius: .25rem;
        padding: .55rem .75rem;
    }
    .bs-nav-offcanvas .dropdown-item:hover,
    .bs-nav-offcanvas .dropdown-item:focus {
        background: rgba(255, 255, 255, .1);
        color: #fff;
    }
    .bs-nav-offcanvas .dropdown-divider {
        border-color: rgba(255, 255, 255, .15);
    }
    .bs-nav-offcanvas .bs-nav-cta {
        display: flex;
        width: 100%;
        justify-content: center;
        align-items: center;
        margin: .35rem 0;
        padding: .55rem .75rem;
    }
    .bs-nav-offcanvas .bs-nav-lang {
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, .12);
    }
    .bs-nav-offcanvas .bs-nav-lang .btn-group {
        width: 100%;
        display: flex;
    }
    .bs-nav-offcanvas .bs-nav-lang .btn {
        flex: 1 1 25%;
        padding: .45rem .35rem;
    }
}

/* Bootstrap 5.1 navbar+offcanvas needs explicit desktop resets */
@media (min-width: 992px) {
    .navbar.bs-navbar .bs-nav-offcanvas.offcanvas {
        position: static;
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
        z-index: auto;
        display: flex;
        flex-direction: row;
        flex-grow: 1;
        width: auto !important;
        height: auto !important;
        max-width: none;
        visibility: visible !important;
        background: transparent !important;
        border: 0 !important;
        transform: none !important;
        transition: none;
    }
    .navbar.bs-navbar .bs-nav-offcanvas .offcanvas-body {
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-grow: 1;
        padding: 0;
        overflow: visible;
    }
    .bs-nav-offcanvas .bs-nav-cta { margin-left: .25rem; }
    .bs-nav-offcanvas .bs-nav-lang { margin-left: .5rem; }
}

.bs-footer {
    flex-shrink: 0;
    margin-top: auto;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.hero {
    background: linear-gradient(135deg, #111827 0%, #1f2937 60%, #374151 100%);
    color: #fff;
    padding: 4rem 0;
}

.hero h1 { font-weight: 700; }

.shop-card { transition: transform .15s ease, box-shadow .15s ease; }
.shop-card:hover { transform: translateY(-3px); box-shadow: 0 .5rem 1rem rgba(0,0,0,.1); }

.rating-stars { color: var(--bs-accent); }

.shop-logo-wrap {
    width: 100%;
    text-align: center;
}
.shop-logo-wrap .shop-logo {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    margin-inline: auto;
}

.shop-reviews-toggle .shop-reviews-chevron {
    transition: transform .15s ease;
}
.shop-reviews-toggle:not(.collapsed) .shop-reviews-chevron {
    transform: rotate(90deg);
}

/* Customer appointments page */
.appt-page .appt-stats .appt-stat {
    display: block;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: .5rem;
    padding: .75rem .5rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease, background .15s ease;
}
.appt-page .appt-stats .appt-stat:hover {
    border-color: #ced4da;
    background: #fff;
}
.appt-page .appt-stat-active {
    border-color: var(--bs-brand);
    background: #fff;
}
.appt-page .appt-stat-num {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--bs-brand);
}
.appt-page .appt-stat-label {
    font-size: .75rem;
    color: #6c757d;
}
.appt-page .appt-stat-warn {
    background: #fff8e6;
    border-color: #f0d78c;
}
.appt-page .appt-card {
    border: 1px solid #e9ecef;
    box-shadow: 0 .125rem .5rem rgba(17, 24, 39, .04);
}
.appt-page .appt-card-due {
    border-color: #f0d78c;
    box-shadow: 0 0 0 1px rgba(212, 162, 78, .15);
}
.appt-page .appt-shop-link {
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}
.appt-page .appt-shop-link:hover { color: var(--bs-accent); }
.appt-page .appt-when .appt-day {
    font-weight: 600;
    font-size: 1.05rem;
}
.appt-page .appt-when .appt-time { color: #4b5563; }
.appt-page .appt-history thead th {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: #6c757d;
    background: #f8f9fa;
    border-bottom-width: 1px;
}
.appt-page .badge.bg-paid {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #c8e6c9;
}

.slot-btn { min-width: 84px; }
.slot-btn-taken {
    text-decoration: line-through;
    opacity: .55;
    cursor: not-allowed;
}

/* Booking date strip */
.date-strip-wrap {
    display: flex;
    align-items: stretch;
    gap: .35rem;
}
.date-strip {
    display: flex;
    gap: .35rem;
    flex: 1;
    min-width: 0;
}
.date-strip-nav {
    flex: 0 0 2.25rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.date-tile {
    flex: 1 1 0;
    min-width: 0;
    padding: .4rem .15rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.15;
    gap: .1rem;
}
.date-tile .date-tile-dow {
    font-size: .68rem;
    text-transform: capitalize;
    opacity: .75;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.date-tile .date-tile-day {
    font-size: 1.15rem;
    font-weight: 700;
}
.date-tile .date-tile-cap {
    font-size: .62rem;
    text-transform: capitalize;
    opacity: .8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.date-tile.active .date-tile-dow,
.date-tile.active .date-tile-cap { opacity: .9; }
.date-calendar-anchor {
    position: relative;
    display: inline-flex;
}
.date-calendar-face {
    pointer-events: none;
}
.date-strip-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    border: 0;
    padding: 0;
    margin: 0;
}
.date-calendar-anchor:focus-within .date-calendar-face {
    border-color: #212529;
    box-shadow: 0 0 0 .2rem rgba(33, 37, 41, .15);
}

#map { height: 460px; border-radius: .5rem; }

.featured-badge {
    background: var(--bs-accent);
    color: #111;
    font-weight: 600;
}

/* Floating chat widget */
#chat-launcher {
    position: fixed; bottom: 20px; right: 20px; z-index: 1050;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--bs-accent); color: #111; border: none;
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.2); font-size: 1.4rem;
}
#chat-panel {
    position: fixed; bottom: 88px; right: 20px; z-index: 1050;
    width: 340px; max-width: 92vw; height: 460px; max-height: 70vh;
    background: #fff; border-radius: .75rem; box-shadow: 0 1rem 2rem rgba(0,0,0,.25);
    display: none; flex-direction: column; overflow: hidden;
}
#chat-panel.open { display: flex; }
#chat-header { background: var(--bs-brand); color: #fff; padding: .75rem 1rem; font-weight: 600; }
#chat-messages { flex: 1; overflow-y: auto; padding: .75rem; background: #f8f9fa; }
.chat-msg { margin-bottom: .5rem; padding: .5rem .75rem; border-radius: .5rem; max-width: 85%; }
.chat-msg.user { background: var(--bs-accent); margin-left: auto; }
.chat-msg.assistant { background: #fff; border: 1px solid #e9ecef; }
#chat-form { display: flex; border-top: 1px solid #e9ecef; }
#chat-input { flex: 1; border: none; padding: .6rem .75rem; }
#chat-input:focus { outline: none; }

/* Persian (RTL) tweaks for custom chrome */
html[dir="rtl"] #chat-launcher { right: auto; left: 20px; }
html[dir="rtl"] #chat-panel { right: auto; left: 20px; }
@media (max-width: 767.98px) {
    html[dir="rtl"] #chat-panel { left: 12px; right: 12px; }
    html[dir="rtl"] #chat-launcher { left: 16px; right: auto; }
}
html[dir="rtl"] .chat-msg.user { margin-left: 0; margin-right: auto; }
html[dir="rtl"] #chat-header > .bi { margin-inline-end: .4rem; }
html[dir="rtl"] .appt-page .badge { unicode-bidi: isolate; }
html[dir="rtl"] .appt-page .btn .bi + span { margin-inline-start: .15rem; }

/* Mobile refinements */
@media (max-width: 767.98px) {
    .hero { padding: 2.25rem 0; }
    .hero h1 { font-size: 1.75rem; }

    #map { height: 300px; }

    /* Wide tables scroll horizontally instead of overflowing the viewport */
    main table.table {
        display: block;
        width: 100%;
        min-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Keep the floating chat panel within the viewport */
    #chat-panel {
        right: 12px; left: 12px; bottom: 84px;
        width: auto; max-width: none; height: 70vh;
    }
    #chat-launcher { bottom: 16px; right: 16px; }
}
