/* Global Styles */
:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --accent: #38bdf8;
    --hotspot-color: rgba(56, 189, 248, 0.6);
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.main-container {
    max-width: 1200px;
    width: 100%;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin: 0;
}

/* Map Container */
.map-wrapper {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    max-width: 100%;
    transition: border 0.3s;
}

#spainMap {
    display: block;
    max-width: 100%;
    height: auto;
    filter: brightness(0.9) contrast(1.1);
    transition: filter 0.3s ease;
}

/* Hotspots - Updated for Heatmap & Drag */
.province-hotspot {
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: var(--hotspot-color);
    /* Fallback */
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    transition: width 0.3s, height 0.3s, transform 0.2s, box-shadow 0.3s, background-color 0.5s;
    z-index: 10;
}

/* Edit Mode styling */
.map-wrapper.edit-mode {
    border: 2px dashed #22c55e;
    cursor: crosshair;
}

.map-wrapper.edit-mode .province-hotspot {
    cursor: grab;
    animation: wiggle 2s infinite;
}

.map-wrapper.edit-mode .province-hotspot:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
}

@keyframes wiggle {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    25% {
        transform: translate(-50%, -50%) rotate(-5deg);
    }

    75% {
        transform: translate(-50%, -50%) rotate(5deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
}

.province-hotspot::after {
    /* pulsing effect inside */
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px currentColor;
    /* Glow with same color */
    opacity: 0.7;
}

.province-hotspot:hover {
    transform: translate(-50%, -50%) scale(1.5);
    z-index: 20;
}

/* Tooltip */
.glass-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 16px;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 100;
    min-width: 200px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.glass-tooltip.hidden {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.8rem;
    margin-bottom: 0.8rem;
}

.tooltip-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--accent);
}

#tt-icon {
    font-size: 1.5rem;
}

.data-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.label {
    color: var(--text-secondary);
}

.value {
    color: var(--text-primary);
    font-weight: 500;
}

/* UI Controls */
.cal-toggle-btn {
    background: var(--glass-bg);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cal-toggle-btn:hover {
    background: var(--accent);
    color: #000;
}

/* Debug Log hidden by default now as UI is cleaner */
.debug-log {
    display: none;
}