/* ═══════════════════════════════════════════════
   PhuketWaste — assets/css/style.css
   Design System · v1.0
═══════════════════════════════════════════════ */

/* ── Variables ── */
:root {
    --green: #1a6b3a;
    --blue: #0077b6;
    --orange: #f4a261;
    --dark: #1e293b;
    --bg: #f1f5f9;
    --radius: 14px;
}

/* ── Reset & Base ── */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--dark);
    overflow-x: hidden;
}

/* ═════════════════════════════
   NAVBAR
═════════════════════════════ */
#topNav {
    background: var(--dark) !important;
    box-shadow: none;
    transition: box-shadow .3s ease;
    z-index: 1060;
}

#topNav.scrolled {
    box-shadow: 0 2px 24px rgba(0, 0, 0, .3);
}

.brand-text {
    font-weight: 900;
    font-size: 1.35rem;
}

.brand-p {
    color: #fff;
}

.brand-w {
    color: var(--orange);
}

/* Toggler */
.navbar-toggler {
    border-color: rgba(255, 255, 255, .25);
}

.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='rgba%28255,255,255,0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* CTA Button */
.btn-add {
    background: var(--orange);
    color: var(--dark) !important;
    font-weight: 700;
    border: none;
    border-radius: 9px;
    transition: all .2s ease;
}

.btn-add:hover,
.btn-add:focus {
    background: #e08c55;
    color: var(--dark);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(244, 162, 97, .35);
}

/* ═════════════════════════════
   HERO SECTION
═════════════════════════════ */
.hero {
    background: linear-gradient(135deg,
            var(--dark) 0%,
            #1a3a5c 52%,
            #145530 100%);
    padding: 90px 0 110px;
    position: relative;
    overflow: hidden;
}

/* Decorative circles */
.hero::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -100px;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .04);
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -100px;
    left: -80px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: rgba(74, 222, 128, .06);
    pointer-events: none;
}

.hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.6rem);
    font-weight: 900;
    color: #fff;
    line-height: 1.25;
    margin-bottom: 16px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    color: rgba(255, 255, 255, .92);
    padding: 6px 18px;
    border-radius: 100px;
    font-size: .82rem;
    font-weight: 600;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.hero-desc {
    color: rgba(255, 255, 255, .75);
    font-size: 1rem;
    line-height: 1.78;
    margin-bottom: 30px;
}

/* Glassmorphism stat cards */
.stat-glass {
    background: rgba(255, 255, 255, .1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 18px;
    padding: 22px 18px;
    text-align: center;
    transition: transform .25s ease, background .25s ease;
}

.stat-glass:hover {
    background: rgba(255, 255, 255, .18);
    transform: translateY(-4px);
}

.stat-glass .num {
    font-size: 2.1rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-glass .lbl {
    font-size: .78rem;
    color: rgba(255, 255, 255, .65);
    font-weight: 500;
}

/* ═════════════════════════════
   MAP SECTION
═════════════════════════════ */
.map-section {
    padding: 56px 0 60px;
    background: var(--bg);
}

#map {
    height: 520px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .1);
    border: 2px solid #e2e8f0;
    z-index: 1;
    position: relative;
}

/* Section titles */
.sec-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 4px;
}

.sec-sub {
    font-size: .88rem;
    color: #64748b;
    margin-bottom: 18px;
}

/* Mode buttons strip */
.mode-btn {
    font-weight: 600;
    border-radius: 9px !important;
    font-size: .84rem;
    transition: all .2s ease;
}

.mode-btn:hover {
    transform: translateY(-1px);
}

/* Filter panel */
.filter-panel {
    background: #fff;
    border-radius: var(--radius);
    padding: 18px 16px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .07);
    position: sticky;
    top: 70px;
    font-size: .84rem;
}

.filter-panel h6 {
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 4px;
}

.filter-panel .form-check-input:checked {
    background-color: var(--green);
    border-color: var(--green);
}

.filter-panel .form-check-input:focus {
    box-shadow: 0 0 0 .2rem rgba(26, 107, 58, .2);
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .78rem;
    color: #475569;
    margin-bottom: 7px;
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ═════════════════════════════
   STATS SECTION
═════════════════════════════ */
.stat-card {
    background: #fff;
    border-radius: 18px;
    padding: 28px 22px;
    text-align: center;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .06);
    border: 1.5px solid #f1f5f9;
    transition: transform .25s ease, box-shadow .25s ease;
    height: 100%;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .1);
}

.stat-card .icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
    display: block;
    line-height: 1;
}

.stat-card .value {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-card .label {
    font-size: .82rem;
    color: #64748b;
    margin-bottom: 12px;
}

.stat-card .chip {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: .71rem;
    font-weight: 600;
}

/* ═════════════════════════════
   BACKGROUND UTILITIES
═════════════════════════════ */
.bg-light-green {
    background: #f0fdf4;
}

/* ═════════════════════════════
   ACTIVITY FEED CARDS
═════════════════════════════ */
.activity-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 16px 18px;
    border: 1.5px solid #e2e8f0;
    border-left: 4px solid var(--green);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
    transition: box-shadow .22s ease, transform .22s ease;
}

