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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0e27;
    color: #fff;
    overflow: hidden;
}

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

header {
    background: rgba(10, 14, 39, 0.95);
    padding: 1rem 2rem;
    border-bottom: 2px solid #1e3a8a;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    position: relative;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-buttons {
    position: absolute;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.directory-link {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.directory-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.share-button {
    width: 48px;
    height: 48px;
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid #334155;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 10px;
}

.share-button:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.share-button img {
    width: 100%;
    height: 100%;
    filter: brightness(0) invert(1);
    transition: filter 0.3s ease;
}

.share-button:hover img {
    filter: brightness(0) invert(1) drop-shadow(0 0 4px rgba(59, 130, 246, 0.8));
}

.stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.stat-label {
    color: #94a3b8;
    font-size: 0.875rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: #60a5fa;
}

.stat-value.online {
    color: #34d399;
}

.stat-value.offline {
    color: #f87171;
}

.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#particle-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    pointer-events: none;
}

.controls {
    background: rgba(10, 14, 39, 0.95);
    padding: 1rem 2rem;
    border-top: 2px solid #1e3a8a;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    z-index: 1000;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
    max-width: 600px;
}

#pds-search {
    flex: 1;
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid #334155;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

#pds-search:focus {
    outline: none;
    border-color: #60a5fa;
}

#pds-search::placeholder {
    color: #64748b;
}

.info-text {
    color: #94a3b8;
    font-size: 0.875rem;
    text-align: center;
}

.btn {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.btn:active {
    transform: translateY(0);
}

.btn.active {
    background: linear-gradient(135deg, #10b981, #059669);
}

label {
    color: #94a3b8;
    font-size: 0.875rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

input[type="range"] {
    width: 100px;
}

#speed-value {
    color: #60a5fa;
    font-weight: bold;
    min-width: 30px;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 14, 39, 0.95);
    padding: 2rem;
    border-radius: 0.5rem;
    border: 2px solid #1e3a8a;
    z-index: 2000;
    text-align: center;
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid rgba(96, 165, 250, 0.2);
    border-top: 4px solid #60a5fa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.error {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(127, 29, 29, 0.95);
    padding: 2rem;
    border-radius: 0.5rem;
    border: 2px solid #dc2626;
    z-index: 2000;
    max-width: 500px;
}

.error.hidden {
    display: none;
}

.error p {
    color: #fecaca;
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
    background: rgba(10, 14, 39, 0.95);
    color: #fff;
    border: 2px solid #1e3a8a;
    border-radius: 0.5rem;
}

.leaflet-popup-tip {
    background: rgba(10, 14, 39, 0.95);
}

.leaflet-popup-content {
    margin: 0.75rem;
}

.leaflet-popup-content h3 {
    color: #60a5fa;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.leaflet-popup-content p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    color: #cbd5e1;
}

.leaflet-popup-content .status {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

.leaflet-popup-content .status.online {
    background: #065f46;
    color: #34d399;
}

.leaflet-popup-content .status.offline {
    background: #7f1d1d;
    color: #f87171;
}

/* Custom marker pulse animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(52, 211, 153, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    }
}

/* Cluster marker styles */
.cluster-marker {
    background: rgba(59, 130, 246, 0.2);
    border: 3px solid #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
    position: relative;
}

.cluster-circle {
    position: absolute;
    border: 2px solid rgba(59, 130, 246, 0.6);
    border-radius: 50%;
    animation: cluster-wave 2s ease-out infinite;
}

@keyframes cluster-wave {
    0% {
        width: 100%;
        height: 100%;
        opacity: 1;
    }
    100% {
        width: 200%;
        height: 200%;
        opacity: 0;
    }
}

/* Continent label styles */
.continent-label {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: none;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

.continent-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #60a5fa;
    margin-bottom: 0.25rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.continent-count {
    font-size: 1rem;
    color: #94a3b8;
    font-weight: 500;
}

/* Cluster popup styles */
.cluster-popup .leaflet-popup-content-wrapper {
    max-height: 500px;
    overflow: hidden;
}

.cluster-popup-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #1e3a8a;
}

.cluster-popup-header h3 {
    color: #60a5fa;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.cluster-popup-header p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    color: #cbd5e1;
}

.cluster-popup-list {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
}

.cluster-popup-list::-webkit-scrollbar {
    width: 8px;
}

.cluster-popup-list::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 4px;
}

.cluster-popup-list::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

.cluster-popup-list::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.cluster-popup-item {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid #334155;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.cluster-popup-item:last-child {
    margin-bottom: 0;
}

.cluster-popup-item h4 {
    color: #60a5fa;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    word-break: break-all;
}

.cluster-popup-item p {
    margin: 0.25rem 0;
    font-size: 0.8rem;
    color: #cbd5e1;
}

.cluster-popup-item .status {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: bold;
    margin-top: 0.5rem;
}
