@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;400;600&display=swap');

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

:root {
    --primary: #d4af37;
    --secondary: #ffd700;
    --danger: #ff6b35;
    --warning: #ffb627;
    --dark: #000000;
    --dark-light: #0a0a0a;
    --dark-lighter: #1a1a1a;
    --text: #f5f5dc;
    --text-dim: #9d8b6c;
}

body {
    font-family: 'Exo 2', sans-serif;
    background: var(--dark);
    color: var(--text);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 215, 0, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--dark);
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(212, 175, 55, 0.5);
    z-index: 3000;
    display: none;
    align-items: center;
    gap: 15px;
    animation: slideUp 0.5s ease-out;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
}

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

.install-prompt.show {
    display: flex;
}

.install-btn {
    background: var(--dark);
    color: var(--primary);
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    transition: all 0.3s ease;
}

.install-btn:hover {
    transform: scale(1.05);
}

.close-install {
    background: none;
    border: none;
    color: var(--dark);
    font-size: 1.5em;
    cursor: pointer;
    padding: 0 10px;
}

.header {
    background: linear-gradient(135deg, var(--dark-light), var(--dark-lighter));
    border: 2px solid var(--primary);
    border-radius: 20px;
    padding: 25px 30px;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.3);
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 200px;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(212, 175, 55, 0.15), transparent);
    transform: rotate(15deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%) rotate(15deg); }
    50% { transform: translateX(100%) rotate(15deg); }
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 2;
}

.logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

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

.logo svg {
    width: 45px;
    height: 45px;
}

h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5em;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.title-mobile {
    display: none;
}

.title-full {
    display: inline;
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.95em;
    margin-top: 5px;
}

/* Profile Section */
.profile-section {
    position: absolute;
    top: 25px;
    right: 30px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 15px;
}

.profile-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--dark-lighter);
    border: 3px solid var(--primary);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.profile-photo:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
}

.emergency-controls {
    display: flex;
    gap: 10px;
}

.emergency-btn {
    background: var(--danger);
    border: 2px solid var(--danger);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    transition: all 0.3s ease;
    font-size: 1.2em;
}

.emergency-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
}

.emergency-btn.active {
    animation: emergencyBlink 0.5s infinite;
}

@keyframes emergencyBlink {
    0%, 100% { background: var(--danger); }
    50% { background: var(--warning); }
}

.status-bar {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.status-item {
    background: var(--dark-light);
    border: 1px solid var(--dark-lighter);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 180px;
    transition: all 0.3s ease;
}

.status-item:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.25);
}

.status-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: blink 2s infinite;
}

.status-icon.online { background: var(--primary); }
.status-icon.offline { background: var(--danger); }

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

.main-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    animation: fadeIn 0.8s ease-out 0.4s both;
}

.map-container {
    background: var(--dark-light);
    border: 2px solid var(--dark-lighter);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    height: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

#map {
    width: 100%;
    height: 100%;
    filter: brightness(0.9) contrast(1.1);
}

