/* Custom CSS for Emergency Monitoring System */
/* Following Bootstrap dark theme guidelines */

/* Root variables for consistency with Bootstrap theme */
:root {
    --emergency-fire: #dc3545;
    --emergency-flood: #0dcaf0;
    --emergency-accident: #ffc107;
    --emergency-disaster: #6f42c1;
    --emergency-other: #6c757d;
    --emergency-success: #198754;
    --emergency-warning: #ffc107;
    --emergency-danger: #dc3545;
    --emergency-info: #0dcaf0;
}

/* Map specific styles */
.emergency-balloon {
    max-width: 300px;
    color: var(--bs-dark);
}

.emergency-balloon .badge {
    color: white;
    font-size: 0.75em;
}

#map {
    border-radius: var(--bs-border-radius);
    overflow: hidden;
}

/* Map controls overlay */
.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(33, 37, 41, 0.9);
    border-radius: var(--bs-border-radius);
    padding: 10px;
    backdrop-filter: blur(10px);
}

/* Article details panel */
.article-details {
    max-height: 500px;
    overflow-y: auto;
}

.article-details::-webkit-scrollbar {
    width: 6px;
}

.article-details::-webkit-scrollbar-track {
    background: var(--bs-gray-800);
    border-radius: 3px;
}

.article-details::-webkit-scrollbar-thumb {
    background: var(--bs-gray-600);
    border-radius: 3px;
}

.article-details::-webkit-scrollbar-thumb:hover {
    background: var(--bs-gray-500);
}

/* Chart containers */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 20px;
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--emergency-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(25, 135, 84, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(25, 135, 84, 0);
    }
}

/* Severity progress bars */
.severity-bar {
    height: 20px;
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    background: var(--bs-gray-700);
}

.severity-bar .progress-bar {
    transition: width 0.6s ease;
}

/* Category badges with consistent colors */
.badge-fire {
    background-color: var(--emergency-fire) !important;
}

.badge-flood {
    background-color: var(--emergency-flood) !important;
}

.badge-accident {
    background-color: var(--emergency-accident) !important;
    color: var(--bs-dark) !important;
}

.badge-disaster {
    background-color: var(--emergency-disaster) !important;
}

.badge-other {
    background-color: var(--emergency-other) !important;
}

/* Alert styling for AI insights */
.alert-ai {
    border-left: 4px solid var(--bs-info);
    background: rgba(13, 202, 240, 0.1);
    border: 1px solid rgba(13, 202, 240, 0.2);
}

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--bs-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* News article list items */
.list-group-item {
    border-color: var(--bs-gray-700) !important;
    background-color: transparent;
}

.list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Settings page enhancements */
.settings-section {
    margin-bottom: 2rem;
}

.keyword-tag {
    background: var(--bs-gray-700);
    border: 1px solid var(--bs-gray-600);
    border-radius: var(--bs-border-radius);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.keyword-tag:hover {
    background: var(--bs-gray-600);
    border-color: var(--bs-gray-500);
}

/* Form enhancements */
.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Modal dark theme adjustments */
.modal-content {
    background-color: var(--bs-gray-900);
    border: 1px solid var(--bs-gray-700);
}

.modal-header {
    border-bottom-color: var(--bs-gray-700);
}

.modal-footer {
    border-top-color: var(--bs-gray-700);
}

/* Table enhancements */
.table-dark {
    --bs-table-bg: transparent;
}

.table-dark th,
.table-dark td {
    border-color: var(--bs-gray-700);
}

/* Statistics cards */
.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--bs-border-radius-lg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Responsive chart containers */
@media (max-width: 768px) {
    .chart-container {
        height: 250px;
    }
    
    #map {
        height: 400px !important;
    }
    
    .article-details {
        max-height: 300px;
    }
}

/* Emergency level indicators */
.emergency-level-low {
    color: var(--emergency-success);
}

.emergency-level-medium {
    color: var(--emergency-warning);
}

.emergency-level-high {
    color: var(--emergency-danger);
}

.emergency-level-critical {
    color: #8b0000;
    font-weight: bold;
}

/* Custom scrollbars for better UX */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: var(--bs-gray-600) var(--bs-gray-800);
}

.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: var(--bs-gray-800);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--bs-gray-600);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--bs-gray-500);
}

/* Notification styles */
.notification-badge {
    position: relative;
}

.notification-badge::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--emergency-danger);
    border-radius: 50%;
    border: 2px solid var(--bs-dark);
}

/* Timeline styles for analytics */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 10px;
    height: 10px;
    background: var(--bs-primary);
    border-radius: 50%;
    border: 2px solid var(--bs-dark);
}

.timeline-item::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1.5rem;
    width: 2px;
    height: calc(100% - 1rem);
    background: var(--bs-gray-700);
}

.timeline-item:last-child::after {
    display: none;
}

/* Accessibility improvements */
.btn:focus,
.btn-close:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Print styles */
@media print {
    .navbar,
    .modal,
    .btn,
    .alert-dismissible .btn-close {
        display: none !important;
    }
    
    .container {
        max-width: none !important;
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.5s 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);
    }
}

/* Focus management for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--bs-light);
    }
    
    .badge {
        border: 1px solid var(--bs-light);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
