/* ==============================================
   Map Module - Neon Glossy Theme
   ============================================== */

.map-container {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: var(--spacing-lg);
    height: calc(100vh - 200px);
    min-height: 500px;
}

@media (max-width: 1000px) {
    .map-container {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* ==============================================
   Map View - Glassmorphism Container
   ============================================== */

.map-view {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
}

/* Dark mode map styling overlay */
[data-theme="dark"] .map-view {
    border-color: rgba(0, 255, 255, 0.15);
    box-shadow:
        0 0 30px rgba(0, 255, 255, 0.1),
        inset 0 0 60px rgba(0, 0, 0, 0.3);
}

/* ==============================================
   Map Sidebar - Neon Glassmorphism
   ============================================== */

.map-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    overflow-y: auto;
}

.map-sidebar-header {
    padding: var(--spacing-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .map-sidebar-header {
    background: linear-gradient(135deg, rgba(20, 25, 35, 0.95), rgba(15, 20, 30, 0.98));
    border-color: rgba(0, 255, 255, 0.2);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .map-sidebar-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.5), transparent);
}

.map-sidebar-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.map-sidebar-header h3 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0;
}

[data-theme="dark"] .map-sidebar-header h3 {
    background: linear-gradient(135deg, #00ffff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

.map-sidebar-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 var(--spacing-sm);
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-pill);
}

