:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #1a1a2e;
    --accent-purple: #9b59b6;
    --accent-cyan: #00d4ff;
    --accent-pink: #ff006e;
    --status-green: #00ff88;
    --status-yellow: #ffcc00;
    --status-red: #ff4444;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

.app-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Star Field */
.star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Map Container */
.map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.mapboxgl-canvas {
    outline: none;
}

/* Header */
.header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(26, 26, 46, 0.7);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(155, 89, 182, 0.2);
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(155, 89, 182, 0.5);
}

.header-center {
    flex: 1;
    max-width: 400px;
    margin: 0 24px;
}

.search-input {
    width: 100%;
    padding: 12px 20px;
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid rgba(155, 89, 182, 0.3);
    border-radius: 25px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 20px rgba(155, 89, 182, 0.3);
}

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

.online-count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--status-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.icon-btn, .avatar-btn {
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid rgba(155, 89, 182, 0.3);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.icon-btn:hover, .avatar-btn:hover {
    border-color: var(--accent-purple);
    box-shadow: 0 0 20px rgba(155, 89, 182, 0.4);
    transform: scale(1.05);
}

/* Map Markers */
.map-marker {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.map-marker:hover {
    transform: scale(1.2);
    z-index: 10;
}

.marker-container {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--status-green);
    animation: float 3s ease-in-out infinite;
    position: relative;
}

.marker-container[data-status="busy"] {
    border-color: var(--status-yellow);
    box-shadow: 0 0 20px var(--status-yellow);
}

.marker-container[data-status="in-call"] {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px var(--accent-cyan);
}

.marker-container[data-status="available"] {
    box-shadow: 0 0 20px var(--status-green);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.marker-emoji {
    font-size: 1.5rem;
}

/* Action Panel */
.action-panel {
    position: fixed;
    top: 70px;
    right: 0;
    width: 350px;
    height: calc(100vh - 70px);
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(155, 89, 182, 0.2);
    padding: 24px;
    z-index: 200;
    overflow-y: auto;
}

.slide-in {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--text-primary);
}

.panel-header {
    text-align: center;
    padding-top: 20px;
}

.panel-avatar {
    width: 100px;
    height: 100px;
    margin: 0 auto 16px;
    background: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border: 3px solid var(--accent-purple);
}

.panel-header h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

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

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-top: 12px;
    text-transform: capitalize;
}

