/*
Theme Name: NightRadar
Version: 3.0 Premium
*/

html, body {
    margin: 0;
    padding: 0;
    background: #0b0b0f;
    font-family: Arial, sans-serif;
    color: #fff;
}

/* ================= MAP ================= */

#map {
    width: 100%;
    height: 80vh;
}

/* ================= PULSE ================= */

.pulse-marker {
    width: 16px;
    height: 16px;
    background: #ff2d55;
    border-radius: 50%;
    position: relative;
    box-shadow:
        0 0 12px rgba(255,45,85,0.9),
        0 0 28px rgba(255,45,85,0.6),
        0 0 60px rgba(255,45,85,0.3);
}

.pulse-marker::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(255,45,85,0.5);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    70% { transform: scale(3); opacity: 0; }
    100% { opacity: 0; }
}

/* ================= TOP 5 GRID ================= */

#top5-list {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

/* ================= CARD BASE ================= */

.nr-top-card {
    width: 260px;
    min-height: 260px;
    background: linear-gradient(145deg, #10121c, #0f1422);
    border-radius: 22px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: 0.35s ease;
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow:
        0 15px 40px rgba(0,0,0,0.6),
        inset 0 0 0 1px rgba(255,255,255,0.02);
}

/* ================= LEADER ================= */

.nr-top-card.leader {
    box-shadow:
        0 0 40px rgba(255,45,85,0.5),
        0 0 80px rgba(255,45,85,0.25),
        0 15px 40px rgba(0,0,0,0.7);
    border: 1px solid rgba(255,45,85,0.4);
}

/* ================= ACTIVE STATE ================= */

.nr-top-card.active {
    box-shadow:
        0 0 35px rgba(255,45,85,0.4),
        0 15px 40px rgba(0,0,0,0.7);
    border: 1px solid rgba(255,45,85,0.35);
    transform: translateY(-6px);
}

/* ================= BADGE LEADER ================= */

.nr-leader-badge {
    font-size: 11px;
    padding: 6px 14px;
    border-radius: 30px;
    background: rgba(255,45,85,0.18);
    color: #ff2d55;
    font-weight: 600;
    margin-bottom: 14px;
    display: inline-block;
    letter-spacing: 0.5px;
}

/* ================= TYPO ================= */

.nr-rank {
    font-size: 12px;
    opacity: 0.4;
    margin-bottom: 8px;
}

.nr-title {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 6px;
}

.nr-sub {
    font-size: 13px;
    opacity: 0.7;
    margin-bottom: 16px;
}

/* ================= CROWD BADGE ================= */

.nr-badge {
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 30px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 16px;
}

.nr-crowd-low { background: #00c853; }
.nr-crowd-mid { background: #ffb300; }
.nr-crowd-high { background: #ff2d55; }

/* ================= DETAILS ================= */

.nr-details {
    font-size: 13px;
    opacity: 0.75;
    line-height: 1.6;
}

.nr-link {
    margin-top: 18px;
    font-size: 13px;
    font-weight: 600;
    color: #ff2d55;
    text-decoration: none;
}

/* ================= BUTTONS ================= */

.nr-btn {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 14px 28px;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s ease;
}

.nr-btn:hover {
    border-color: #ff2d55;
    box-shadow: 0 0 25px rgba(255,45,85,0.4);
}

.nr-btn.active {
    background: #ff2d55;
    border-color: #ff2d55;
    box-shadow: 0 0 40px rgba(255,45,85,0.6);
}
/* ===== TOP 5 PREMIUM STYLE ===== */

#top5 {
    background:#0f0f14;
}

#top5 h2 {
    font-weight:600;
    letter-spacing:1px;
    margin-bottom:30px;
}

#top5-list {
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap:20px;
}

.nr-top-card {
    position:relative;
    background:#16161d;
    padding:22px;
    border-radius:14px;
    cursor:pointer;
    transition:all 0.25s ease;
    border:1px solid rgba(255,255,255,0.05);
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    min-height:210px;
}

.nr-top-card:hover {
    transform:translateY(-4px);
    box-shadow:0 10px 30px rgba(0,0,0,0.6);
    border-color:rgba(255,255,255,0.1);
}

.nr-top-card.active {
    border-color:rgba(255,255,255,0.2);
}

.nr-rank {
    font-size:12px;
    opacity:0.5;
    margin-bottom:8px;
}

.nr-name {
    font-size:18px;
    font-weight:600;
    margin-bottom:6px;
}

.nr-type {
    font-size:13px;
    opacity:0.6;
    margin-bottom:16px;
}

.nr-crowd {
    display:inline-block;
    padding:6px 12px;
    border-radius:20px;
    font-size:13px;
    font-weight:600;
    margin-bottom:12px;
    color:#000;
}

.nr-meta {
    font-size:13px;
    opacity:0.7;
    margin-bottom:14px;
    line-height:1.4;
}

.nr-more {
    font-size:13px;
    opacity:0.8;
    transition:opacity 0.2s ease;
}

.nr-more a {
    text-decoration:none;
    color:#fff;
}

.nr-top-card:hover .nr-more {
    opacity:1;
}

/* ===== LEADER STYLE ===== */

.nr-top-card.leader {
    background:#1b1b24;
    border:1px solid rgba(255,45,85,0.4);
    box-shadow:0 0 40px rgba(255,45,85,0.15);
}

.nr-leader-badge {
    position:absolute;
    top:14px;
    right:14px;
    font-size:11px;
    letter-spacing:1px;
    text-transform:uppercase;
    color:#ff2d55;
    opacity:0.9;
}

/* subtle glow line */
.nr-top-card.leader::after {
    content:"";
    position:absolute;
    inset:0;
    border-radius:14px;
    pointer-events:none;
    box-shadow:0 0 60px rgba(255,45,85,0.1);
}
.nr-single {
    background:#0b0b0f;
    color:#fff;
}

.nr-hero {
    height:420px;
    overflow:hidden;
}

.nr-hero img {
    width:100%;
    height:100%;
    object-fit:cover;
}

.nr-thumbs {
    display:flex;
    gap:10px;
    padding:20px;
    max-width:1100px;
    margin:0 auto;
}

.nr-thumb {
    width:100px;
    height:70px;
    object-fit:cover;
    cursor:pointer;
    border-radius:6px;
    opacity:0.6;
    transition:all 0.2s ease;
}

.nr-thumb.active,
.nr-thumb:hover {
    opacity:1;
    transform:scale(1.05);
}

.nr-single-content {
    max-width:1100px;
    margin:0 auto;
    padding:40px 20px;
}

.nr-header {
    display:flex;
    justify-content:space-between;
    gap:40px;
    flex-wrap:wrap;
}

.nr-sub {
    opacity:0.6;
    margin-top:5px;
}

.nr-status {
    text-align:right;
}

.nr-crowd-text {
    font-size:42px;
    font-weight:700;
}

.nr-status-label {
    opacity:0.6;
    font-size:14px;
}

.nr-crowd-bar {
    display:flex;
    gap:10px;
    margin:30px 0;
}

.nr-crowd-bar div {
    flex:1;
    height:8px;
    border-radius:4px;
}

.nr-meta {
    line-height:1.8;
    opacity:0.8;
}

#single-map {
    height:320px;
    border-radius:12px;
    margin-top:40px;
}

