/**
 * ANUNAKI Popup Styles v2.0.0
 * Matches React MapPopup.tsx preview exactly
 */

:root {
    --ank-orange: #f97316;
    --ank-amber: #f59e0b;
    --ank-slate-50: #f8fafc;
    --ank-slate-100: #f1f5f9;
    --ank-slate-200: #e2e8f0;
    --ank-slate-400: #94a3b8;
    --ank-slate-500: #64748b;
    --ank-slate-900: #0f172a;
}

/* Reset for WP themes */
.ank-overlay *, .ank-overlay *::before, .ank-overlay *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ═══ OVERLAY ═══ */
.ank-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    animation: ankFadeIn 0.25s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}
.ank-overlay.ank-closing { animation: ankFadeOut 0.3s ease forwards; }
@keyframes ankFadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes ankFadeOut { from { opacity: 1 } to { opacity: 0 } }

.ank-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ═══ CONTAINER ═══ */
.ank-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    max-height: 92vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: ankSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes ankSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══ HEADER ═══ */
.ank-header {
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid #fed7aa;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    z-index: 1000;
    position: relative;
}

/* Header top row */
.ank-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
}

/* Logo */
.ank-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.ank-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f97316, #f59e0b);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(249,115,22,0.25);
}
.ank-logo-icon svg {
    width: 20px;
    height: 20px;
    color: white;
    fill: none;
    stroke: white;
    stroke-width: 2;
}
.ank-logo-text-wrap {
    display: none;
}
@media (min-width: 640px) {
    .ank-logo-text-wrap { display: block; }
}
.ank-logo-title {
    font-size: 16px;
    font-weight: 900;
    color: var(--ank-slate-900);
    letter-spacing: -0.5px;
    line-height: 1.1;
}
.ank-logo-title span { color: var(--ank-orange); }
.ank-logo-subtitle {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--ank-slate-400);
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ank-logo-subtitle img {
    width: 16px;
    height: 12px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    display: inline-block;
    vertical-align: middle;
}

