/* ===== Winter Coalition EVE Map - Styles ===== */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2234;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-gold: #f59e0b;
    --accent-red: #ef4444;
    --accent-green: #22c55e;
    --accent-purple: #a855f7;
    --border-color: #1e293b;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --rating-s: #ff4444;
    --rating-a: #ff8800;
    --rating-b: #ffcc00;
    --rating-c: #44bb44;
    --rating-default: #6688aa;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ===== Header ===== */
#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    min-height: 48px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-cyan);
    white-space: nowrap;
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: none;
}

@media (min-width: 768px) {
    .subtitle { display: inline; }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    position: relative;
}

#searchInput {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    width: 180px;
    outline: none;
    transition: border-color 0.2s;
}

#searchInput:focus {
    border-color: var(--accent-cyan);
    width: 240px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 2000;
    box-shadow: var(--shadow);
}

.search-results.active { display: block; }

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}

.search-result-item .sys-name { font-weight: 600; }
.search-result-item .sys-region { color: var(--text-muted); font-size: 0.75rem; }

#header button {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.admin-link {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.admin-link:hover {
    background: var(--accent-cyan);
    color: var(--bg-primary);
    border-color: var(--accent-cyan);
}

#header button:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* ===== Main Layout ===== */
#main {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 12px;
    z-index: 500;
    transition: transform 0.3s;
}

.sidebar-section {
    margin-bottom: 16px;
}

.sidebar-section h3 {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.region-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.region-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.15s;
    color: var(--text-secondary);
}

.region-item:hover, .region-item.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.region-item .count {
    font-size: 0.7rem;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 10px;
    color: var(--text-muted);
}

.rating-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rating-btn {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.15s;
}

.rating-btn.active {
    border-color: var(--accent-cyan);
    color: var(--text-primary);
}

.rating-btn[data-rating="S"] { border-color: var(--rating-s); color: var(--rating-s); }
.rating-btn[data-rating="A"] { border-color: var(--rating-a); color: var(--rating-a); }
.rating-btn[data-rating="B"] { border-color: var(--rating-b); color: var(--rating-b); }
.rating-btn[data-rating="C"] { border-color: var(--rating-c); color: var(--rating-c); }

.stats {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.stats .stat-value {
    color: var(--accent-cyan);
    font-weight: 600;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    accent-color: var(--accent-cyan);
}

/* ===== Map ===== */
#map {
    flex: 1;
    background: var(--bg-primary);
}

.leaflet-container {
    background: var(--bg-primary) !important;
    font-family: inherit;
}

.leaflet-control-zoom a {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.leaflet-control-attribution {
    background: rgba(10, 14, 23, 0.8) !important;
    color: var(--text-muted) !important;
    font-size: 0.65rem !important;
}

.leaflet-control-attribution a { color: var(--accent-cyan) !important; }

/* System Marker */
.system-marker {
    transition: all 0.15s;
}

.system-marker:hover {
    transform: scale(1.5);
    z-index: 10000 !important;
}

.system-label {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 0 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.7);
}

/* Popup */
.eve-popup .leaflet-popup-content-wrapper {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.eve-popup .leaflet-popup-tip {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

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

.popup-content {
    min-width: 200px;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.popup-name {
    font-size: 1rem;
    font-weight: 700;
}

.popup-rating {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
}

.popup-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.popup-info strong { color: var(--text-primary); }

.popup-links {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

.popup-links a {
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 0.78rem;
    padding: 4px 8px;
    border: 1px solid var(--accent-cyan);
    border-radius: 4px;
    transition: all 0.15s;
}

.popup-links a:hover {
    background: var(--accent-cyan);
    color: var(--bg-primary);
}

/* ===== Legend ===== */
.legend {
    position: absolute;
    bottom: 40px;
    right: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    z-index: 800;
    box-shadow: var(--shadow);
    font-size: 0.8rem;
    min-width: 140px;
    display: none;
}

.legend.active { display: block; }

.legend h4 {
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===== Loading ===== */
.loading {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Status Bar ===== */
#statusBar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--text-muted);
    min-height: 28px;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 900;
    }
    .sidebar.open { transform: translateX(0); }
    
    #searchInput { width: 120px; }
    #searchInput:focus { width: 160px; }
    
    .legend { bottom: 36px; right: 8px; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Region colors for map */
.region-label {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.15);
    text-transform: uppercase;
    letter-spacing: 2px;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
}