.nr-back {
    margin-top:40px;
    opacity:0.6;
}

.nr-back a {
    color:#fff;
    text-decoration:none;
}
/* ===== HERO ATMOSPHERE ===== */

.nr-hero {
    position: relative;
    height: 460px;
    overflow: hidden;
}

.nr-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0) 50%,
        rgba(11,11,15,0.6) 75%,
        rgba(11,11,15,0.95) 100%
    );
    pointer-events: none;
}

.nr-hero img {
    width:100%;
    height:100%;
    object-fit:cover;
    transition: opacity 0.35s ease;
}

/* ===== THUMBS DEPTH ===== */

.nr-thumbs {
    position: relative;
    margin-top: -40px;
    padding: 0 20px 30px;
}

.nr-thumb {
    box-shadow:
        0 10px 25px rgba(0,0,0,0.6),
        0 0 0 1px rgba(255,255,255,0.05);
    border:1px solid rgba(255,255,255,0.05);
}

.nr-thumb:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow:
        0 15px 35px rgba(0,0,0,0.8),
        0 0 0 1px rgba(255,255,255,0.1);
}

/* ===== CROWD TEXT DEPTH ===== */

.nr-crowd-text {
    text-shadow:
        0 0 15px rgba(255,45,85,0.5),
        0 0 40px rgba(255,45,85,0.3);
}

/* ===== CONTENT SEPARATION ===== */

.nr-single-content {
    position: relative;
    margin-top: -20px;
}
/* ===== ARCHIVE ===== */

.nr-archive {
    background:#0b0b0f;
    padding:60px 20px;
}

.nr-archive-header {
    max-width:1200px;
    margin:0 auto 40px;
}

.nr-archive-header h1 {
    font-size:32px;
}

.nr-archive-grid {
    max-width:1200px;
    margin:0 auto;
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap:30px;
}

.nr-archive-card {
    background:#16161d;
    border-radius:18px;
    overflow:hidden;
    text-decoration:none;
    color:#fff;
    transition:all 0.3s ease;
    border:1px solid rgba(255,255,255,0.05);
}

.nr-archive-card:hover {
    transform:translateY(-6px);
    box-shadow:0 15px 40px rgba(0,0,0,0.7);
}

.nr-archive-image {
    height:180px;
    overflow:hidden;
}

.nr-archive-image img {
    width:100%;
    height:100%;
    object-fit:cover;
    transition:transform 0.4s ease;
}

.nr-archive-card:hover img {
    transform:scale(1.05);
}

.nr-archive-content {
    padding:20px;
}

.nr-archive-title {
    font-size:18px;
    font-weight:600;
    margin-bottom:6px;
}

.nr-archive-sub {
    font-size:13px;
    opacity:0.6;
    margin-bottom:16px;
}