/* Search bar in header */
.ank-search-wrap {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 512px;
    margin: 0 auto;
    position: relative;
}
.ank-search-field {
    position: relative;
    flex-grow: 1;
}
.ank-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--ank-slate-400);
    pointer-events: none;
}
.ank-search-input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 40px;
    border: 2px solid var(--ank-slate-200);
    border-radius: 12px;
    background: rgba(248,250,252,0.8);
    font-size: 14px;
    font-weight: 500;
    color: var(--ank-slate-900);
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}
.ank-search-input::placeholder { color: var(--ank-slate-400); }
.ank-search-input:focus {
    border-color: var(--ank-orange);
    background: #fff;
    box-shadow: 0 4px 12px rgba(249,115,22,0.1);
}
.ank-search-btn {
    height: 40px;
    padding: 0 18px;
    background: linear-gradient(135deg, #f97316, #f59e0b);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(249,115,22,0.25);
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}
.ank-search-btn svg { width: 15px; height: 15px; stroke: white; fill: none; flex-shrink: 0; }
.ank-search-btn:hover {
    background: linear-gradient(135deg, #ea580c, #d97706);
    box-shadow: 0 6px 16px rgba(249,115,22,0.35);
}
.ank-search-btn:active { transform: scale(0.95); }

/* Search results dropdown */
.ank-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 48px;
    margin-top: 8px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    border: 1px solid var(--ank-slate-200);
    overflow: hidden;
    max-height: 288px;
    overflow-y: auto;
    z-index: 1100;
    animation: ankDropdown 0.15s ease;
    display: none;
}
.ank-search-results.active { display: block; }
@keyframes ankDropdown {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ank-search-results-header {
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--ank-slate-50), rgba(255,237,213,0.3));
    border-bottom: 1px solid var(--ank-slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ank-search-results-header span:first-child {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--ank-slate-400);
}
.ank-search-results-count {
    font-size: 10px;
    font-weight: 900;
    color: var(--ank-orange);
    background: #fff7ed;
    padding: 2px 8px;
    border-radius: 999px;
}
.ank-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid var(--ank-slate-50);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.ank-result-item:last-child { border-bottom: none; }
.ank-result-item:hover { background: #fff7ed; }
.ank-result-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #ffedd5;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: background 0.15s;
}
.ank-result-item:hover .ank-result-icon { background: #fed7aa; }
.ank-result-icon svg { width: 16px; height: 16px; stroke: #ea580c; fill: none; stroke-width: 2; }
.ank-result-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--ank-slate-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}
.ank-result-item:hover .ank-result-name { color: #c2410c; }
.ank-result-addr {
    font-size: 12px;
    color: var(--ank-slate-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Close button */
.ank-close-btn {
    width: 40px;
    height: 40px;
    background: var(--ank-slate-100);
    border: none;
    border-radius: 12px;
    color: var(--ank-slate-500);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
}
.ank-close-btn:hover {
    background: #fef2f2;
    color: #ef4444;
}
.ank-close-btn:active { transform: scale(0.9); }

/* ═══ FLAGS BAR ═══ */
.ank-flags-wrap {
    position: relative;
    overflow: hidden;
}
.ank-flags-wrap::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 48px;
    background: linear-gradient(to left, #fff 20%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}
.ank-flags {
    display: flex;
    gap: 4px;
    padding: 0 24px 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.ank-flags::-webkit-scrollbar { display: none; }
.ank-flag-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    border: 1px solid var(--ank-slate-200);
    background: var(--ank-slate-50);
    color: var(--ank-slate-500);
    font-family: inherit;
}
.ank-flag-btn:hover {
    background: #fff7ed;
    color: #ea580c;
    border-color: #fed7aa;
}
.ank-flag-btn.active {
    background: linear-gradient(135deg, #f97316, #f59e0b);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(249,115,22,0.25);
    transform: scale(1.05);
}
.ank-flag-img {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.ank-flag-name { display: none; }
@media (min-width: 640px) {
    .ank-flag-name { display: inline; }
}

/* ═══ MAP BODY ═══ */
.ank-body {
    flex: 1;
    position: relative;
    min-height: 0;
}
.ank-map {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

/* ═══ CLUSTER ICONS ═══ */
.custom-cluster-icon,
.ank-cluster-icon {
    background: none !important;
    border: none !important;
}

/* ═══ MARKER ICON ═══ */
.locker-marker-icon,
.ank-marker-icon {
    background: none !important;
    border: none !important;
}

/* ═══ STATUS BAR (bottom-left) ═══ */
.ank-status-bar {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    border-radius: 999px;
    border: 1px solid var(--ank-slate-200);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    font-size: 13px;
    font-weight: 600;
    color: var(--ank-slate-900);
}
.ank-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
}
.ank-status-dot.loading {
    background: var(--ank-orange);
    animation: ankPulse 1s ease-in-out infinite;
}
@keyframes ankPulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ═══ POINT DETAIL PANEL ═══ */
.ank-detail-panel {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: 420px;
    z-index: 900;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: ankPanelIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes ankPanelIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ank-detail-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #f97316, #f59e0b);
    color: white;
}
.ank-detail-header h3 {
    font-size: 18px;
    font-weight: 900;
    margin: 0;
}
.ank-detail-header p {
    font-size: 13px;
    opacity: 0.85;
    margin: 4px 0 0;
    font-weight: 500;
}
.ank-detail-body {
    padding: 16px 20px;
}
.ank-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--ank-slate-100);
    font-size: 13px;
    color: var(--ank-slate-900);
}
.ank-detail-row:last-child { border-bottom: none; }
.ank-detail-row .icon { font-size: 16px; flex-shrink: 0; }
.ank-detail-row .name {
    font-weight: 900;
    color: var(--ank-orange);
    font-size: 15px;
}
.ank-detail-actions {
    display: flex;
    gap: 8px;
    padding: 0 20px 16px;
}
.ank-btn-confirm {
    flex: 1;
    height: 44px;
    background: linear-gradient(135deg, #f97316, #f59e0b);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(249,115,22,0.3);
}
.ank-btn-confirm:hover { background: linear-gradient(135deg, #ea580c, #d97706); }
.ank-btn-confirm:active { transform: scale(0.97); }
.ank-btn-cancel {
    height: 44px;
    padding: 0 16px;
    background: var(--ank-slate-100);
    color: var(--ank-slate-500);
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.ank-btn-cancel:hover { background: var(--ank-slate-200); color: var(--ank-slate-900); }

/* ═══ CONFETTI ═══ */
.ank-confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 975;
}
@keyframes ankConfettiFall {
    0% { transform: translateY(0) translateX(0) rotate(0deg) scale(1); opacity: 1; }
    20% { opacity: 1; }
    100% { transform: translateY(400px) translateX(var(--drift, 100px)) rotate(var(--rot, 360deg)) scale(0.3); opacity: 0; }
}

/* ═══ CONFIRMED OVERLAY ═══ */
.ank-confirmed-overlay {
    position: absolute;
    inset: 0;
    z-index: 960;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    background: transparent;
    animation: ankFadeIn 0.3s ease;
    padding: 24px;
    pointer-events: none;
}

/* Success card — light glassmorphism green */
.ank-success-card {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1.5px solid rgba(34,197,94,0.25);
    border-radius: 24px;
    padding: 32px 32px 24px;
    text-align: center;
    max-width: 340px;
    width: 100%;
    box-shadow:
        0 24px 64px rgba(0,0,0,0.12),
        0 0 0 1px rgba(34,197,94,0.08),
        0 8px 32px rgba(34,197,94,0.1);
    animation: ankSuccessCardIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    position: relative;
    z-index: 961;
    pointer-events: auto;
}
@keyframes ankSuccessCardIn {
    from { opacity: 0; transform: translateX(48px) scale(0.93); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

.ank-success-check-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}
.ank-confirmed-check {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(34,197,94,0.35), 0 0 48px rgba(34,197,94,0.15);
    animation: ankBounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes ankBounceIn {
    from { transform: scale(0) rotate(-20deg); }
    60%  { transform: scale(1.15) rotate(4deg); }
    to   { transform: scale(1) rotate(0deg); }
}
.ank-confirmed-check svg { width: 34px; height: 34px; stroke: white; fill: none; stroke-width: 3; }

.ank-confirmed-title {
    font-size: 26px;
    font-weight: 900;
    color: #14532d;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}
.ank-confirmed-subtitle {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 0;
}
.ank-success-divider {
    height: 1px;
    background: rgba(34,197,94,0.15);
    margin: 16px 0;
}
.ank-success-point-name {
    font-size: 18px;
    font-weight: 900;
    color: #f97316;
    letter-spacing: -0.3px;
    margin-bottom: 10px;
}
.ank-success-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}
.ank-success-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: #374151;
    line-height: 1.4;
}
.ank-success-row-icon {
    font-size: 13px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Race flags elapsed section */
.ank-success-race {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(34,197,94,0.06), rgba(34,197,94,0.1));
    border: 1px solid rgba(34,197,94,0.2);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 18px;
}
.ank-race-flag {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1;
}
.ank-race-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 2px;
}
.ank-race-label {
    font-size: 9px;
    color: #6b7280;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.ank-race-time {
    font-size: 22px;
    font-weight: 900;
    color: #15803d;
    letter-spacing: -0.5px;
    line-height: 1;
}

/* Countdown ring */
.ank-success-countdown {
    position: relative;
    width: 52px;
    height: 52px;
    margin: 0 auto 8px;
}
.ank-countdown-svg {
    width: 52px;
    height: 52px;
    transform: rotate(-90deg);
}
.ank-countdown-track {
    fill: none;
    stroke: rgba(34,197,94,0.15);
    stroke-width: 3;
}
.ank-countdown-progress {
    fill: none;
    stroke: #22c55e;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}
.ank-countdown-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 900;
    color: #0f172a;
}
.ank-success-close-hint {
    font-size: 10px;
    color: rgba(15,23,42,0.35);
    letter-spacing: 0.3px;
}

/* ═══ CINEMATIC ZOOM OVERLAY — floating pill, no map darkening ═══ */
.ank-zoom-overlay {
    position: absolute;
    bottom: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 800;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(249,115,22,0.2);
    border-radius: 999px;
    padding: 10px 20px 10px 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(249,115,22,0.12);
    animation: ankFadeIn 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}
.ank-zoom-spinner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f97316, #f59e0b);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(249,115,22,0.4);
    position: relative;
}
.ank-zoom-spinner::before,
.ank-zoom-spinner::after { display: none; }
.ank-zoom-spinner svg { width: 16px; height: 16px; stroke: white; fill: none; stroke-width: 2.5; animation: ankSpin 1s linear infinite; }
@keyframes ankSpin { to { transform: rotate(360deg) } }
.ank-zoom-text {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}
.ank-zoom-country {
    font-size: 12px;
    color: #f97316;
    font-weight: 700;
    margin-top: 0;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .ank-overlay { padding: 0; }
    .ank-container {
        max-height: 100vh;
        border-radius: 0;
    }
    .ank-header-top { padding: 8px 12px; gap: 8px; }
    .ank-flags { padding: 0 12px 8px; }
    .ank-detail-panel {
        left: 8px;
        right: 8px;
        bottom: 8px;
    }
}
@media (max-width: 480px) {
    .ank-search-btn span { display: none; }
    .ank-search-btn { padding: 0 12px; width: 40px; justify-content: center; }
    .ank-search-btn svg { width: 17px; height: 17px; }
    .ank-success-card { padding: 24px 20px 20px; }
    .ank-confirmed-title { font-size: 24px; }
}