.activity-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
    transform: translateX(4px);
}

.activity-card.marine {
    border-left-color: var(--blue);
}

.activity-card.event {
    border-left-color: var(--orange);
}

.av-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* Badge colors */
.bw-green {
    background: var(--green) !important;
}

.bw-blue {
    background: var(--blue) !important;
}

.bw-orange {
    background: var(--orange) !important;
    color: var(--dark) !important;
}

/* ═════════════════════════════
   COMMUNITY RANKING
═════════════════════════════ */
.rank-item {
    background: #fff;
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
    border: 1.5px solid #f1f5f9;
    transition: box-shadow .2s ease, transform .2s ease;
}

.rank-item:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, .1);
    transform: translateX(3px);
}

.rank-num {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1rem;
    flex-shrink: 0;
}

.r1 {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #fff;
    box-shadow: 0 3px 10px rgba(251, 191, 36, .35);
}

.r2 {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    color: #fff;
}

.r3 {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
    box-shadow: 0 3px 10px rgba(217, 119, 6, .3);
}

.rn {
    background: #f1f5f9;
    color: #64748b;
}

/* ═════════════════════════════
   CTA SECTION
═════════════════════════════ */
.cta-section {
    background: linear-gradient(135deg, #145530 0%, #1a3a5c 100%);
    padding: 90px 0;
    text-align: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .04);
    pointer-events: none;
}

.cta-desc {
    font-size: 1rem;
    color: rgba(255, 255, 255, .8);
    line-height: 1.78;
    margin-bottom: 32px;
}

/* ═════════════════════════════
   FOOTER
═════════════════════════════ */
footer {
    background: var(--dark);
    padding: 48px 0 20px;
    color: #94a3b8;
    font-size: .88rem;
}

footer a {
    color: #94a3b8;
    text-decoration: none;
    transition: color .2s;
}

footer a:hover {
    color: #4ade80;
}

footer .brand {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
}

.footer-social {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.footer-social a {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .07);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    color: #94a3b8;
    transition: all .2s;
}

.footer-social a:hover {
    background: var(--green);
    color: #fff;
    transform: translateY(-2px);
}

/* ═════════════════════════════
   FAB (Mobile Filter Button)
═════════════════════════════ */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--orange);
    color: var(--dark);
    border: none;
    box-shadow: 0 4px 18px rgba(244, 162, 97, .45);
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .25s ease;
}

.fab:hover {
    background: #e08c55;
    transform: scale(1.12);
    box-shadow: 0 6px 24px rgba(224, 140, 85, .55);
}

@media (min-width: 992px) {
    .fab {
        display: none;
    }
}

/* ═════════════════════════════
   LEAFLET POPUP OVERRIDES
═════════════════════════════ */
.leaflet-popup-content-wrapper {
    border-radius: 14px !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .14) !important;
    border: none !important;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, sans-serif !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    line-height: 1.5 !important;
    font-size: .85rem !important;
    min-width: 200px !important;
}

.leaflet-popup-tip-container {
    margin-top: -1px !important;
}

.leaflet-control-attribution {
    font-size: .68rem !important;
}

.leaflet-control-zoom a {
    border-radius: 8px !important;
    font-size: 1rem !important;
}

.leaflet-control-zoom-in {
    border-radius: 8px 8px 0 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 0 8px 8px !important;
}

/* ═════════════════════════════
   MARKER PULSE ANIMATION
═════════════════════════════ */
@keyframes markerPulse {
    0% {
        transform: scale(1);
        opacity: .75;
    }

    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    animation: markerPulse 1.6s infinite ease-out;
}

/* Counter animation helper */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-up {
    animation: fadeUp .5s ease both;
}

/* ═════════════════════════════
   RESPONSIVE
═════════════════════════════ */
@media (max-width: 1199px) {
    #map {
        height: 480px;
    }
}

@media (max-width: 991px) {
    .hero {
        padding: 56px 0 70px;
    }

    #map {
        height: 420px;
    }

    .map-section {
        padding: 36px 0 40px;
    }
}

@media (max-width: 767px) {
    .hero {
        padding: 44px 0 56px;
    }

    .hero h1 {
        font-size: 1.7rem;
    }

    #map {
        height: 350px;
        border-radius: 12px;
    }

    .sec-title {
        font-size: 1.2rem;
    }

    .stat-card .value {
        font-size: 1.75rem;
    }

    .cta-section {
        padding: 60px 0;
    }

    .cta-desc {
        font-size: .9rem;
    }

    .stat-glass .num {
        font-size: 1.7rem;
    }
}

@media (max-width: 480px) {
    #map {
        height: 300px;
    }

    .stat-card {
        padding: 20px 14px;
    }

    .rank-item {
        padding: 11px 14px;
    }
}