.nr-archive-bottom {
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.nr-archive-crowd {
    padding:6px 12px;
    border-radius:20px;
    font-size:13px;
    font-weight:600;
    color:#000;
}

.nr-archive-afterparty {
    font-size:12px;
    padding:4px 10px;
    border-radius:20px;
    background:rgba(255,45,85,0.2);
    color:#ff2d55;
}
/* ===== ARCHIVE FILTERS ===== */

.nr-archive-filters {
    max-width:1200px;
    margin:0 auto 40px;
    display:flex;
    flex-wrap:wrap;
    gap:12px;
}

.nr-filter {
    padding:8px 18px;
    border-radius:20px;
    text-decoration:none;
    color:#fff;
    font-size:13px;
    border:1px solid rgba(255,255,255,0.1);
    transition:0.25s ease;
}

.nr-filter:hover {
    border-color:#ff2d55;
}

.nr-filter.active {
    background:#ff2d55;
    border-color:#ff2d55;
}
/* ================= ARCHIVE CARDS PREMIUM ================= */

.nr-archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
    margin-top: 40px;
}

.nr-archive-card {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    background: #14141a;
    cursor: pointer;
    transition: 0.35s ease;
    border: 1px solid rgba(255,255,255,0.06);
}

.nr-archive-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    border-color: rgba(255,255,255,0.15);
}

.nr-archive-img {
    height: 240px;
    width: 100%;
    object-fit: cover;
    display: block;
}

.nr-archive-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.85) 10%,
        rgba(0,0,0,0.3) 50%,
        rgba(0,0,0,0.05) 100%
    );
}

.nr-archive-content {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
}

.nr-archive-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 6px;
}

.nr-archive-sub {
    font-size: 13px;
    opacity: 0.7;
    margin-bottom: 12px;
}

.nr-archive-crowd {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
}
/* ===== ARCHIVE ULTRA POLISH ===== */

.nr-archive-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.nr-archive-img {
    transition: transform 0.6s ease;
}

.nr-archive-card:hover .nr-archive-img {
    transform: scale(1.06);
}

.nr-archive-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.85) 0%,
        rgba(0,0,0,0.5) 40%,
        rgba(0,0,0,0.2) 70%,
        rgba(0,0,0,0) 100%
    );
    transition: opacity 0.4s ease;
}

.nr-archive-card:hover .nr-archive-overlay {
    opacity: 0.8;
}

.nr-archive-card:hover .nr-archive-overlay {
    opacity: 0.85;
}

.nr-archive-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 25px 60px rgba(0,0,0,0.7);
}

.nr-archive-crowd {
    position: relative;
    color: #000;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 30px;
    transition: all 0.3s ease;
}

.nr-archive-card:hover .nr-archive-crowd {
    transform: scale(1.05);
    box-shadow:
        0 0 20px currentColor,
        0 0 40px currentColor;
}

/* fade in cards */

.nr-archive-card {
    opacity: 0;
    transform: translateY(20px);
    animation: nrFadeIn 0.6s ease forwards;
}

.nr-archive-card:nth-child(1) { animation-delay: 0.05s; }
.nr-archive-card:nth-child(2) { animation-delay: 0.1s; }
.nr-archive-card:nth-child(3) { animation-delay: 0.15s; }
.nr-archive-card:nth-child(4) { animation-delay: 0.2s; }
.nr-archive-card:nth-child(5) { animation-delay: 0.25s; }
.nr-archive-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes nrFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ===== CARD WITHOUT IMAGE ===== */

.nr-archive-card:not(:has(.nr-archive-img[src])) {
    background: linear-gradient(145deg, #14141c, #0f1118);
    backdrop-filter: blur(20px);
}

.nr-archive-card:not(:has(.nr-archive-img[src]))::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at 30% 20%,
        rgba(255,255,255,0.05),
        transparent 60%
    );
    pointer-events: none;
}
.nr-archive-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 20px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.nr-archive-card:hover::after {
    opacity: 1;
    box-shadow: 0 0 60px rgba(255,45,85,0.08);
}
.nr-archive-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.nr-archive-sub {
    opacity: 0.65;
    font-size: 14px;
}
/* ===== PREMIUM APPEAR ANIMATION ===== */

.nr-archive-card {
    opacity: 0;
    transform: translateY(20px);
    animation: nrFadeUp 0.7s ease forwards;
}

.nr-archive-card:nth-child(1) { animation-delay: 0.05s; }
.nr-archive-card:nth-child(2) { animation-delay: 0.1s; }
.nr-archive-card:nth-child(3) { animation-delay: 0.15s; }
.nr-archive-card:nth-child(4) { animation-delay: 0.2s; }
.nr-archive-card:nth-child(5) { animation-delay: 0.25s; }
.nr-archive-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes nrFadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.nr-archive-card {
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.nr-archive-img {
    transition: transform 0.6s ease;
}

.nr-archive-card:hover .nr-archive-img {
    transform: scale(1.06);
}

.nr-archive-card:hover {
    transform: translateY(-6px);
    box-shadow:
        0 25px 60px rgba(0,0,0,0.7),
        0 0 40px rgba(255,255,255,0.05);
}
/* ===== CROWD GLOW EFFECT ===== */

.nr-archive-card[data-crowd="low"] {
    box-shadow: 0 0 40px rgba(0,200,83,0.15);
}

.nr-archive-card[data-crowd="mid"] {
    box-shadow: 0 0 40px rgba(255,179,0,0.18);
}

.nr-archive-card[data-crowd="high"] {
    box-shadow: 0 0 40px rgba(255,45,85,0.22);
}

.nr-archive-card:hover {
    box-shadow:
        0 30px 70px rgba(0,0,0,0.7),
        0 0 60px rgba(255,255,255,0.04);
}
/* ===== NO PHOTO GLASS STYLE ===== */

.nr-archive-card.no-photo {
    background: linear-gradient(
        135deg,
        rgba(30,30,40,0.8),
        rgba(15,15,25,0.95)
    );
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.05);
}

