/* ==========================================================================
   Site chrome: navbar, dropdowns, footer, floating buttons, cookie bar.
   Shared by every page (home on Bootstrap 5, inner pages on Bootstrap 4).
   Loaded after style.css and before home.css / site-theme.css.

   Uses only variables that both themes define with the same value
   (--ssm-primary, --ssm-dark, --ssm-text, --ssm-border); other colours
   are literal so the result is identical on both Bootstrap versions.
   ========================================================================== */

/* ---------- Navbar ---------- */
#navbar {
    min-height: var(--site-nav-height, 72px);
    padding: 10px 0 !important;
    background: rgba(255, 255, 255, .96) !important;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 16px rgba(73, 33, 140, .08);
}

#navbar .navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--ssm-primary) !important;
    font-weight: 600;
    font-size: 1.2rem;
}

#navbar .navbar-brand:hover { color: var(--ssm-dark) !important; }
#navbar .navbar-brand img { width: 46px; height: auto; }

#navbar .navbar-toggler { border-color: var(--ssm-border); }

#navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%236d19be' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

#navbar .navbar-nav .nav-link {
    position: relative;
    color: var(--ssm-text) !important;
    font-size: .95rem;
    padding-left: .7rem !important;
    padding-right: .7rem !important;
}

#navbar .navbar-nav .nav-link:hover,
#navbar .navbar-nav .active > .nav-link,
#navbar .navbar-nav .nav-link.active {
    color: var(--ssm-primary) !important;
}

#navbar .navbar-nav .active > .nav-link,
#navbar .navbar-nav .nav-link.active { font-weight: 600; }

/* underline for the current page; dropdown toggles keep their caret */
#navbar .navbar-nav .active > .nav-link:not(.dropdown-toggle)::after,
#navbar .navbar-nav .nav-link.active:not(.dropdown-toggle)::after {
    position: absolute;
    right: .7rem;
    bottom: .05rem;
    left: .7rem;
    height: 3px;
    border-radius: 3px;
    background: var(--ssm-primary);
    content: "";
}

#navbar .navbar-nav .dropdown-toggle.active { box-shadow: inset 0 -3px 0 var(--ssm-primary); }

/* "บริจาค" button */
#navbar .home-nav-action {
    margin-left: .75rem;
    padding: .5rem 1.4rem;
    color: #fff;
    background: linear-gradient(135deg, #8b3be0, var(--ssm-primary));
    border: 0;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(109, 25, 190, .3);
}

#navbar .home-nav-action:hover { color: #fff; background: var(--ssm-dark); }

/* ---------- Dropdowns ---------- */
.dropdown-menu {
    border: 0;
    border-radius: 14px;
    padding: .5rem;
    box-shadow: 0 14px 36px rgba(73, 33, 140, .18);
}

.dropdown-item { border-radius: 8px; color: var(--ssm-text); }

.dropdown-item:hover,
.dropdown-item:focus { background: #f3ecfe; color: var(--ssm-primary); }

.dropdown-item.active,
.dropdown-item:active { background: var(--ssm-primary); color: #fff; }

/* ---------- Navbar: collapsed menu (below xl) ---------- */
@media (max-width: 1199.98px) {
    #navbar { padding: 10px 16px !important; }
    #navbar > .container { padding-right: 0; padding-left: 0; }

    #navbar .navbar-brand {
        margin-right: .5rem;
        font-size: clamp(.9rem, 3.6vw, 1.2rem);
    }

    #navbar .navbar-collapse { max-height: calc(100vh - 75px); overflow-y: auto; }
    #navbar .home-nav-action { display: inline-block; margin: .5rem 0 1rem; }

    #navbar .navbar-nav .active > .nav-link:not(.dropdown-toggle)::after {
        right: auto;
        width: 3rem;
    }
}

/* ---------- Footer ----------
   Phones: one column, centred brand, menu groups as foldable cards.
   992px and up: brand | three menu columns | map card.            */
.site-footer {
    position: relative;
    clear: both; /* some pages leave a float (e.g. pagination float:right) open above the footer */
    overflow: hidden;
    padding: 2.5rem 16px 2rem;
    color: rgba(255, 255, 255, .9);
    background:
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(200, 140, 255, .40), transparent 70%),
        radial-gradient(ellipse 70% 35% at 0% 55%, rgba(170, 110, 245, .28), transparent 70%),
        radial-gradient(ellipse 50% 30% at 100% 100%, rgba(150, 90, 235, .30), transparent 70%),
        linear-gradient(160deg, #7a2fd0 0%, #5a17ab 40%, #45108a 100%);
}