.user-bio {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    margin: 20px 0;
    padding: 16px;
    background: rgba(10, 10, 15, 0.5);
    border-radius: 12px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.action-btn {
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-btn {
    background: linear-gradient(135deg, var(--accent-purple), #7d3c98);
    color: white;
}

.chat-btn:hover {
    box-shadow: 0 0 30px rgba(155, 89, 182, 0.5);
    transform: translateY(-2px);
}

.video-btn {
    background: linear-gradient(135deg, var(--accent-cyan), #0099cc);
    color: white;
}

.video-btn:hover {
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
    transform: translateY(-2px);
}

.wave-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.wave-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Panel */
.chat-panel {
    position: fixed;
    bottom: 40px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: rgba(26, 26, 46, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(155, 89, 182, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow: hidden;
}

.slide-up {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: rgba(10, 10, 15, 0.5);
    border-bottom: 1px solid rgba(155, 89, 182, 0.2);
}

.chat-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    font-size: 2rem;
}

.chat-user h3 {
    font-size: 1rem;
    margin-bottom: 2px;
}

.chat-status {
    font-size: 0.75rem;
    color: var(--status-green);
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    gap: 8px;
    max-width: 80%;
}

.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.received {
    align-self: flex-start;
}

.msg-avatar {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 100%;
}

.message.sent .msg-bubble {
    background: linear-gradient(135deg, var(--accent-purple), #7d3c98);
    border-bottom-right-radius: 4px;
}

.message.received .msg-bubble {
    background: var(--bg-primary);
    border-bottom-left-radius: 4px;
}

.msg-bubble p {
    font-size: 0.9rem;
    line-height: 1.4;
}

.msg-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

.chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(10, 10, 15, 0.5);
    border-top: 1px solid rgba(155, 89, 182, 0.2);
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.chat-input input {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-primary);
    border: 1px solid rgba(155, 89, 182, 0.3);
    border-radius: 20px;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
}

.chat-input input:focus {
    border-color: var(--accent-purple);
}

.send-btn {
    width: 40px;
    height: 40px;
    background: var(--accent-purple);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    background: #7d3c98;
    transform: scale(1.1);
}

/* Video Call */
.video-call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    z-index: 300;
    display: flex;
    flex-direction: column;
}

.video-main {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remote-video {
    width: 100%;
    height: 100%;
    position: relative;
}

.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
}

.large-avatar {
    font-size: 8rem;
    margin-bottom: 16px;
}

.video-placeholder p {
    font-size: 1.5rem;
    font-weight: 600;
}

.call-info {
    position: absolute;
    top: 24px;
    left: 24px;
    display: flex;
    gap: 16px;
}

.call-timer {
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
}

.connection-quality {
    padding: 8px 16px;
    background: rgba(0, 212, 255, 0.2);
    color: var(--accent-cyan);
    border-radius: 8px;
    font-size: 0.9rem;
}

.self-video {
    position: absolute;
    bottom: 120px;
    right: 24px;
    width: 150px;
    height: 200px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 2px solid var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    cursor: move;
}

.video-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    padding: 16px 32px;
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 40px;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.control-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.control-btn.active {
    background: rgba(255, 68, 68, 0.3);
}

.control-btn.end-call {
    background: var(--status-red);
}

.control-btn.end-call:hover {
    background: #cc0000;
}

.webrtc-note {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Profile Panel */
.profile-panel {
    position: fixed;
    top: 70px;
    right: 0;
    width: 350px;
    height: calc(100vh - 70px);
    background: rgba(26, 26, 46, 0.98);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(155, 89, 182, 0.2);
    padding: 24px;
    z-index: 200;
    overflow-y: auto;
}

.profile-panel h2 {
    text-align: center;
    margin-bottom: 24px;
}

.avatar-selector {
    text-align: center;
    margin-bottom: 24px;
}

.current-avatar {
    width: 100px;
    height: 100px;
    margin: 0 auto 16px;
    background: var(--bg-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border: 3px solid var(--accent-purple);
    box-shadow: 0 0 30px rgba(155, 89, 182, 0.3);
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.avatar-option {
    width: 50px;
    height: 50px;
    background: var(--bg-primary);
    border: 2px solid transparent;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.avatar-option:hover {
    border-color: var(--accent-purple);
    transform: scale(1.1);
}

.avatar-option.selected {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid rgba(155, 89, 182, 0.3);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent-purple);
}

.save-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-purple), #7d3c98);
    border: none;
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn:hover {
    box-shadow: 0 0 30px rgba(155, 89, 182, 0.5);
    transform: translateY(-2px);
}

/* Status Bar */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(155, 89, 182, 0.2);
    z-index: 100;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.connection-status {
    color: var(--status-green);
}

/* Footer */
.app-footer {
    position: fixed;
    bottom: 40px;
    left: 20px;
    z-index: 100;
}

.app-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.3s ease;
}

.app-footer a:hover {
    color: var(--accent-pink);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header-bar {
        padding: 0 16px;
    }
    
    .header-center {
        display: none;
    }
    
    .action-panel,
    .profile-panel {
        width: 100%;
        top: 70px;
    }
    
    .chat-panel {
        width: calc(100% - 40px);
        right: 20px;
        bottom: 60px;
        height: 400px;
    }
    
    .self-video {
        width: 100px;
        height: 140px;
        bottom: 140px;
        right: 16px;
    }
    
    .video-controls {
        padding: 12px 20px;
        gap: 12px;
    }
    
    .control-btn {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }
    
    .status-bar {
        gap: 16px;
        font-size: 0.75rem;
    }
}

/* Vignette effect */
.map-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(10, 10, 15, 0.6) 100%);
    z-index: 2;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-purple);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7d3c98;
}