/*
|--------------------------------------------------------------------------
| Global Design System
|--------------------------------------------------------------------------
| Colors, typography, and base element styles shared across every page.
*/

:root {
    --maroon-900: #3d0c1e;
    --maroon-800: #4a0f22;
    --maroon-700: #5c1029;
    --maroon-600: #6d1a35;
    --maroon-500: #7f2242;

    --gold: #d4a017;
    --gold-dark: #b8860b;
    --gold-light: #e8c04a;

    --cream: #f8f5ef;
    --cream-dark: #f1ebe0;

    --text-dark: #241016;
    --text-muted: #6b5a5e;
    --border-color: #e8e1d8;

    --soft-pink: #f5e2e6;
    --soft-pink-icon: #ac3b57;
    --soft-gold: #f5ecd6;
    --soft-gold-icon: #b8860b;
    --soft-orange: #fbe6d8;
    --soft-orange-icon: #d97b3f;
    --soft-green: #d9f0e3;
    --soft-green-icon: #1e9c63;
    --soft-blue: #dbe8fb;
    --soft-blue-icon: #3568c9;
    --soft-purple: #e8dcf5;
    --soft-purple-icon: #8548c9;

    /* Card/panel/topbar surface -- separate from --cream (the page
       background) so dark mode below can flip them independently, the way
       a real dark UI needs an elevated surface tone distinct from the
       page's own background. */
    --surface: #ffffff;

    --shadow-sm: 0 1px 2px rgba(36, 16, 22, 0.05);
    --shadow-md: 0 2px 6px rgba(36, 16, 22, 0.05), 0 10px 24px rgba(36, 16, 22, 0.07);
    --shadow-lg: 0 4px 10px rgba(36, 16, 22, 0.06), 0 20px 44px rgba(36, 16, 22, 0.13);

    --font-display: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --font-body: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* --------------------------------------------------------------------
   Dark Mode
   -------------------------------------------------------------------- */
/* Applies to <html data-theme="dark">, set server-side from the admin's
   Appearance > Default Theme setting and overridable per-user via the
   topbar toggle (assets/js/main.js persists the choice to localStorage).
   Only the semantic surface/text tokens flip -- the maroon/gold brand
   ramp stays the same on purpose, it's the site's identity in either mode.
   Paired with data-bs-theme="dark" (set alongside data-theme by
   includes/header.php) so Bootstrap's own components -- modals, dropdowns,
   forms, tables -- switch using Bootstrap 5.3's built-in dark theme. */
:root[data-theme="dark"] {
    --surface: #241016;
    --cream: #1a0d11;
    --cream-dark: #2c161c;
    --text-dark: #f1e7e2;
    --text-muted: #b9a5ab;
    --border-color: #3d2830;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3), 0 10px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.35), 0 20px 44px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    background-color: var(--cream);
    color: var(--text-dark);
    font-family: var(--font-body);
    font-feature-settings: "tnum" 1;
}

/* .font-serif is a legacy name for the heading/display font utility --
   both it and body text now use the same Public Sans family (see
   --font-display/--font-body above); kept as a separate class/variable
   pair rather than renamed, since it's referenced across every page. */
h1, h2, h3, h4, h5, h6,
.font-serif {
    font-family: var(--font-display);
    color: var(--text-dark);
    font-weight: 700;
    letter-spacing: -0.01em;
}

a {
    color: var(--maroon-600);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--maroon-700);
}

.text-muted {
    color: var(--text-muted) !important;
}

/* --------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------- */

.btn {
    border-radius: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.005em;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(155deg, var(--maroon-500) 0%, var(--maroon-600) 45%, var(--maroon-700) 100%);
    border-color: var(--maroon-700);
    box-shadow: 0 2px 6px rgba(74, 15, 34, 0.28);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background: linear-gradient(155deg, var(--maroon-600) 0%, var(--maroon-700) 45%, var(--maroon-800) 100%) !important;
    border-color: var(--maroon-800) !important;
    box-shadow: 0 6px 16px rgba(74, 15, 34, 0.32);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--maroon-600);
    border-color: var(--maroon-600);
}