.nr-archive-card.no-photo .nr-archive-overlay {
    display: none;
}

.nr-archive-card.no-photo::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at 30% 30%,
        rgba(255,45,85,0.08),
        transparent 70%
    );
    pointer-events: none;
}
.nr-archive-img {
    transition: transform 0.6s ease, filter 0.6s ease;
}

.nr-archive-card:hover .nr-archive-img {
    transform: scale(1.06);
    filter: brightness(1.05);
}
.nr-archive-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.75) 0%,
        rgba(0,0,0,0.35) 40%,
        rgba(0,0,0,0.1) 70%,
        transparent 100%
    );
    transition: opacity 0.4s ease;
}

.nr-archive-card:hover .nr-archive-overlay {
    opacity: 0.85;
}
.nr-archive-card {
    opacity: 0;
    transform: translateY(20px);
    animation: cardFade 0.6s ease forwards;
}

@keyframes cardFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.nr-archive-card {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.nr-archive-card:hover {
    transform: translateY(-6px) scale(1.01);
}
.nr-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 40px;
}

.nr-filter-btn {
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.25s ease;
    backdrop-filter: blur(12px);
}

.nr-filter-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255,45,85,0.4);
    box-shadow: 0 0 20px rgba(255,45,85,0.15);
}

.nr-filter-btn.active {
    background: #ff2d55;
    border-color: #ff2d55;
    box-shadow: 0 0 30px rgba(255,45,85,0.4);
}
/* ===============================
   STAGGER REVEAL
=============================== */

.nr-archive-card {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
    filter: blur(6px);
    transition:
        opacity 0.7s cubic-bezier(.22,1,.36,1),
        transform 0.7s cubic-bezier(.22,1,.36,1),
        filter 0.7s cubic-bezier(.22,1,.36,1);
}

.nr-archive-card.nr-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}
.nr-archive-card {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(.22,1,.36,1);
}

.nr-archive-card.nr-visible {
    opacity: 1;
    transform: translateY(0);
}
/* ===============================
   PREMIUM GLASS SORT
================================ */

.nr-sort-wrapper {
    position: relative;
    width: 240px;
    margin: 30px 0;
    font-size: 14px;
}

.nr-sort-selected {
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all .25s ease;
}

.nr-sort-selected:hover {
    border-color: rgba(255,45,85,0.5);
    box-shadow: 0 0 25px rgba(255,45,85,0.25);
}

.nr-sort-options {
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    background: rgba(15,15,20,0.95);
    backdrop-filter: blur(20px);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all .25s ease;
    z-index: 20;
}

.nr-sort-wrapper.open .nr-sort-options {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nr-sort-option {
    padding: 14px 18px;
    cursor: pointer;
    transition: all .2s ease;
}

.nr-sort-option:hover {
    background: rgba(255,45,85,0.1);
}
/* ===============================
   SINGLE V4 — PRODUCT HERO
================================ */

.nr-single-v4 {
    background:#0b0b0f;
}

.nr-hero-v4 {
    position:relative;
    height:520px;
    overflow:hidden;
}

.nr-hero-bg {
    width:100%;
    height:100%;
    object-fit:cover;
}

.nr-hero-overlay {
    position:absolute;
    inset:0;
    background:linear-gradient(
        to bottom,
        rgba(0,0,0,0.2),
        rgba(0,0,0,0.6) 60%,
        rgba(11,11,15,0.95)
    );
}

.nr-hero-content {
    position:absolute;
    bottom:60px;
    left:0;
    right:0;
    max-width:1100px;
    margin:0 auto;
    padding:0 20px;
}

.nr-status-glass {
    background:rgba(20,20,30,0.55);
    backdrop-filter:blur(20px);
    border:1px solid rgba(255,255,255,0.08);
    border-radius:20px;
    padding:40px;
    max-width:600px;
}

.nr-status-top h1 {
    margin:0;
    font-size:28px;
}

.nr-sub {
    opacity:0.7;
    margin-top:6px;
}

.nr-badges {
    margin-top:14px;
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}

.nr-chip {
    font-size:12px;
    padding:6px 12px;
    border-radius:999px;
    background:rgba(255,255,255,0.1);
}

.nr-chip-premium {
    background:rgba(255,45,85,0.2);
    color:#ff2d55;
}

.nr-chip-after {
    background:rgba(255,45,85,0.15);
    color:#ff2d55;
}

.nr-crowd-block {
    margin-top:30px;
}

.nr-crowd-value {
    font-size:42px;
    font-weight:700;
}

.nr-crowd-label {
    opacity:0.6;
    font-size:14px;
}

.nr-crowd-bar-v4 {
    display:flex;
    gap:8px;
    margin-top:16px;
}

.nr-crowd-bar-v4 div {
    flex:1;
    height:8px;
    background:#222;
    border-radius:4px;
    transition:all 0.3s ease;
}

.nr-crowd-bar-v4 div.active {
    box-shadow:0 0 20px currentColor;
}

.nr-meta-row {
    margin-top:18px;
    font-size:14px;
    opacity:0.8;
    display:flex;
    gap:20px;
    flex-wrap:wrap;
}

.nr-map-block {
    max-width:1100px;
    margin:60px auto;
    padding:0 20px;
}

#single-map {
    height:320px;
    border-radius:16px;
}
/* ===============================
   SINGLE V6 LAYOUT
================================ */

