* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

:root {
    --bg-color: #0d1117;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.08);
    --glass-active: rgba(255, 255, 255, 0.12);
    
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    
    --status-none: #334155;
    --status-beg: #fbbf24;
    --status-adv: #8b5cf6;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1rem 1rem 0 1rem;
    position: relative;
    overflow: hidden;
}

.main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
}

/* Header */
.main-header {
    margin: 0.25rem 2rem 0 2rem;
    padding: 0;
    position: relative;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-titles h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-content .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.2rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn.primary {
    background: linear-gradient(135deg, var(--accent), #2563eb);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
    background: linear-gradient(135deg, #4f46e5, #3b82f6);
}

.btn.secondary {
    background: var(--glass-active);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.btn-close:hover {
    color: #ef4444;
}

/* Real Map Container */
.real-map-container {
    width: 100%;
    flex: 1;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--glass-border);
    border-bottom: none;
    z-index: 1;
}

/* Leaflet Overrides for Glassmorphism */
.leaflet-popup-content-wrapper {
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(8px) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
}

.leaflet-popup-tip {
    background: rgba(15, 23, 42, 0.85) !important;
}

.leaflet-container {
    font-family: inherit !important;
}

.leaflet-popup-content h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.leaflet-popup-content button {
    margin-top: 10px;
    width: 100%;
}

/* Edit Mode Draggable Vertices */
.edit-vertex-marker {
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: bold;
}
.edit-vertex-marker span {
    pointer-events: none;
}
.edit-vertex-marker:has(span) {
    background: #3b82f6;
}
.edit-vertex-marker:active {
    cursor: grabbing;
}
.edit-vertex-ghost {
    background: rgba(255, 0, 0, 0.4);
    border: 1px dashed white;
    border-radius: 50%;
    cursor: copy;
}
.edit-vertex-ghost:hover {
    background: rgba(255, 0, 0, 0.8);
}

/* Region Labels */
.region-marker {
    background: none !important;
    border: none !important;
    pointer-events: none;
}

.marker-content {
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    line-height: 0.9; /* Reduced by half (roughly 0.9 instead of 1.5) */
    text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.8), 0 0 5px rgba(0, 0, 0, 0.8);
    white-space: pre-line;
    transform: translate(-50%, -50%);
    width: 150px; /* Force wrap if necessary */
    pointer-events: auto;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.marker-name {
    margin-bottom: 2px;
}

.marker-progress {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.85;
    color: var(--text-muted);
}

.region-marker.focused .marker-content {
    font-size: 1.1rem;
    text-shadow: 0 0 10px var(--accent-glow), 2px 2px 2px black;
    color: var(--accent);
}

.region-marker.focused .marker-progress {
    color: white;
    opacity: 1;
}

/* Side Panel */
.dances-panel {
    position: absolute;
    right: 2rem;
    top: 6rem;
    bottom: 2rem;
    width: 380px;
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    opacity: 1;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2);
    z-index: 30;
    box-shadow: -10px 0 40px rgba(0,0,0,0.5);
}

.dances-panel.hidden {
    transform: translateX(120%);
    opacity: 0;
    pointer-events: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.panel-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#selectedRegionName {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 0.2rem;
    color: white;
}

.panel-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--glass-active);
}
.stat-badge.learned {
    color: var(--status-good);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

/* Dance List */
.dances-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding-right: 0.5rem;
}
.dances-list::-webkit-scrollbar {
    width: 6px;
}
.dances-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 3px;
}

.dance-item {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.dance-item:hover {
    background: var(--glass-hover);
    transform: translateX(5px);
    border-color: rgba(255,255,255,0.2);
}

.dance-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.dance-status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 0.4rem;
    box-shadow: 0 0 10px currentColor;
}
.status-none .dance-status-indicator { color: var(--status-none); background: var(--status-none); box-shadow: none; }
.status-beginner .dance-status-indicator { color: var(--status-beg); background: var(--status-beg); }
.status-advanced .dance-status-indicator { color: var(--status-adv); background: var(--status-adv); }

.dance-action {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    background: #1e293b;
    border-radius: 20px;
    padding: 2rem;
    z-index: 101;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
}

.status-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.status-btn {
    flex: 1;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.8rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.status-btn.active[data-status="none"] { background: var(--status-none); color: white; border-color: rgba(255,255,255,0.2); }
.status-btn.active[data-status="beginner"] { background: rgba(251, 191, 36, 0.2); color: var(--status-beg); border-color: var(--status-beg); }
.status-btn.active[data-status="advanced"] { background: rgba(139, 92, 246, 0.2); color: var(--status-adv); border-color: var(--status-adv); }

.input-row {
    display: flex;
    gap: 0.5rem;
}

input[type="url"] {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}
input[type="url"]:focus {
    border-color: var(--accent);
}

.video-container {
    margin-top: 1.5rem;
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--glass-border);
}

.video-container.hidden {
    display: none;
}

.video-container iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

/* Animations */
@keyframes glow {
    0% { box-shadow: 0 0 5px currentColor; }
    50% { box-shadow: 0 0 15px currentColor; }
    100% { box-shadow: 0 0 5px currentColor; }
}
