/* ==========================================================================
   Site-wide fixes layered on top of style.css
   ========================================================================== */

/* ---- Prevent horizontal scrolling caused by CMS content ----------------- */
html, body { overflow-x: hidden; }

/* Rich-text content pasted into the editor carries inline fixed widths
   (e.g. style="width: 1076px"). Keep it inside the viewport. */
.page-content,
.page-section .container { max-width: 100%; }
.page-content [style*="width"],
.page-section .container > [style*="width"] { max-width: 100% !important; box-sizing: border-box; }
.page-content img,
.page-content video,
.page-content iframe { max-width: 100% !important; height: auto; }
.page-content iframe { aspect-ratio: 16 / 9; height: auto !important; }
.page-content table { display: block; max-width: 100%; overflow-x: auto; }
.page-content pre { white-space: pre-wrap; word-break: break-word; }
.page-content { overflow-wrap: anywhere; word-break: normal; }

/* ---- Header -------------------------------------------------------------- */
.custom-navbar .btn-link.nav-link { color: inherit; text-decoration: none; font: inherit; }
.custom-navbar .btn-link.nav-link:hover { text-decoration: underline; }
.top-nav .dropdown-item.active,
.top-nav .dropdown-item:active { background-color: #1f5c9a; color: #fff; }
.top-nav .dropdown-menu { max-height: 75vh; overflow-y: auto; }
.nib-logo img, .flag img { max-width: 100%; height: auto; }

@media (max-width: 767px) {
    .nib-title { font-size: clamp(14px, 4.4vw, 22px); line-height: 1.2; }
    .nib-subtitle { font-size: 11px; }
    .custom-navbar .navbar-nav .nav-link { padding: 4px 8px; font-size: 13px; }
}

/* ---- Media lists / galleries ---------------------------------------------- */
.video-thumb img, .gallery-item img { max-width: 100%; }
.media-empty {
    text-align: center; padding: 48px 16px; color: #6b7280;
    border: 1px dashed #cbd5e1; border-radius: 10px; background: #f8fafc;
}
.media-empty i { font-size: 32px; display: block; margin-bottom: 10px; color: #94a3b8; }
.doc-card { display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; padding: 24px; height: 100%; text-decoration: none; color: inherit; }
.doc-card i { font-size: 48px; color: #c0392b; }

/* ---- Home page highlight blocks ------------------------------------------ */
.home-highlight + .home-highlight { margin-top: 8px; }

/* ---- Contact map ----------------------------------------------------------- */
.contact-map iframe { width: 100%; min-height: 320px; border: 0; border-radius: 10px; }

/* ---- Verification pages ---------------------------------------------------- */
#errorMsg { max-width: 640px; margin: 16px auto 0; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.status-verified { background: #dcfce7; color: #166534; }
.status-expired  { background: #fee2e2; color: #991b1b; }
.status-pending  { background: #fef9c3; color: #854d0e; }

/* ---- Shared lightbox (moved out of the layout's inline <style>) ------------ */
#lightbox {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85);
    display: none; align-items: center; justify-content: center; z-index: 9999; overflow: hidden;
}
#lightbox-img { max-width: 90%; max-height: 80%; border-radius: 8px; transition: transform .3s ease; cursor: zoom-in; }
#lightbox-img.zoomed { transform: scale(2); cursor: zoom-out; }
#lightbox .close-btn { position: absolute; top: 20px; right: 30px; font-size: 40px; color: #fff; cursor: pointer; }

/* ---- Forms ---------------------------------------------------------------- */
.error-text:empty { display: none; }

/* ==========================================================================
   PROFESSIONAL POLISH LAYER  (visual refinement only — no content changes)
   Brand tokens derived from the existing palette so nothing clashes.
   ========================================================================== */
:root {
    --nib-blue: #1e5aa8;
    --nib-blue-dark: #15447f;
    --nib-indigo: #343a97;
    --nib-gold: #df9d4d;
    --nib-red: #d30000;
    --nib-ink: #1f2937;
    --nib-muted: #5b6676;
    --nib-line: #e6e9f0;
    --nib-radius: 12px;
    --nib-shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --nib-shadow: 0 6px 18px rgba(16, 24, 40, .08);
    --nib-shadow-lg: 0 16px 40px rgba(16, 24, 40, .12);
    --nib-ease: .25s cubic-bezier(.4, 0, .2, 1);
}

/* ---- Base rhythm --------------------------------------------------------- */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; color: var(--nib-ink); }
main#main-content { overflow: clip; }
img { max-width: 100%; }
::selection { background: rgba(30, 90, 168, .18); }

/* ---- Accessible focus ---------------------------------------------------- */
a:focus-visible, button:focus-visible, .nav-link:focus-visible,
.form-control:focus-visible, .btn:focus-visible {
    outline: 3px solid rgba(30, 90, 168, .45);
    outline-offset: 2px;
}

/* ---- Top indigo bar + angled strip: crisper, keeps existing colours ------ */
.top-nav { box-shadow: var(--nib-shadow-sm); }
.top-nav .nav-link { transition: color var(--nib-ease), background var(--nib-ease); border-radius: 6px; }
.top-nav .nav-link:hover,
.top-nav .nav-link.active { background: rgba(255, 255, 255, .12); color: #fff !important; }
.custom-navbar { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }
.navbar-nav .nav-link { transition: color var(--nib-ease); }

/* ---- Dropdown menus: softer, animated ------------------------------------ */
.top-nav .dropdown-menu {
    border: 0; border-radius: var(--nib-radius); padding: 8px;
    box-shadow: var(--nib-shadow-lg); margin-top: 6px;
    animation: nibFade var(--nib-ease);
}
.top-nav .dropdown-item {
    border-radius: 8px; padding: 8px 14px; font-weight: 500;
    transition: background var(--nib-ease), color var(--nib-ease), padding-left var(--nib-ease);
}
.top-nav .dropdown-item:hover { background: #f1f5fb; color: var(--nib-blue-dark); padding-left: 18px; }
@keyframes nibFade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Section headings: refined accent underline -------------------------- */
.section-title { position: relative; letter-spacing: -.01em; }
.section-title::after {
    content: ""; display: block; width: 68px; height: 4px; margin-top: 12px;
    background: linear-gradient(90deg, var(--nib-gold), var(--nib-blue)); border-radius: 999px;
}
.text-center .section-title::after, .section-title.text-center::after { margin-left: auto; margin-right: auto; }

/* ---- Cards & panels: consistent elevation -------------------------------- */
.card { border: 1px solid var(--nib-line); border-radius: var(--nib-radius); box-shadow: var(--nib-shadow-sm); transition: box-shadow var(--nib-ease), transform var(--nib-ease); }
.card:hover { box-shadow: var(--nib-shadow); }
.zone-card { border: 1px solid var(--nib-line); }

/* ---- Buttons: unified, tactile ------------------------------------------- */
.btn { border-radius: 10px; font-weight: 600; letter-spacing: .01em; transition: transform var(--nib-ease), box-shadow var(--nib-ease), background var(--nib-ease), filter var(--nib-ease); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-report, .btn-join, .btn-submit, .btn-register, .btn-primary {
    box-shadow: 0 4px 12px rgba(30, 90, 168, .22);
}
.btn-report:hover, .btn-join:hover, .btn-submit:hover, .btn-register:hover, .btn-primary:hover {
    box-shadow: 0 8px 20px rgba(30, 90, 168, .30); filter: saturate(1.05);
}

/* ---- Forms: brand-blue focus ring ---------------------------------------- */
.form-control, .form-select {
    border-radius: 10px; border-color: #d7dce5; transition: border-color var(--nib-ease), box-shadow var(--nib-ease);
}
.form-control:focus, .form-select:focus {
    border-color: var(--nib-blue); box-shadow: 0 0 0 .22rem rgba(30, 90, 168, .15);
}
.form-label { font-weight: 600; color: var(--nib-ink); }

/* ---- Tables: cleaner lines ----------------------------------------------- */
.table { --bs-table-border-color: var(--nib-line); }
.table thead th { background: #f4f6fb; color: var(--nib-ink); font-weight: 700; border-bottom: 2px solid var(--nib-line); }
.table-hover tbody tr { transition: background var(--nib-ease); }

/* ---- Footer: tidier social buttons & spacing ----------------------------- */
.footer-top { border-top: 4px solid var(--nib-gold); }
.footer-heading { position: relative; padding-bottom: 10px; }
.footer-heading::after { content: ""; position: absolute; left: 0; bottom: 0; width: 38px; height: 3px; background: var(--nib-gold); border-radius: 999px; }
.footer-links a { transition: color var(--nib-ease), padding-left var(--nib-ease); display: inline-block; }
.footer-links a:hover { padding-left: 5px; text-decoration: none; color: var(--nib-gold); }
.social-btn { border-radius: 10px; transition: transform var(--nib-ease), background var(--nib-ease), color var(--nib-ease), border-color var(--nib-ease); }
.social-btn:hover { transform: translateY(-2px); }

/* ---- Media / gallery tiles: subtle lift ---------------------------------- */
.video-thumb, .gallery-item { border-radius: var(--nib-radius); overflow: hidden; transition: transform var(--nib-ease), box-shadow var(--nib-ease); }
.video-thumb:hover, .gallery-item:hover { transform: translateY(-4px); box-shadow: var(--nib-shadow); }
.video-thumb img, .gallery-item img { transition: transform .4s ease; }
.video-thumb:hover img, .gallery-item:hover img { transform: scale(1.04); }

/* ---- Verification / status cards ----------------------------------------- */
.verification-card { box-shadow: var(--nib-shadow-lg); border-radius: 16px; }

/* ---- Owl nav arrows ------------------------------------------------------- */
.owl-carousel .owl-nav button.owl-prev, .owl-carousel .owl-nav button.owl-next {
    width: 40px; height: 40px; border-radius: 50% !important; background: #fff !important;
    color: var(--nib-blue) !important; box-shadow: var(--nib-shadow); transition: background var(--nib-ease), color var(--nib-ease);
}
.owl-carousel .owl-nav button:hover { background: var(--nib-blue) !important; color: #fff !important; }

/* ---- Custom scrollbar (desktop) ------------------------------------------ */
@media (pointer: fine) {
    * { scrollbar-width: thin; scrollbar-color: #c3ccda transparent; }
    ::-webkit-scrollbar { width: 11px; height: 11px; }
    ::-webkit-scrollbar-thumb { background: #c3ccda; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
    ::-webkit-scrollbar-thumb:hover { background: #9aa6bb; background-clip: content-box; }
}

/* ---- Respect reduced-motion preferences ---------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
    .btn:hover, .social-btn:hover, .video-thumb:hover, .gallery-item:hover { transform: none; }
}