.nr-single-v6 {
    background:#0b0b0f;
    padding:60px 20px;
}

.nr-single-container {
    max-width:1200px;
    margin:0 auto;
    display:flex;
    gap:50px;
    align-items:flex-start;
}

.nr-left {
    flex:1.1;
}

.nr-right {
    flex:0.9;
    display:flex;
    flex-direction:column;
    gap:30px;
}

.nr-photo-wrapper img {
    width:100%;
    height:420px;
    object-fit:cover;
    border-radius:18px;
}

.nr-thumb-row {
    display:flex;
    gap:12px;
    margin-top:15px;
}

.nr-thumb-row img {
    height:80px;
    border-radius:12px;
    cursor:pointer;
    opacity:0.7;
    transition:all .3s ease;
}

.nr-thumb-row img.active,
.nr-thumb-row img:hover {
    opacity:1;
    transform:translateY(-3px);
}

.nr-address-v6 {
    margin-top:20px;
    opacity:0.7;
}

.nr-glass-card {
    background:rgba(20,20,30,0.6);
    backdrop-filter:blur(20px);
    border:1px solid rgba(255,255,255,0.08);
    border-radius:20px;
    padding:40px;
}

.nr-glass-card h1 {
    margin:0;
    font-size:26px;
}

.nr-sub {
    opacity:0.7;
    margin-top:5px;
}

.nr-badges {
    margin-top:12px;
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}

.nr-chip {
    font-size:12px;
    padding:6px 12px;
    border-radius:999px;
    background:rgba(255,255,255,0.1);
}

.nr-chip-premium {
    background:rgba(255,45,85,0.2);
    color:#ff2d55;
}

.nr-chip-after {
    background:rgba(255,45,85,0.15);
    color:#ff2d55;
}

.nr-crowd-value {
    font-size:40px;
    font-weight:700;
    margin-top:25px;
}

.nr-crowd-bar-v6 {
    display:flex;
    gap:8px;
    margin-top:12px;
}

.nr-crowd-bar-v6 div {
    flex:1;
    height:8px;
    background:#222;
    border-radius:4px;
}

.nr-meta-row {
    margin-top:15px;
    display:flex;
    gap:20px;
    flex-wrap:wrap;
    opacity:0.8;
}

.nr-updated {
    margin-top:20px;
    font-size:13px;
    opacity:0.5;
}

.nr-mini-map #single-map {
    height:220px;
    border-radius:16px;
}

/* Responsive */

@media(max-width: 900px) {
    .nr-single-container {
        flex-direction:column;
    }
}
/* ===============================
   SINGLE V9 PREMIUM
================================ */

.nr-single-v8 {
    background:#0b0b0f;
    color:#fff;
}

/* ===== HERO ===== */

.nr-hero-v8 {
    position:relative;
    height:68vh;
    min-height:520px;
    overflow:hidden;
}

.nr-hero-bg {
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    object-fit:cover;
    transition:opacity .4s ease;
    transform:scale(1.02);
}

.nr-hero-overlay {
    position:absolute;
    inset:0;
    background:
        linear-gradient(
            to bottom,
            rgba(0,0,0,0.35) 0%,
            rgba(0,0,0,0.65) 55%,
            rgba(11,11,15,1) 100%
        );
}

/* ===== LAYOUT ===== */

.nr-hero-content {
    position:relative;
    z-index:2;
    height:100%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 140px;
    gap:50px;
}

/* ===== GLASS CARD ===== */

.nr-glass-card {
    width:460px;
    padding:44px;
    border-radius:30px;
    background:rgba(18,18,26,0.65);
    backdrop-filter:blur(28px);
    border:1px solid rgba(255,255,255,0.06);
    box-shadow:
        0 50px 120px rgba(0,0,0,0.85),
        inset 0 0 0 1px rgba(255,255,255,0.03);
}

.nr-glass-card h1 {
    font-size:32px;
    margin-bottom:8px;
    letter-spacing:0.5px;
}

.nr-sub {
    opacity:.6;
    margin-bottom:20px;
}

/* ===== BADGES ===== */

.nr-badges {
    display:flex;
    gap:12px;
    margin-bottom:24px;
}

.nr-chip {
    padding:6px 14px;
    border-radius:20px;
    font-size:12px;
    background:rgba(255,255,255,0.08);
}

.nr-chip-premium {
    background:rgba(255,45,85,0.18);
    color:#ff2d55;
}