.site-footer-inner {
    display: grid;
    gap: 1.25rem;
    max-width: 1320px;
    margin: 0 auto;
}

.site-footer a { color: rgba(255, 255, 255, .92); text-decoration: none; }
.site-footer a:hover { color: #ffd38a; }

/* brand */
.sf-brand { display: grid; gap: 1.1rem; justify-items: center; text-align: center; }
.sf-brand-head { display: flex; align-items: center; gap: 1rem; }
.sf-logo {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 112px;
    height: 80px;
    padding: .45rem;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(30, 5, 70, .25);
}
.sf-logo img { width: 100%; height: 100%; object-fit: contain; }
.sf-brand-name {
    display: grid;
    gap: .15rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, .35);
    text-align: left;
}
.sf-brand-name strong { color: #fff; font-size: 1.3rem; font-weight: 700; line-height: 1.25; }
.sf-brand-name span { font-size: .85rem; opacity: .85; }
.sf-tagline { max-width: 34rem; margin: 0; line-height: 1.6; }

/* donate button: shown under the tagline on phones, next to the social icons on desktop */
.sf-donate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    padding: .8rem 1.6rem;
    color: #5a17ab !important;
    background: linear-gradient(180deg, #fff 0%, #ece0ff 100%);
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(30, 5, 70, .28);
    font-weight: 700;
    font-size: 1.05rem;
    transition: transform .15s ease, box-shadow .15s ease;
}
.sf-donate:hover { color: #3f0f7a !important; transform: translateY(-2px); box-shadow: 0 14px 28px rgba(30, 5, 70, .35); }
.sf-donate .fa-heart { font-size: 1.2em; }
.sf-donate-bottom { display: none; }

/* contact */
.sf-contact {
    display: grid;
    gap: .75rem;
    width: 100%;
    max-width: 34rem;
    margin: 0;
    padding: 1rem 1.1rem;
    list-style: none;
    text-align: left;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 18px;
    backdrop-filter: blur(6px);
}
.sf-contact li { display: flex; align-items: flex-start; gap: .85rem; line-height: 1.55; }
.sf-contact li > a, .sf-contact li > span:last-child { padding-top: .3rem; overflow-wrap: anywhere; }
.sf-ic, .sf-gic {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2.2rem;
    height: 2.2rem;
    color: #fff;
    background: linear-gradient(135deg, #b27bff, #8a3fe0);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(30, 5, 70, .25);
}

.sf-actions { display: flex; justify-content: center; }
.sf-social { display: flex; gap: .75rem; }
.sf-social a {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    font-size: 1.35rem;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 14px;
    transition: background .15s ease, transform .15s ease;
}
.sf-social a:hover { color: #fff; background: rgba(255, 255, 255, .26); transform: translateY(-2px); }

/* menu groups */
.sf-menus { display: grid; gap: .85rem; }
.sf-group {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 16px;
    overflow: hidden;
}
.sf-group summary {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .7rem 1rem;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
    background: rgba(255, 255, 255, .06);
}
.sf-group summary::-webkit-details-marker { display: none; }
.sf-group summary::after {
    content: "";
    width: .6rem;
    height: .6rem;
    margin-left: auto;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-135deg);
    transition: transform .2s ease;
}
.sf-group:not([open]) summary::after { transform: rotate(45deg); }
.sf-group ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem 1rem;
    margin: 0;
    padding: .75rem 1rem .9rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, .14);
}
.sf-group li { font-size: .95rem; line-height: 1.5; }
.sf-group li::marker { color: rgba(255, 255, 255, .7); }

/* map */
.sf-map {
    display: grid;
    gap: .9rem;
    justify-items: center;
    padding: .9rem;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 22px;
}
.sf-map iframe { display: block; width: 100%; height: 220px; border: 0; border-radius: 16px; }
.sf-map-btn {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem 1.4rem;
    color: #5a17ab !important;
    background: linear-gradient(180deg, #fff 0%, #ece0ff 100%);
    border-radius: 999px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(30, 5, 70, .25);
}
.sf-map-btn:hover { color: #3f0f7a !important; }

@media (max-width: 420px) {
    .sf-brand-head { gap: .7rem; }
    .sf-logo { width: 92px; height: 66px; }
    .sf-brand-name { padding-left: .7rem; }
    .sf-brand-name strong { font-size: 1.1rem; }
    .sf-brand-name span { font-size: .75rem; }
}

/* 992px+: brand and map side by side, menus in three columns below */
@media (min-width: 992px) {
    .site-footer { padding: 3rem clamp(24px, 4vw, 64px) 2.5rem; }
    .site-footer-inner {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas: "brand map" "menus menus";
        gap: 2rem 3rem;
        align-items: start;
    }
    .sf-brand { grid-area: brand; }
    .sf-menus { grid-area: menus; }
    .sf-map { grid-area: map; }
    .sf-map-btn { white-space: nowrap; }
    .sf-brand { justify-items: start; text-align: left; gap: 1rem; }
    .sf-donate-top { display: none; }
    .sf-donate-bottom { display: inline-flex; padding: .65rem 1.3rem; font-size: 1rem; white-space: nowrap; }
    .sf-brand-name strong { white-space: nowrap; font-size: 1.2rem; }
    .sf-brand-name span { white-space: nowrap; font-size: .8rem; }
    .sf-group li { font-size: .92rem; }
    .sf-contact { padding: 0; background: none; border: 0; backdrop-filter: none; }
    .sf-actions { align-items: center; gap: 1rem; }
    .sf-social { padding-left: 1rem; border-left: 1px solid rgba(255, 255, 255, .3); }

    .sf-menus {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0;
        padding-top: 1.5rem;
        border-top: 1px solid rgba(255, 255, 255, .2);
    }
    .sf-group {
        padding: 0 .9rem;
        background: none;
        border: 0;
        border-radius: 0;
    }
    .sf-group + .sf-group { border-left: 1px solid rgba(255, 255, 255, .14); }
    .sf-group summary {
        padding: .2rem 0 .8rem;
        background: none;
        border-bottom: 2px solid rgba(255, 255, 255, .22);
        cursor: default;
        pointer-events: none;
    }
    .sf-group summary::after { display: none; }
    .sf-group ul {
        grid-template-columns: 1fr;
        padding: .9rem 0 0 1.1rem;
        border-top: 0;
    }
    .sf-map iframe { height: 260px; }
}

/* 1280px+: one row — brand | three menu columns | map */
@media (min-width: 1280px) {
    .site-footer-inner {
        grid-template-columns: minmax(360px, 1.25fr) minmax(0, 2fr) minmax(280px, 1fr);
        grid-template-areas: "brand menus map";
        gap: 2rem;
    }
    .sf-menus {
        padding: 0 .5rem;
        border-top: 0;
        border-left: 1px solid rgba(255, 255, 255, .2);
    }
    .sf-map iframe { height: 210px; }
}

.footer {
    height: auto;
    padding: .9rem 1rem;
    color: rgba(255, 255, 255, .75);
    background: #24094a;
    font-size: .85rem;
    line-height: 1.6;
    text-align: center;
}

.footer a { color: #fff; }

/* ---------- Floating buttons / cookie bar ---------- */
.to-top,
.copy-link-float,
.install-shortcut-float {
    color: #fff;
    background: var(--ssm-primary);
}

.to-top:hover,
.copy-link-float:hover,
.install-shortcut-float:hover {
    color: #fff;
    background: var(--ssm-dark);
}

/* share menu: opens above the floating share button (includes/footer.php) */
.share-float-menu {
    position: fixed;
    right: calc(2% + 30px);
    bottom: calc(2% + 52px);
    z-index: 10000;
    display: grid;
    gap: .3rem;
    min-width: 200px;
    padding: .6rem;
    background: #fff;
    border: 1px solid var(--ssm-border, #e5ddf4);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(34, 22, 68, .22);
}
.share-float-menu[hidden] { display: none; }
.share-float-title {
    margin: .1rem .5rem .25rem;
    font-size: .82rem;
    font-weight: 700;
    color: var(--ssm-muted, #514a70);
}
.share-float-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    padding: .45rem .55rem;
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    text-align: left;
    color: var(--ssm-text, #1c174c);
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
}
.share-float-item[hidden] { display: none; }
.share-float-item:hover,
.share-float-item:focus-visible { color: var(--ssm-text, #1c174c); background: var(--ssm-soft, #f3ecfe); text-decoration: none; }
.share-float-item i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.1rem;
    width: 2.1rem;
    height: 2.1rem;
    font-size: 1rem;
    color: #fff;
    border-radius: 50%;
}
.share-float-item.is-facebook i { background: #1877f2; }
.share-float-item.is-line i { background: #06c755; font-size: 1.15rem; }
.share-float-item.is-copy i { background: var(--ssm-primary); }
.share-float-item.is-native i { background: #64748b; }

.install-shortcut-notice-accept { background: var(--ssm-primary); color: #fff; }

#cookie-consent > div {
    color: #fff !important;
    background: var(--ssm-dark) !important;
    border-color: rgba(255, 255, 255, .15) !important;
}

#cookie-consent-accept {
    color: #fff !important;
    background: var(--ssm-primary) !important;
}