.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.map-btn {
    background: rgba(10, 10, 10, 0.95);
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.map-btn:hover {
    background: var(--primary);
    color: var(--dark);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-container {
    background: var(--dark-light);
    border: 2px solid var(--dark-lighter);
    border-radius: 20px;
    padding: 20px;
    height: 350px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.chat-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2em;
    color: var(--primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--dark-lighter);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bluetooth-btn {
    background: var(--secondary);
    border: none;
    color: var(--dark);
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.8em;
    transition: all 0.3s ease;
}

.bluetooth-btn:hover {
    transform: scale(1.05);
}

.bluetooth-btn.connected {
    background: var(--primary);
    animation: pulse 2s infinite;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 10px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--dark-lighter);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.message {
    background: var(--dark-lighter);
    padding: 12px 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    border-left: 3px solid var(--secondary);
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.message.own {
    border-left-color: var(--primary);
    background: rgba(212, 175, 55, 0.1);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.message-avatar {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.message-user {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9em;
}

.message-time {
    font-size: 0.75em;
    color: var(--text-dim);
    margin-left: auto;
}

.chat-input-container {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background: var(--dark-lighter);
    border: 2px solid var(--dark-lighter);
    color: var(--text);
    padding: 12px 15px;
    border-radius: 10px;
    font-family: 'Exo 2', sans-serif;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: var(--dark);
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.5);
}

.emergency-panel {
    background: var(--dark-light);
    border: 2px solid var(--danger);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(255, 107, 53, 0.2);
}

.emergency-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2em;
    color: var(--danger);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.emergency-list {
    max-height: 200px;
    overflow-y: auto;
}

.emergency-item {
    background: var(--dark-lighter);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 3px solid var(--danger);
    cursor: pointer;
    transition: all 0.3s ease;
}

.emergency-item:hover {
    transform: translateX(5px);
    background: rgba(255, 107, 53, 0.1);
    border-left-width: 5px;
}

.emergency-name {
    font-weight: 600;
    color: var(--danger);
    margin-bottom: 5px;
}

.emergency-type {
    font-size: 0.85em;
    color: var(--text-dim);
}

.emergency-distance {
    font-size: 0.8em;
    color: var(--warning);
    margin-top: 5px;
}

.add-point-btn {
    background: linear-gradient(135deg, var(--danger), var(--warning));
    border: none;
    color: white;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    width: 100%;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.add-point-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(255, 107, 53, 0.4);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--dark-light);
    border: 2px solid var(--primary);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    animation: scaleUp 0.3s ease-out;
}

@keyframes scaleUp {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5em;
    color: var(--primary);
    margin-bottom: 20px;
}

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

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

.form-group input,
.form-group select {
    width: 100%;
    background: var(--dark-lighter);
    border: 2px solid var(--dark-lighter);
    color: var(--text);
    padding: 12px;
    border-radius: 10px;
    font-family: 'Exo 2', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    transition: all 0.3s ease;
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--dark);
}

.modal-btn.secondary {
    background: var(--dark-lighter);
    color: var(--text);
    border: 2px solid var(--dark-lighter);
}

.modal-btn:hover {
    transform: scale(1.05);
}

input[type="file"] {
    display: none;
}

@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    .map-container {
        height: 400px;
    }
    .profile-section {
        position: static;
        margin-top: 15px;
        justify-content: center;
        flex-wrap: wrap;
    }
    .emergency-controls {
        order: 2;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
    .profile-photo {
        order: 1;
    }
}

@media (max-width: 768px) {
    .emergency-controls {
        gap: 8px;
    }
    .emergency-btn,
    .flashlight-btn,
    .help-btn {
        padding: 8px 12px;
        font-size: 1em;
    }
    .profile-photo {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .emergency-controls {
        gap: 5px;
        flex-wrap: wrap;
    }
    .emergency-btn,
    .flashlight-btn,
    .help-btn {
        padding: 6px 10px;
        font-size: 0.9em;
        flex: 1;
        min-width: 45%;
    }
    .profile-photo {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
    }
    .status-bar {
        flex-direction: column;
    }
    .status-item {
        min-width: 100%;
    }
    .logo-container {
        gap: 15px;
    }
    .logo {
        width: 50px;
        height: 50px;
    }
    .logo svg {
        width: 35px;
        height: 35px;
    }
    .subtitle {
        font-size: 0.75em;
    }
}

@media (max-width: 480px) {
    /* Switch to abbreviated title on small screens */
    .title-full {
        display: none;
    }
    .title-mobile {
        display: inline;
    }
    
    h1 {
        font-size: 1.8em;
        letter-spacing: 1px;
    }
    .logo-container {
        gap: 10px;
    }
    .logo {
        width: 45px;
        height: 45px;
    }
    .logo svg {
        width: 30px;
        height: 30px;
    }
    .subtitle {
        font-size: 0.7em;
    }
    .header {
        padding: 15px 15px;
    }
}