.nr-chip-after {
    background:rgba(255,179,0,0.18);
    color:#ffb300;
}

/* ===== CROWD ===== */

.nr-crowd-value {
    font-size:44px;
    font-weight:700;
    margin-bottom:20px;
    letter-spacing:1px;
}

.nr-crowd-bar {
    display:flex;
    gap:14px;
    margin-bottom:24px;
}

.nr-crowd-bar div {
    flex:1;
    height:6px;
    border-radius:6px;
    background:rgba(255,255,255,0.07);
}

.nr-crowd-bar div.active {
    box-shadow:0 0 18px currentColor;
}

/* ===== META ===== */

.nr-meta-row {
    display:flex;
    gap:28px;
    opacity:.85;
    margin-bottom:14px;
}

.nr-address {
    opacity:.7;
    margin-bottom:10px;
}

.nr-updated {
    opacity:.4;
    font-size:13px;
    margin-bottom:28px;
}

/* ===== BUTTONS ===== */

.nr-buttons {
    display:flex;
    gap:16px;
}

.nr-route-btn {
    padding:12px 28px;
    border-radius:999px;
    background:#ff2d55;
    color:#fff;
    border:none;
    font-weight:600;
    cursor:pointer;
    transition:.25s ease;
}

.nr-route-btn:hover {
    box-shadow:0 0 30px rgba(255,45,85,0.6);
}

.nr-home-btn {
    padding:12px 28px;
    border-radius:999px;
    background:rgba(255,255,255,0.07);
    color:#fff;
    text-decoration:none;
    border:1px solid rgba(255,255,255,0.1);
    transition:.25s ease;
}

.nr-home-btn:hover {
    border-color:rgba(255,255,255,0.25);
}

/* ===== SIDE GALLERY ===== */

.nr-side-gallery {
    display:flex;
    flex-direction:column;
    gap:18px;
}

.nr-side-thumb {
    width:150px;
    height:105px;
    object-fit:cover;
    border-radius:16px;
    cursor:pointer;
    opacity:.75;
    transition:.25s ease;
    border:1px solid rgba(255,255,255,0.06);
}

.nr-side-thumb:hover,
.nr-side-thumb.active {
    opacity:1;
    transform:translateX(-8px);
    box-shadow:0 25px 50px rgba(0,0,0,0.6);
}

/* ===== MAP ===== */

.nr-map-section {
    max-width:1100px;
    margin:100px auto;
    padding:0 40px;
}

#single-map {
    height:400px;
    border-radius:30px;
    overflow:hidden;
    box-shadow:0 50px 120px rgba(0,0,0,0.85);
}
/* ================= LIVE PANEL ================= */

