/* ===================================
   MoeNet Network Map - Styles
   =================================== */

/* ===== CSS Variables ===== */
:root {
    /* Colors - Dark Mode (Default) */
    --bg-primary: #0a0f1e;
    --bg-sidebar: rgba(10, 15, 30, 0.85);
    --bg-card: rgba(20, 30, 50, 0.6);
    --bg-hover: rgba(59, 130, 246, 0.1);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --accent-online: #22c55e;
    --accent-planned: #f59e0b;
    --accent-offline: #ef4444;

    --border-color: rgba(255, 255, 255, 0.1);

    --sidebar-width: 320px;
    --transition: 300ms ease;
}

/* Light Mode */
[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-sidebar: rgba(255, 255, 255, 0.9);
    --bg-card: rgba(241, 245, 249, 0.8);
    --bg-hover: rgba(59, 130, 246, 0.1);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: rgba(0, 0, 0, 0.1);
}

/* ===== Reset ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ===== Map ===== */
#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-sidebar);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-img {
    height: 40px;
    width: auto;
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search */
.search-box {
    padding: 16px 20px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: border-color var(--transition);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    border-color: var(--accent-primary);
}

.search-icon {
    position: absolute;
    left: 36px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Filters */
.filters {
    padding: 0 20px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Info Panel */
.info-panel {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.info-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.info-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.stats {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 24px;
}

.stats-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.stats-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.info-instruction {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Node Detail */
.node-detail {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.back-btn {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: 0.875rem;
    cursor: pointer;
    margin-bottom: 16px;
    padding: 0;
}

.back-btn:hover {
    text-decoration: underline;
}

.node-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.node-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.node-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.node-info-row .label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.node-info-row .value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.online {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-online);
}

.status-badge.planned {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-planned);
}

.status-badge.offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-offline);
}

/* Sidebar Controls */
.sidebar-controls {
    padding: 16px 20px;
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-color);
}

.control-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.control-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

#langToggle {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Theme toggle icons */
.icon-moon {
    display: none;
}

[data-theme="light"] .icon-sun {
    display: none;
}

[data-theme="light"] .icon-moon {
    display: block;
}

/* Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Mobile Toggle */
.mobile-sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 48px;
    height: 48px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* ===== Map Marker Styles ===== */
.marker {
    width: 16px;
    height: 16px;
    background: var(--accent-primary);
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 4px var(--accent-glow);
    animation: pulse 2s infinite;
}

.marker.planned {
    background: var(--accent-planned);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.3);
}

.marker.offline {
    background: var(--accent-offline);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3);
    animation: none;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 4px var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.2);
    }
}

/* Map popup */
.mapboxgl-popup-content {
    background: var(--bg-sidebar) !important;
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px !important;
    padding: 16px !important;
    min-width: 180px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.mapboxgl-popup-close-button {
    color: var(--text-muted);
    font-size: 18px;
    padding: 8px;
}

.mapboxgl-popup-tip {
    border-top-color: var(--bg-sidebar) !important;
}

.popup-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.popup-location {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.open .sidebar-header {
        padding-left: 70px;
        /* Make room for the toggle button */
    }

    .mobile-sidebar-toggle {
        display: flex;
    }
}