.btn-outline-primary:hover {
    background-color: var(--maroon-600);
    border-color: var(--maroon-600);
    box-shadow: 0 2px 6px rgba(109, 26, 53, 0.2);
    transform: translateY(-1px);
}

.btn-outline-secondary:hover {
    transform: translateY(-1px);
}

.text-primary {
    color: var(--maroon-600) !important;
}

.bg-primary {
    background-color: var(--maroon-700) !important;
}

.link-gold {
    color: var(--gold-dark);
    font-weight: 600;
}

.link-gold:hover {
    color: var(--maroon-700);
}

/* --------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------- */

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.form-control,
.form-select {
    border-radius: 0.6rem;
    border-color: var(--border-color);
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--maroon-500);
    box-shadow: 0 0 0 0.2rem rgba(109, 26, 53, 0.15);
}

/* --------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------- */

.card {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

/* --------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------- */

/* Safety net so long forms always scroll and their footer/submit button
   stays reachable, even on modals that don't use Bootstrap's
   .modal-dialog-scrollable, or on short viewports. Applied unconditionally
   (not just as a fallback) because some modal-dialog-scrollable forms are
   tall enough that .modal-content's own max-height:100% cap still leaves
   the footer past the fold without this. */
.modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* --------------------------------------------------------------------
   Badges / Status Pills
   -------------------------------------------------------------------- */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}