.nr-live-panel {
    padding: 60px 20px 40px;
    background: linear-gradient(to bottom, #0b0b0f, #0f0f14);
}

.nr-live-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.nr-live-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.nr-live-header h2 {
    font-size: 28px;
    font-weight: 700;
}

.nr-live-time {
    opacity: 0.6;
    font-size: 14px;
}

.nr-live-status {
    font-size: 16px;
    opacity: 0.7;
    margin-bottom: 30px;
}

.nr-live-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.nr-stat {
    padding: 14px 22px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 15px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
}

.nr-hot {
    border-color: rgba(255,45,85,0.4);
}

.nr-mid {
    border-color: rgba(255,179,0,0.4);
}

.nr-low {
    border-color: rgba(0,200,83,0.4);
}
/* ================= DECISION PANEL ================= */

.nr-decision-panel {
    padding: 60px 20px 40px;
    text-align: center;
}

.nr-decision-header {
    margin-bottom: 20px;
}

.nr-now-time {
    font-size: 18px;
    opacity: 0.8;
}

.nr-activity-status {
    font-size: 14px;
    opacity: 0.5;
}

.nr-live-stats {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 25px 0 40px;
    flex-wrap: wrap;
}

.nr-stat {
    padding: 10px 20px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 14px;
    backdrop-filter: blur(10px);
}

.nr-stat.hot {
    border-color: rgba(255,45,85,0.4);
}

.nr-stat.mid {
    border-color: rgba(255,179,0,0.4);
}

.nr-stat.low {
    border-color: rgba(0,200,83,0.4);
}

.nr-decision-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.nr-action-btn {
    padding: 14px 28px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: 0.25s ease;
}

.nr-action-btn:hover {
    transform: translateY(-2px);
    border-color: #ff2d55;
}

.nr-action-btn.primary {
    background: #ff2d55;
    border-color: #ff2d55;
}
.nr-delta {
    font-size:12px;
    margin-left:8px;
}

.delta-up { color:#ff2d55; }
.delta-down { color:#00c853; }
.delta-flat { color:#ffb300; }

.nr-fill-bar span.animate {
    animation:barPulse 1.2s ease-in-out;
}

@keyframes barPulse {
    0%{opacity:0.6;}
    50%{opacity:1;}
    100%{opacity:0.8;}
}
.nr-forecast {
    font-size:12px;
    margin-top:6px;
    opacity:0.8;
}

.forecast-hot { color:#ff2d55; }
.forecast-mid { color:#ffb300; }
.forecast-low { color:#00c853; }
<?php get_header(); ?>

<?php
$venues = get_posts([
    'post_type' => 'venues',
    'numberposts' => -1
]);

$data = [];

foreach ($venues as $venue) {

    $level = (int) get_field('crowd_level', $venue->ID);
    $queue = get_field('queue_status', $venue->ID);
    $lat   = get_field('latitude', $venue->ID);
    $lng   = get_field('longitude', $venue->ID);

    $percent = round(($level / 5) * 100);

    $trust = 70;
    if ($queue === "Нет очереди") $trust += 10;
    if ($level >= 4) $trust += 10;

    $data[] = [
        'id' => $venue->ID,
        'title' => $venue->post_title,
        'link' => get_permalink($venue->ID),
        'crowd' => $level,
        'percent' => $percent,
        'trust' => $trust,
        'queue' => $queue,
        'lat' => $lat,
        'lng' => $lng
    ];
}
?>

<section class="nr-dashboard">

    <div class="nr-header">
        <div>
            <h1>NightRadar Moscow</h1>
            <div id="nr-trend" style="font-size:14px; margin-top:6px;"></div>
        </div>
        <div class="nr-time">Сейчас: <?php echo current_time('H:i'); ?></div>
    </div>

    <div class="nr-actions">
        <button class="nr-btn" data-mode="all">Все</button>
        <button class="nr-btn hot" data-mode="hot">🔥 Хочу движ</button>
        <button class="nr-btn mid" data-mode="noqueue">🚪 Без очереди</button>
        <button class="nr-btn primary" data-mode="auto">⚡ Выбери за меня</button>
        <button class="nr-btn" id="heatToggle">🔥 Heat режим</button>
        <button class="nr-btn geo" data-mode="near">📍 Рядом со мной</button>
    </div>

    <div class="nr-content">
        <div class="nr-list" id="nr-list"></div>
        <div class="nr-map">
            <div id="map"></div>
        </div>
    </div>

</section>

<style>
.nr-dashboard { background:#0b0b0f; color:#fff; padding:40px 20px; }
.nr-header { display:flex; justify-content:space-between; margin-bottom:30px; }
.nr-actions { display:flex; gap:15px; margin-bottom:30px; flex-wrap:wrap; }
<button class="nr-btn geo" data-mode="near">📍 Рядом со мной</button>
.nr-btn {
    background:#1a1a22;
    border:1px solid #2a2a35;
    color:#fff;
    padding:10px 18px;
    border-radius:25px;
    cursor:pointer;
    transition:0.3s;
}

.nr-btn.primary { background:#ff2d55; border:none; }

.nr-content { display:grid; grid-template-columns:420px 1fr; gap:30px; }
.nr-list { display:flex; flex-direction:column; gap:18px; }

.nr-card {
    background:#14141c;
    padding:22px;
    border-radius:18px;
    border:1px solid #222;
    transition:0.3s;
    position:relative;
}

.nr-card:hover { transform:translateY(-3px); }

.nr-card.leader {
    border:1px solid #ff2d55;
    box-shadow:0 0 40px rgba(255,45,85,0.8);
}

.nr-card.leader::after{
    content:"";
    position:absolute;
    inset:-4px;
    border-radius:22px;
    box-shadow:0 0 70px rgba(255,45,85,0.5);
    pointer-events:none;
}

.nr-card.active {
    box-shadow:0 0 25px rgba(0,224,255,0.6);
    border:1px solid #00e0ff;
}

.nr-leader-badge {
    position:absolute;
    top:-12px;
    right:15px;
    background:#ff2d55;
    padding:6px 12px;
    font-size:12px;
    border-radius:20px;
    display:flex;
    align-items:center;
    gap:6px;
    animation:float 2.5s ease-in-out infinite;
}

@keyframes float{
    0%{transform:translateY(0);}
    50%{transform:translateY(-4px);}
    100%{transform:translateY(0);}
}

.nr-title { font-size:18px; font-weight:600; }
.nr-meta { opacity:0.7; font-size:13px; margin-top:4px; }

.nr-fill-bar {
    margin-top:12px;
    height:6px;
    background:#1f1f28;
    border-radius:10px;
    overflow:hidden;
}

.nr-fill-bar span {
    display:block;
    height:100%;
    background:linear-gradient(90deg,#ff2d55,#ff6a00);
}

.nr-stats {
    display:flex;
    justify-content:space-between;
    margin-top:10px;
    font-size:13px;
}

.nr-trust { color:#00e0ff; }

#map { height:650px; border-radius:20px; }

.pulse {
    animation:pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow:0 0 0 0 rgba(255,45,85,0.7); }
    70% { box-shadow:0 0 0 20px rgba(255,45,85,0); }
    100% { box-shadow:0 0 0 0 rgba(255,45,85,0); }
}
</style>

<script>
const venues = <?php echo json_encode($data); ?>;
let map;
let markers = {};
let originalVenues = [...venues];

function getColor(level){
    if(level>=4) return "#ff2d55";
    if(level>=2) return "#ffb300";
    return "#00c853";
}

// 🔥 Night Score алгоритм
function calculateNightScore(v){
    let score = 0;

    score += v.crowd * 40;        // драйв
    score += v.trust * 0.3;       // доверие

    if(v.queue === "Нет очереди"){
        score += 10;              // бонус за отсутствие очереди
    }

    return Math.round(score);
}

function initMap(){
    map = L.map('map').setView([55.75,37.61],11);
    L.tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png').addTo(map);

    // рассчитываем score сразу
    originalVenues.forEach(v=>{
        v.nightScore = calculateNightScore(v);
    });

    renderAll(originalVenues);
}

function renderAll(data){
    renderList(data);
    renderMarkers(data);
}

function renderList(data){

    const container = document.getElementById("nr-list");
    container.innerHTML = "";

    // сортируем по NightScore
    const sorted = [...data].sort((a,b)=>b.nightScore-a.nightScore);

    sorted.forEach((v,index)=>{

        const div = document.createElement("div");
        div.className="nr-card";
        div.dataset.id=v.id;

        if(index===0){
            div.classList.add("leader");
            div.innerHTML += `
                <div class="nr-leader-badge">
                    👑 ЛИДЕР НОЧИ
                </div>`;
        }

        div.innerHTML += `
            <div class="nr-title">${v.title}</div>
            <div class="nr-meta">
                ${v.percent}% заполненности • Очередь: ${v.queue || "Нет данных"}
            </div>
            <div class="nr-fill-bar">
                <span style="width:${v.percent}%"></span>
            </div>
            <div class="nr-stats">
                <div>🔥 Crowd: ${v.crowd}/5</div>
                <div class="nr-trust">
                    Trust: ${v.trust}% • Score: ${v.nightScore}
                </div>
            </div>
            <div style="margin-top:12px; display:flex; gap:15px;">
                <a href="${v.link}" style="color:#ff2d55;">Открыть</a>
                <a target="_blank"
                   href="https://yandex.ru/maps/?rtext=~${v.lat},${v.lng}"
                   style="color:#00e0ff;">
                   Маршрут
                </a>
            </div>
        `;

        div.addEventListener("mouseenter",()=>{
            highlightMarker(v.id,true);
            div.classList.add("active");
        });

        div.addEventListener("mouseleave",()=>{
            highlightMarker(v.id,false);
            div.classList.remove("active");
        });

        container.appendChild(div);
    });
}

function renderMarkers(data){

    for(let key in markers){
        map.removeLayer(markers[key]);
    }
    markers={};

    const bounds=[];
    const sorted=[...data].sort((a,b)=>b.nightScore-a.nightScore);

    sorted.forEach((v,index)=>{

        if(!v.lat||!v.lng) return;

        const color=getColor(v.crowd);

        const marker=L.circleMarker([v.lat,v.lng],{
            radius:12,
            color:color,
            fillColor:color,
            fillOpacity:1
        }).addTo(map);

        if(index===0){
            marker._path.classList.add("pulse");
        }

        marker.on("mouseover",()=>{
            document.querySelector(`[data-id='${v.id}']`)?.classList.add("active");
            marker.setStyle({ radius:18 });
        });

        marker.on("mouseout",()=>{
            document.querySelector(`[data-id='${v.id}']`)?.classList.remove("active");
            marker.setStyle({ radius:12 });
        });

        marker.bindPopup(`
            <b>${v.title}</b><br>
            ${v.percent}% заполненности<br>
            Score: ${v.nightScore}
        `);

        markers[v.id]=marker;
        bounds.push([v.lat,v.lng]);
    });

    if(bounds.length){
        map.fitBounds(bounds,{padding:[60,60]});
    }
}

function highlightMarker(id,active){
    if(markers[id]){
        markers[id].setStyle({ radius: active ? 18 : 12 });
    }
}

function filterMode(mode){

    let filtered=[...originalVenues];

    if(mode==="hot"){
        filtered=filtered.filter(v=>v.crowd>=4);
    }

    if(mode==="noqueue"){
        filtered=filtered.filter(v=>v.queue==="Нет очереди");
    }

    if(mode==="auto"){
        filtered.sort((a,b)=>b.nightScore-a.nightScore);
        filtered=filtered.slice(0,1);
    }

    renderAll(filtered);
}

document.addEventListener("DOMContentLoaded",function(){

    initMap();

    document.querySelectorAll(".nr-btn").forEach(btn=>{
        btn.addEventListener("click",function(){
            filterMode(this.dataset.mode);
        });
    });

    // автообновление каждые 2 минуты
    setInterval(()=>location.reload(),120000);
});
</script>

<?php get_footer(); ?>
.nr-popup-row{
    display:flex;
    gap:12px;
    align-items:flex-start;
}

.nr-popup-thumb{
    width:70px;
    height:70px;
    object-fit:cover;
    border-radius:10px;
    flex-shrink:0;
}

.nr-popup-content{
    flex:1;
    min-width:0;
}

.nr-popup-title{
    font-weight:600;
    margin-bottom:4px;
}

.nr-popup-meta{
    font-size:13px;
    opacity:0.7;
    margin-bottom:4px;
}

.nr-popup-address{
    font-size:12px;
    opacity:0.6;
    margin-bottom:8px;
}

.nr-popup-actions{
    display:flex;
    gap:8px;
}