[data-theme="dark"] .map-sidebar-count {
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

.map-sidebar-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

[data-theme="dark"] .map-sidebar-hint {
    color: rgba(0, 255, 255, 0.5);
}

.map-sidebar-hint::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* ==============================================
   Map Legend - Neon Cards
   ============================================== */

.map-legend {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

[data-theme="dark"] .map-legend-item {
    background: linear-gradient(135deg, rgba(30, 35, 50, 0.9), rgba(20, 25, 40, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .map-legend-item:hover {
    border-color: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.1);
    transform: translateX(4px);
}

/* Neon Marker Dots */
.map-marker {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
}

[data-theme="dark"] .map-marker::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    opacity: 0.4;
    filter: blur(4px);
}

/* Goalkeeper - Golden Neon */
.map-marker-gk {
    background: #FFD60A;
}

[data-theme="dark"] .map-marker-gk {
    background: linear-gradient(135deg, #FFD60A, #FFA500);
    box-shadow: 0 0 10px #FFD60A, 0 0 20px rgba(255, 214, 10, 0.5);
}

[data-theme="dark"] .map-marker-gk::after {
    background: #FFD60A;
}

/* Defender - Green Neon */
.map-marker-def {
    background: #34C759;
}

[data-theme="dark"] .map-marker-def {
    background: linear-gradient(135deg, #34C759, #00ff88);
    box-shadow: 0 0 10px #34C759, 0 0 20px rgba(52, 199, 89, 0.5);
}

[data-theme="dark"] .map-marker-def::after {
    background: #34C759;
}

/* Midfielder - Cyan Neon */
.map-marker-mid {
    background: #007AFF;
}

[data-theme="dark"] .map-marker-mid {
    background: linear-gradient(135deg, #00d4ff, #007AFF);
    box-shadow: 0 0 10px #00d4ff, 0 0 20px rgba(0, 212, 255, 0.5);
}

[data-theme="dark"] .map-marker-mid::after {
    background: #00d4ff;
}

/* Attacker - Red/Pink Neon */
.map-marker-att {
    background: #FF3B30;
}

[data-theme="dark"] .map-marker-att {
    background: linear-gradient(135deg, #ff006e, #FF3B30);
    box-shadow: 0 0 10px #ff006e, 0 0 20px rgba(255, 0, 110, 0.5);
}

[data-theme="dark"] .map-marker-att::after {
    background: #ff006e;
}

/* Match - Purple Neon */
.map-marker-match {
    background: #AF52DE;
    border-radius: 4px;
}

[data-theme="dark"] .map-marker-match {
    background: linear-gradient(135deg, #bf5af2, #8b5cf6);
    box-shadow: 0 0 10px #bf5af2, 0 0 20px rgba(191, 90, 242, 0.5);
}

[data-theme="dark"] .map-marker-match::after {
    background: #bf5af2;
    border-radius: 4px;
}

/* ==============================================
   Map List - Sidebar Content
   ============================================== */

.map-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    max-height: 400px;
}

.map-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.map-list-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-input);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

[data-theme="dark"] .map-list-item {
    background: linear-gradient(135deg, rgba(25, 30, 45, 0.9), rgba(20, 25, 40, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
}

.map-list-item:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

[data-theme="dark"] .map-list-item:hover {
    background: linear-gradient(135deg, rgba(35, 40, 60, 0.95), rgba(25, 30, 50, 0.98));
    border-color: rgba(0, 255, 255, 0.3);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(0, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.map-list-item.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

[data-theme="dark"] .map-list-item.active {
    border-color: rgba(0, 255, 255, 0.5);
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.1), rgba(0, 200, 255, 0.05));
    box-shadow:
        0 0 30px rgba(0, 255, 255, 0.15),
        inset 0 0 20px rgba(0, 255, 255, 0.05);
}

.map-list-photo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 2px solid transparent;
}

[data-theme="dark"] .map-list-photo {
    border: 2px solid rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.1);
}

.map-list-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.map-list-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-input);
}

[data-theme="dark"] .map-list-icon {
    background: linear-gradient(135deg, rgba(191, 90, 242, 0.2), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(191, 90, 242, 0.3);
    box-shadow: 0 0 15px rgba(191, 90, 242, 0.2);
}

.map-list-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

[data-theme="dark"] .map-list-icon svg {
    color: #bf5af2;
    filter: drop-shadow(0 0 5px rgba(191, 90, 242, 0.5));
}

.map-list-info {
    flex: 1;
    min-width: 0;
}

.map-list-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .map-list-name {
    background: linear-gradient(135deg, #ffffff, #a0a0a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.map-list-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.map-list-meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .map-list-meta {
    color: rgba(0, 255, 255, 0.6);
}

/* ==============================================
   Custom Leaflet Map Markers - Neon Glow
   ============================================== */

.custom-marker {
    background: transparent !important;
    border: none !important;
}

.custom-marker svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

[data-theme="dark"] .custom-marker svg {
    filter: drop-shadow(0 0 8px currentColor);
}

/* ==============================================
   Leaflet Popup - Glassmorphism
   ============================================== */

.leaflet-popup-content-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-xl);
    padding: 0;
}

[data-theme="dark"] .leaflet-popup-content-wrapper {
    background: linear-gradient(135deg, rgba(20, 25, 40, 0.98), rgba(15, 20, 35, 0.99));
    border-color: rgba(0, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(0, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.leaflet-popup-content {
    margin: 0 !important;
    color: var(--text-primary);
}

.leaflet-popup-tip-container {
    display: none;
}

.leaflet-popup-close-button {
    color: var(--text-tertiary) !important;
    font-size: 20px !important;
    padding: 8px !important;
    right: 4px !important;
    top: 4px !important;
}

[data-theme="dark"] .leaflet-popup-close-button {
    color: rgba(0, 255, 255, 0.6) !important;
}

.leaflet-popup-close-button:hover {
    color: var(--text-primary) !important;
}

/* Map Popup Content */
.map-popup {
    padding: var(--spacing-lg);
    min-width: 220px;
}

.map-popup-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.map-popup-photo {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
}

[data-theme="dark"] .map-popup-photo {
    border: 2px solid rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

.map-popup-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.map-popup-info {
    flex: 1;
    min-width: 0;
}

.map-popup-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
}

[data-theme="dark"] .map-popup-name {
    background: linear-gradient(135deg, #00ffff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.map-popup-team {
    font-size: 12px;
    color: var(--text-secondary);
}

.map-popup-details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.map-popup-details span {
    padding: 4px 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
}

[data-theme="dark"] .map-popup-details span {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.2);
    color: rgba(0, 255, 255, 0.8);
}

.map-popup-match {
    text-align: center;
}

.map-popup-teams {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

[data-theme="dark"] .map-popup-teams strong {
    color: #00ffff;
}

.map-popup-match-info {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.map-popup-competition {
    font-size: 11px;
    padding: 4px 12px;
    background: var(--accent-soft);
    border-radius: var(--radius-pill);
    color: var(--accent);
    display: inline-block;
}

[data-theme="dark"] .map-popup-competition {
    background: linear-gradient(135deg, rgba(191, 90, 242, 0.2), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(191, 90, 242, 0.3);
    color: #bf5af2;
}

/* Popup Button */
.map-popup .btn {
    margin-top: var(--spacing-sm);
}

[data-theme="dark"] .map-popup .btn-primary {
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    border: none;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

[data-theme="dark"] .map-popup .btn-primary:hover {
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
    transform: translateY(-1px);
}

/* ==============================================
   Leaflet Controls - Dark Theme Override
   ============================================== */

[data-theme="dark"] .leaflet-control-zoom {
    border: none !important;
    overflow: hidden;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .leaflet-control-zoom a {
    background: linear-gradient(135deg, rgba(30, 35, 50, 0.95), rgba(20, 25, 40, 0.98)) !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #00ffff !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
}

[data-theme="dark"] .leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

[data-theme="dark"] .leaflet-control-zoom a:hover {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.15), rgba(0, 200, 255, 0.1)) !important;
    color: #00ffff !important;
}

[data-theme="dark"] .leaflet-control-attribution {
    background: rgba(15, 20, 30, 0.8) !important;
    color: rgba(255, 255, 255, 0.4) !important;
    font-size: 10px !important;
}

[data-theme="dark"] .leaflet-control-attribution a {
    color: rgba(0, 255, 255, 0.6) !important;
}

/* ==============================================
   Empty State
   ============================================== */

.empty-state-sm {
    padding: var(--spacing-xl);
    text-align: center;
}

[data-theme="dark"] .empty-state-sm p {
    color: rgba(255, 255, 255, 0.5);
}

/* ==============================================
   Responsive
   ============================================== */

@media (max-width: 1000px) {
    .map-sidebar {
        max-height: 400px;
    }

    .map-sidebar-content {
        max-height: 250px;
    }
}

/* ==============================================
   Marker Cluster Styles
   ============================================== */

.custom-cluster-icon {
    background: transparent !important;
}

.cluster-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    color: white;
    transition: transform 0.2s ease;
}

.cluster-icon:hover {
    transform: scale(1.1);
}

.cluster-icon span {
    font-size: 12px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.marker-cluster-small {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.marker-cluster-medium {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
}

.marker-cluster-medium span {
    font-size: 14px;
}

.marker-cluster-large {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #EF4444, #DC2626);
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.4);
}

.marker-cluster-large span {
    font-size: 16px;
}

/* Dark mode cluster icons */
.cluster-icon.dark.marker-cluster-small {
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5), 0 0 30px rgba(0, 212, 255, 0.3);
}

.cluster-icon.dark.marker-cluster-medium {
    background: linear-gradient(135deg, #bf5af2, #8b5cf6);
    box-shadow: 0 0 15px rgba(191, 90, 242, 0.5), 0 0 30px rgba(191, 90, 242, 0.3);
}

.cluster-icon.dark.marker-cluster-large {
    background: linear-gradient(135deg, #ff006e, #ff3b5c);
    box-shadow: 0 0 15px rgba(255, 0, 110, 0.5), 0 0 30px rgba(255, 0, 110, 0.3);
}

/* Simple marker styles */
.simple-marker {
    background: transparent !important;
    border: none !important;
}

/* Map list more indicator */
.map-list-more {
    text-align: center;
    padding: var(--spacing-md);
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
}

[data-theme="dark"] .map-list-more {
    color: rgba(0, 255, 255, 0.5);
}

/* Map loading state */
.map-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    gap: var(--spacing-md);
}

.map-loading .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.map-loading p {
    font-size: 13px;
    color: var(--text-secondary);
}

[data-theme="dark"] .map-loading .loading-spinner {
    border-color: rgba(0, 255, 255, 0.2);
    border-top-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

/* Override default MarkerCluster styles */
.marker-cluster {
    background: transparent !important;
}

.marker-cluster div {
    background: transparent !important;
}
