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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Auth Screen Styles */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.auth-container h1 {
    text-align: center;
    color: #333;
    margin-bottom: 0.5rem;
}

.auth-container p {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
}

.auth-tabs {
    display: flex;
    margin-bottom: 1rem;
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-tab.active {
    background: #667eea;
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form.hidden {
    display: none;
}

.auth-form input,
.auth-form textarea,
.auth-form select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.auth-form button {
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.auth-form button:hover {
    background: #5a67d8;
}

/* Address Autocomplete */
.address-autocomplete {
    position: relative;
}

.address-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.address-suggestion {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s ease;
    font-size: 0.9rem;
}

.address-suggestion:hover {
    background: #f0f0f0;
}

.address-suggestion:last-child {
    border-bottom: none;
}

.address-suggestion.selected {
    background: #667eea;
    color: white;
}

.address-suggestion .address-line1 {
    font-weight: bold;
    color: #333;
}

.address-suggestion .address-line2 {
    color: #666;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.address-suggestion:hover .address-line1,
.address-suggestion.selected .address-line1 {
    color: white;
}

.address-suggestion:hover .address-line2,
.address-suggestion.selected .address-line2 {
    color: rgba(255,255,255,0.8);
}

/* Main Screen Styles */
.navbar {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    color: #333;
}

.nav-buttons {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #667eea;
    background: transparent;
    color: #667eea;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.nav-btn:hover {
    background: #667eea;
    color: white;
}

.nav-btn.active {
    background: #667eea;
    color: white;
}

.count {
    background: #e53e3e;
    color: white;
    border-radius: 50%;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.main-content {
    padding: 2rem;
}

/* View Management */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Map View Styles */
.map-container {
    position: relative;
    height: calc(100vh - 200px);
    min-height: 500px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .map-container {
        height: calc(100vh - 150px);
        min-height: 300px;
        border-radius: 5px;
    }
}

.map {
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    position: relative;
}

.map-controls {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .map-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem;
        border-radius: 5px;
    }
}

.radius-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 200px;
}

@media (max-width: 768px) {
    .radius-control {
        min-width: auto;
        width: 100%;
    }
}

.radius-control label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #333;
}

.radius-control input[type="range"] {
    width: 100%;
    margin-bottom: 0.5rem;
}

.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.btn-primary:hover {
    background: #5a67d8;
}

.map-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .map-legend {
        justify-content: center;
        gap: 1.5rem;
    }
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.legend-color.alert {
    background: #e53e3e;
}

.legend-color.event {
    background: #38a169;
}

/* Map markers */
.map-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    transform: translate(-50%, -50%);
    z-index: 100;
}

.map-marker.alert {
    background: #e53e3e;
}

.map-marker.event {
    background: #38a169;
}

.map-marker.user {
    background: #667eea;
    width: 24px;
    height: 24px;
    border: 3px solid white;
}

.radius-circle {
    position: absolute;
    border: 2px solid #667eea;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Dashboard Styles */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.action-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.alert-btn {
    background: linear-gradient(45deg, #e53e3e, #fc8181);
    color: white;
}

.alert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 62, 62, 0.3);
}

.event-btn {
    background: linear-gradient(45deg, #38a169, #68d391);
    color: white;
}

.event-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 161, 105, 0.3);
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.card h3 {
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

/* Alert and Event Items */
.alert-item,
.event-item,
.notification-item {
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
    background: #f7fafc;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.alert-item:hover,
.event-item:hover,
.notification-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.alert-item {
    border-left-color: #e53e3e;
}

.event-item {
    border-left-color: #38a169;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.item-title {
    font-weight: bold;
    color: #333;
}

.item-time {
    color: #666;
    font-size: 0.9rem;
}

.item-description {
    color: #555;
    margin-bottom: 0.5rem;
}

.item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.intensity-badge {
    background: #e53e3e;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
}

.type-badge {
    background: #667eea;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
}

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

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    margin: auto;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

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

.close:hover {
    color: #000;
}

.modal h2 {
    margin-bottom: 1.5rem;
    color: #333;
}

.modal form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal input,
.modal textarea,
.modal select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.modal textarea {
    min-height: 100px;
    resize: vertical;
}

.modal button {
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.modal button:hover {
    background: #5a67d8;
}

/* Range Input Styling */
input[type="range"] {
    width: 100%;
    margin-top: 0.5rem;
}

/* Notification Styles */
.notification-item.unread {
    background: #e6fffa;
    border-left-color: #38a169;
}

.notification-item.read {
    background: #f7fafc;
    opacity: 0.8;
}

/* Empty State */
.empty-state {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .action-buttons {
        flex-direction: column;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-buttons {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .nav-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .modal-content {
        width: 95%;
        padding: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    /* Map view mobile improvements */
    #map-view {
        padding: 0;
    }
    
    .map-container {
        border-radius: 0;
        margin: 0 -1rem;
        width: calc(100% + 2rem);
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

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

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