.status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.status-pending { background: var(--soft-orange); color: var(--soft-orange-icon); border-color: rgba(217, 123, 63, 0.25); }
.status-verified { background: var(--soft-blue); color: var(--soft-blue-icon); border-color: rgba(53, 104, 201, 0.2); }
.status-approved { background: var(--soft-green); color: var(--soft-green-icon); border-color: rgba(30, 156, 99, 0.2); }
.status-rejected { background: var(--soft-pink); color: var(--soft-pink-icon); border-color: rgba(172, 59, 87, 0.2); }
.status-released { background: var(--soft-purple); color: var(--soft-purple-icon); border-color: rgba(133, 72, 201, 0.2); }
.status-forwarded { background: var(--soft-gold); color: var(--soft-gold-icon); border-color: rgba(184, 134, 11, 0.2); }
.status-active { background: var(--soft-green); color: var(--soft-green-icon); border-color: rgba(30, 156, 99, 0.2); }
.status-inactive { background: #eee; color: #777; border-color: rgba(0, 0, 0, 0.08); }
.status-completed { background: var(--soft-blue); color: var(--soft-blue-icon); border-color: rgba(53, 104, 201, 0.2); }

/* Role badges (User Management directory) -- one tone per level of the
   hierarchy so the org chart reads at a glance. */
.status-pill.role-system_admin { background: linear-gradient(135deg, var(--maroon-600), var(--maroon-800)); color: #fff; border-color: var(--maroon-800); }
.status-pill.role-national_admin { background: var(--soft-gold); color: var(--soft-gold-icon); border-color: rgba(184, 134, 11, 0.2); }
.status-pill.role-provincial_admin { background: var(--soft-purple); color: var(--soft-purple-icon); border-color: rgba(133, 72, 201, 0.2); }
.status-pill.role-city_officer { background: var(--soft-blue); color: var(--soft-blue-icon); border-color: rgba(53, 104, 201, 0.2); }
.status-pill.role-mayor { background: var(--soft-green); color: var(--soft-green-icon); border-color: rgba(30, 156, 99, 0.2); }
.status-pill.role-barangay_captain { background: var(--soft-orange); color: var(--soft-orange-icon); border-color: rgba(217, 123, 63, 0.2); }
.status-pill.role-barangay_staff { background: var(--soft-pink); color: var(--soft-pink-icon); border-color: rgba(172, 59, 87, 0.2); }
.status-pill.role-citizen { background: #eee; color: #666; border-color: rgba(0, 0, 0, 0.08); }
.status-pill.role-system_admin::before { background: #fff; }

/* --------------------------------------------------------------------
   Breadcrumb / Topbar
   -------------------------------------------------------------------- */

.app-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 var(--gold), var(--shadow-sm);
    padding: 0.6rem 1.25rem;
}

.app-topbar .breadcrumb {
    margin-bottom: 0;
    font-size: 0.85rem;
}

.app-topbar .icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: transparent;
    border: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.app-topbar .icon-btn:hover {
    background: var(--cream-dark);
    color: var(--maroon-600);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--maroon-600), var(--maroon-800));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    font-family: var(--font-display);
    box-shadow: 0 2px 6px rgba(74, 15, 34, 0.3);
}

.user-chip .user-name {
    font-weight: 600;
    font-size: 0.82rem;
    line-height: 1.1;
}

.user-chip .user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------- */

.icon-square {
    width: 42px;
    height: 42px;
    border-radius: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.icon-square.pink { background: linear-gradient(145deg, #f8ebee, var(--soft-pink)); color: var(--soft-pink-icon); box-shadow: inset 0 0 0 1px rgba(172, 59, 87, 0.12); }
.icon-square.gold { background: linear-gradient(145deg, #f9f1dc, var(--soft-gold)); color: var(--soft-gold-icon); box-shadow: inset 0 0 0 1px rgba(184, 134, 11, 0.15); }
.icon-square.orange { background: linear-gradient(145deg, #fdedE1, var(--soft-orange)); color: var(--soft-orange-icon); box-shadow: inset 0 0 0 1px rgba(217, 123, 63, 0.15); }
.icon-square.green { background: linear-gradient(145deg, #e2f5ea, var(--soft-green)); color: var(--soft-green-icon); box-shadow: inset 0 0 0 1px rgba(30, 156, 99, 0.15); }
.icon-square.blue { background: linear-gradient(145deg, #e4edfc, var(--soft-blue)); color: var(--soft-blue-icon); box-shadow: inset 0 0 0 1px rgba(53, 104, 201, 0.15); }
.icon-square.purple { background: linear-gradient(145deg, #ede3f8, var(--soft-purple)); color: var(--soft-purple-icon); box-shadow: inset 0 0 0 1px rgba(133, 72, 201, 0.15); }

.empty-state {
    padding: 3.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

/* --------------------------------------------------------------------
   About Page
   -------------------------------------------------------------------- */

.about-hero {
    background:
        radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(150deg, var(--maroon-900) 0%, var(--maroon-700) 60%, var(--maroon-800) 100%);
    background-size: 22px 22px, 100% 100%;
    color: #fff;
    border-radius: 1rem 1rem 0 0;
    padding: 3rem 1.5rem;
    text-align: center;
}

.about-hero img {
    width: 108px;
    height: 108px;
    background: #fff;
    padding: 8px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.about-hero h2 {
    color: #fff;
    margin: 1.25rem 0 0.4rem;
}

.about-hero p.lead {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

.about-chip {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.about-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

.about-stat {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0.85rem;
    padding: 0.9rem 1.75rem;
    text-align: center;
    min-width: 150px;
    backdrop-filter: blur(2px);
}

.about-stat .about-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--gold-light);
    font-feature-settings: "tnum" 1;
}

.about-stat .about-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.75);
}

.about-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

.about-card h3, .about-card h4 {
    color: var(--maroon-700);
}

.about-card.accent-top {
    border-top: 3px solid var(--gold);
}

.about-icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--maroon-600), var(--maroon-800));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(74, 15, 34, 0.3);
    flex-shrink: 0;
}

.about-eyebrow {
    display: block;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold-dark);
    margin-bottom: 0.5rem;
}

.about-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    margin: 2.5rem 0;
}

.about-divider::before, .about-divider::after {
    content: "";
    flex: 1;
    max-width: 160px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color));
}

.about-divider::after {
    background: linear-gradient(90deg, var(--border-color), transparent);
}

.about-divider i {
    color: var(--gold);
    font-size: 0.85rem;
}

.feature-card {
    position: relative;
    border-top: 3px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-card.accent-pink:hover { border-top-color: var(--soft-pink-icon); }
.feature-card.accent-blue:hover { border-top-color: var(--soft-blue-icon); }
.feature-card.accent-gold:hover { border-top-color: var(--soft-gold-icon); }
.feature-card.accent-purple:hover { border-top-color: var(--soft-purple-icon); }
.feature-card.accent-green:hover { border-top-color: var(--soft-green-icon); }
.feature-card.accent-orange:hover { border-top-color: var(--soft-orange-icon); }

.feature-card .feature-number {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--cream-dark);
    line-height: 1;
    z-index: 0;
}

.feature-card .icon-square,
.feature-card h6,
.feature-card p {
    position: relative;
    z-index: 1;
}

.about-footer-frame {
    border: 1px solid var(--border-color);
    border-radius: 1.15rem;
    padding: 0.35rem;
}

.about-footer {
    background:
        radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(150deg, var(--maroon-900) 0%, var(--maroon-700) 60%, var(--maroon-800) 100%);
    background-size: 22px 22px, 100% 100%;
    color: rgba(255, 255, 255, 0.85);
    border-radius: 1rem;
    text-align: center;
    padding: 3rem 1.5rem;
}

.about-footer h5 {
    color: #fff;
}

.about-footer .credit-name {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--gold-light);
    margin-bottom: 0.5rem;
}

.about-footer hr {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 200px;
    margin: 1.75rem auto;
}

/* --------------------------------------------------------------------
   Public Landing Page
   -------------------------------------------------------------------- */

.landing-navbar {
    background: var(--maroon-900);
    padding: 0.85rem 0;
}

.landing-navbar .navbar-brand {
    padding: 0.15rem 0;
}

.landing-navbar .navbar-brand .font-serif {
    font-size: 1.3rem;
    line-height: 1.3 !important;
    letter-spacing: 0.01em;
    color: var(--gold-light) !important;
}

.landing-hero {
    background:
        radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(150deg, #240712 0%, var(--maroon-900) 55%, var(--maroon-800) 100%);
    background-size: 24px 24px, 100% 100%;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.landing-hero::before,
.landing-hero::after {
    content: "";
    position: absolute;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 2rem;
}

.landing-hero::before {
    width: 420px;
    height: 420px;
    right: -140px;
    top: -160px;
    transform: rotate(30deg);
}

.landing-hero::after {
    width: 320px;
    height: 320px;
    left: -120px;
    bottom: -140px;
    transform: rotate(15deg);
    background: rgba(212, 160, 23, 0.08);
}

.landing-hero p.lead {
    color: rgba(255, 255, 255, 0.85);
}

.landing-hero .hero-seal {
    max-width: 320px;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.35));
}

.landing-tagline {
    letter-spacing: 0.3em;
    font-size: 0.78rem;
    color: var(--gold);
    font-weight: 600;
}

/* --------------------------------------------------------------------
   Landing Page Gallery / Slideshow (admin-managed, see
   admin/system_settings.php) -- only rendered when at least one active
   image is on file, sitting below the feature-card grid so it appears
   as visitors scroll down rather than competing with the hero.
   -------------------------------------------------------------------- */

.landing-gallery {
    background: linear-gradient(180deg, var(--cream-dark) 0%, var(--cream) 100%);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.gallery-carousel {
    max-width: 900px;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.gallery-carousel .carousel-item img {
    width: 100%;
    height: 460px;
    object-fit: cover;
}

.gallery-carousel .carousel-caption {
    left: 0;
    right: 0;
    bottom: 0;
    text-align: left;
    border-radius: 0;
    /* Generous bottom padding lifts the caption text clear of the
       indicator dots, which sit right at the very bottom edge below it --
       otherwise the two absolutely-positioned overlays collide. */
    padding: 2.5rem 1.75rem 3rem;
    background: linear-gradient(180deg, rgba(36, 16, 22, 0) 0%, rgba(36, 16, 22, 0.8) 100%);
}

.gallery-carousel .carousel-caption p {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.gallery-carousel .carousel-indicators {
    margin-bottom: 0.5rem;
}

.gallery-carousel .carousel-indicators [data-bs-target] {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--gold);
    opacity: 0.5;
}

.gallery-carousel .carousel-indicators .active {
    opacity: 1;
}

.gallery-carousel .carousel-control-prev,
.gallery-carousel .carousel-control-next {
    width: 52px;
}

.gallery-carousel .carousel-control-prev-icon,
.gallery-carousel .carousel-control-next-icon {
    background-color: rgba(36, 16, 22, 0.45);
    border-radius: 50%;
    padding: 1.1rem;
    background-size: 50%;
}

@media (max-width: 576px) {
    .gallery-carousel .carousel-item img {
        height: 260px;
    }
}

