/* Reset and base styles */

:root {
    --main-gradient: linear-gradient(135deg, #4ba265 0%, #d2d435 100%);
}

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


body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--main-gradient);
    color: #333;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}
/* Header */
.header {
    background: #f9f9f9;
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

.header-title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.header-credit {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin: 0;
    margin-top: 0.2rem;
    font-weight: 400;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stats {
    background: var(--main-gradient);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.menu-toggle {
    display: none; /* Hide on desktop */
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #2c3e50;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    order: -1; /* Make sure it appears first in the flex container */
}

.menu-toggle:hover {
    background-color: rgba(44, 62, 80, 0.1);
}

/* Main content area */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar overlay for responsive */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
    pointer-events: none;
}

.sidebar-overlay.open {
    display: block;
    pointer-events: auto;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: #f9f9f9;
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: left 0.3s ease;
}

/* Desktop sidebar positioning */
@media (min-width: 769px) {
    .sidebar {
        position: relative;
        left: 0;
    }
    
    .menu-toggle {
        display: none;
    }
}

.filter-section, .stats-section, .legend-section {
    margin-bottom: 2rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.filter-section h3, .stats-section h3, .legend-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 0.5rem;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #34495e;
    font-size: 0.9rem;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 0.6rem;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 0.7rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}


.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #ecf0f1;
    color: #34495e;
}

.btn-secondary:hover {
    background: #d5dbdb;
    transform: translateY(-1px);
}
/* Statistics */
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #ecf0f1;
}

.stat-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.stat-label {
    font-weight: 500;
    color: #34495e;
    font-size: 0.9rem;
}

.stat-value {
    font-weight: 700;
    color: #2c3e50;
    background: var(--main-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-breakdown {
    margin-top: 0.5rem;
}

.type-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    color: #7f8c8d;
    gap: 2rem;
}

/* Legend */
.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    color: #34495e;
}

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 0.8rem;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.legend-marker.type-1 {
    background: #e74c3c;
}

.legend-marker.type-2 {
    background: #3498db;
}

.legend-marker.type-3 {
    background: #f39c12;
}

.legend-marker.user-location {
    background: rgb(46, 184, 115);
    position: relative;
}

/* Map container */
.map-container {
    flex: 1;
    position: relative;
    background: #ecf0f1;
}

#map {
    width: 100%;
    height: 100%;
}

/* Loading */
.loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #ecf0f1;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #34495e;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.modal-content::-webkit-scrollbar {
    display: none;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: #7f8c8d;
    transition: color 0.3s ease;
}

.close:hover {
    color: #e74c3c;
}

/* Node details */
.node-header {
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.node-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.node-type {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.node-type.type-1 {
    background: #e74c3c;
}

.node-type.type-2 {
    background: #3498db;
}

.node-type.type-3 {
    background: #f39c12;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;  
}

.detail-label {
    font-size: 0.8rem;
    color: #7f8c8d;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.info-tooltip {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    text-align: center;
    font-size: 10px;
    line-height: 16px;
    margin-left: 5px;
    cursor: help;
    font-weight: bold;
}

.info-tooltip:hover {
    background: #2980b9;
}

.detail-value {
    font-size: 1rem;
    color: #2c3e50;
    font-weight: 500;
    word-break: break-all;
}

.params-section {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.params-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.8rem;
}

.param-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.param-key {
    color: #7f8c8d;
    font-weight: 500;
}

.param-value {
    color: #2c3e50;
    font-weight: 600;
}

/* Leaflet customizations */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-content {
    margin: 0.8rem;
    line-height: 1.4;
}

.popup-title {
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.popup-info {
    font-size: 0.9rem;
    color: #34495e;
    margin-bottom: 0.3rem;
}

.popup-button {
    background: var(--main-gradient);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: transform 0.3s ease;
}

.popup-button:hover {
    transform: translateY(-1px);
}

/* QR Code styles */
.qr-code-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
    min-height: 100px;
}

.qr-code {
    border: 1px solid #ecf0f1;
    border-radius: 4px;
    background: white;
}

.qr-code-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.mesh-link-section {
    display: flex;
    flex-direction: column;
}

.qr-code-label {
    font-size: 0.7rem;
    color: #7f8c8d;
    text-align: center;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

/* Mesh Link and QR Code container */
.mesh-link-qr-container {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

.mesh-link-qr-container .detail-item {
    margin: 0;
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.mesh-link-qr-container .mesh-link-section {
    flex: 2;
    min-width: 0;
}

.mesh-link-qr-container .qr-code-section {
    flex: 0 0 auto;
    width: 140px;
    justify-content: center;
}

/* Responsive design */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .header-controls {
        flex-direction: row-reverse;
        gap: 0.5rem;
    }
    
    .stats {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .sidebar {
        width: 320px;
        position: fixed;
        left: -320px;
        transition: left 0.3s ease;
        z-index: 2001; /* Higher than overlay */
        height: 100%;
        top: 0;
        padding-top: 7rem; /* Added padding to push content down */
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
        background: #f9f9f9;
        backdrop-filter: blur(10px);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999; /* Lower than sidebar */
        display: none;
    }
    
    .sidebar-overlay.open {
        display: block;
    }
    
    .header {
        padding: 1rem;
        position: fixed; /* Changed to fixed */
        top: 0;
        left: 0;
        right: 0;
        z-index: 2002; /* Highest z-index */
    }
    

    .header h1 {
        font-size: 1.4rem;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 1.5rem;
    }
    
    .mesh-link-qr-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mesh-link-qr-container .qr-code-section {
        width: 100%;
        align-self: center;
    }
    
    .qr-code {
        width: 80px;
        height: 80px;
    }
}

/* Hide scrollbars but keep functionality */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* Copy button styles */
.copy-button {
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.copy-button {
    background: var(--main-gradient);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.copy-button:hover {
    background: var(--main-gradient);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.copy-button:active {
    transform: translateY(0);
}

.copy-button.copied {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.mesh-link-section {
    position: relative;
}

.mesh-link-with-copy {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
