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

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
    max-width: 100%;
}

.alert-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 30px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    min-width: 0;
    max-width: 100%;
}

.alert-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Language selector: fits alert header (dark, same visual weight) */
.alert-header .language-select-wrap {
    flex-shrink: 0;
}
.alert-header .language-select {
    max-width: 140px;
    min-width: 100px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 10px;
}
.alert-header .language-select:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.35);
}
.alert-header .language-select:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.9);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}
.alert-header .language-select option {
    background: #1a1a2e;
    color: #fff;
}

/* In-browser Whisper (Arabic-biased STT); optional checkbox next to language */
.offline-stt-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
    max-width: min(100%, 280px);
    font-size: 12px;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.88);
    cursor: pointer;
    user-select: none;
}
.offline-stt-wrap input {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}
.offline-stt-wrap span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
}

.evidence-btn, .view-all-btn {
    padding: 10px 16px;
    min-height: 44px;
    background: rgba(102, 126, 234, 0.8);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.evidence-btn:hover, .view-all-btn:hover {
    background: rgba(102, 126, 234, 1);
}

.emergency-map-btn {
    background: rgba(229, 57, 53, 0.9);
    font-weight: 600;
}
.emergency-map-btn:hover {
    background: rgba(229, 57, 53, 1);
}

.view-all-btn {
    background: rgba(102, 126, 234, 0.6);
    font-size: 13px;
    padding: 10px 16px;
}

.notification-bell {
    position: relative;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    text-decoration: none;
    font-size: 24px;
    transition: all 0.3s;
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid #1a1a2e;
}

.profile-btn, .dashboard-btn {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    text-decoration: none;
    font-size: 24px;
    transition: all 0.3s;
}

.profile-btn:hover, .dashboard-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Audience Selector */
.audience-selector {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(26, 26, 46, 0.98);
    border-radius: 20px;
    padding: 30px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    max-width: 90%;
    width: 400px;
}

.audience-selector h3 {
    margin-bottom: 20px;
    text-align: center;
    font-size: 20px;
}

.audience-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.audience-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.audience-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.audience-btn .icon {
    font-size: 32px;
}

.audience-btn .label {
    font-weight: 600;
}

.cancel-audience-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

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

/* Alert Buttons */
.alert-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 40px;
}

.alert-btn {
    width: 100%;
    padding: 40px 30px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    position: relative;
    overflow: hidden;
}

.alert-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.alert-btn:hover::before {
    left: 100%;
}

.alert-btn:active {
    transform: scale(0.98);
}

.green-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.green-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    box-shadow: 0 12px 30px rgba(76, 175, 80, 0.4);
    transform: translateY(-3px);
}

.yellow-btn {
    background: linear-gradient(135deg, #FFC107 0%, #FFB300 100%);
    color: #1a1a2e;
}

.yellow-btn:hover {
    background: linear-gradient(135deg, #FFB300 0%, #FFA000 100%);
    box-shadow: 0 12px 30px rgba(255, 193, 7, 0.4);
    transform: translateY(-3px);
}

.red-btn {
    background: linear-gradient(135deg, #F44336 0%, #E53935 100%);
    color: white;
}

.red-btn:hover {
    background: linear-gradient(135deg, #E53935 0%, #D32F2F 100%);
    box-shadow: 0 12px 30px rgba(244, 67, 54, 0.5);
    transform: translateY(-3px);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 12px 30px rgba(244, 67, 54, 0.5); }
    50% { box-shadow: 0 12px 40px rgba(244, 67, 54, 0.8); }
}

.btn-icon {
    font-size: 64px;
    margin-bottom: 10px;
}

.btn-label {
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

/* Status Messages */
.status-message {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    animation: slideDown 0.3s ease;
}

.status-message.success {
    background: rgba(76, 175, 80, 0.2);
    border: 2px solid #4CAF50;
    color: #4CAF50;
}

.status-message.success a {
    color: #4CAF50;
    text-decoration: underline;
    font-weight: bold;
    margin-left: 5px;
}

.status-message.success a:hover {
    text-decoration: none;
    opacity: 0.8;
}

.status-message.error {
    background: rgba(244, 67, 54, 0.2);
    border: 2px solid #F44336;
    color: #F44336;
}

.status-message.warning {
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid #FFC107;
    color: #FFC107;
}

.status-message.info {
    background: rgba(33, 150, 243, 0.2);
    border: 2px solid #2196F3;
    color: #2196F3;
}

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

/* HTTPS Warning */
.https-warning {
    background: rgba(255, 193, 7, 0.95);
    border: 2px solid #FFC107;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

.warning-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.warning-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.warning-text {
    flex: 1;
}

.warning-text strong {
    display: block;
    margin-bottom: 5px;
    color: #856404;
    font-size: 1.1rem;
}

.warning-text p {
    margin: 0;
    color: #856404;
    font-size: 0.95rem;
    line-height: 1.4;
}

.close-warning {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #856404;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-warning:hover {
    background: rgba(133, 100, 4, 0.2);
}

/* Recording Controls with Send Button */
.recording-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 30px;
    background: rgba(26, 26, 46, 0.95);
    border: 2px solid #F44336;
    border-radius: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 30px rgba(244, 67, 54, 0.3);
    animation: slideDown 0.3s ease;
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
    flex: 1;
}

.recording-dot {
    width: 12px;
    height: 12px;
    background: #F44336;
    border-radius: 50%;
    animation: blink 1s infinite;
}

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

/* Send Alert Button */
.send-alert-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.send-alert-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.send-alert-btn:active {
    transform: scale(0.98);
}

.send-alert-btn .send-icon {
    font-size: 20px;
    animation: pulse-icon 1.5s infinite;
}

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

.send-alert-btn .send-text {
    font-weight: 700;
}

/* Playback Section */
.playback-section {
    background: rgba(26, 26, 46, 0.95);
    border: 2px solid #4CAF50;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 30px rgba(76, 175, 80, 0.3);
    animation: slideDown 0.3s ease;
}

.playback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.playback-header h3 {
    color: #4CAF50;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.close-playback-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    line-height: 1;
}

.close-playback-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.playback-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.playback-media {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.playback-media video,
.playback-media audio {
    width: 100%;
    display: block;
}

.playback-media img {
    width: 100%;
    height: auto;
    display: block;
}

.playback-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.playback-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playback-info-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.playback-info-value {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.playback-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.playback-action-btn {
    flex: 1;
    padding: 12px;
    background: rgba(102, 126, 234, 0.8);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.playback-action-btn:hover {
    background: rgba(102, 126, 234, 1);
    transform: translateY(-2px);
}

/* Livestream Controls */
.livestream-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(244, 67, 54, 0.2);
    border: 2px solid #F44336;
    border-radius: 15px;
    margin-bottom: 20px;
}

.livestream-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.status-dot {
    width: 12px;
    height: 12px;
    background: #F44336;
    border-radius: 50%;
    animation: blink 1s infinite;
}

.stop-stream-btn {
    padding: 10px 20px;
    background: #F44336;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.stop-stream-btn:hover {
    background: #E53935;
    transform: scale(1.05);
}

/* Recent Alerts */
.recent-alerts {
    margin-top: 40px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.recent-alerts h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: all 0.3s;
}

.alert-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.alert-type {
    font-size: 32px;
}

.alert-info {
    flex: 1;
}

.recent-alert-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(129, 140, 248, 0.35);
    border: 1px solid rgba(165, 180, 252, 0.5);
    color: #e0e7ff;
    margin-bottom: 6px;
}

.alert-message {
    font-weight: 600;
    margin-bottom: 5px;
}

.alert-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.guest-transcribe-btn {
    margin-top: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: rgba(15, 118, 110, 0.9);
    color: white;
    cursor: pointer;
}
.guest-transcribe-btn:hover:not(:disabled) {
    background: #0f766e;
}
.guest-transcribe-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.no-alerts {
    text-align: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.5);
}

.loading {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.6);
}

/* Responsive Design */
@media (max-width: 768px) {
    .alert-header h1 {
        font-size: 20px;
    }
    
    .alert-btn {
        padding: 30px 20px;
    }
    
    .btn-icon {
        font-size: 48px;
    }
    
    .btn-label {
        font-size: 20px;
    }
    
    .audience-selector {
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .alert-container {
        padding: 15px;
    }
    
    .alert-header {
        padding: 12px 15px;
    }
    
    .alert-header h1 {
        font-size: 18px;
    }
    
    .notification-bell, .profile-btn, .dashboard-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .alert-btn {
        padding: 25px 15px;
    }
    
    .btn-icon {
        font-size: 40px;
    }
    
    .btn-label {
        font-size: 18px;
    }
}

/* Rescuers Section */
.rescuers-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
}

.rescuers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.rescuers-header h3 {
    color: #4CAF50;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.close-rescuers-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    line-height: 1;
}

.close-rescuers-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.rescuers-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rescuers-map-container {
    width: 100%;
    margin-bottom: 15px;
}

.rescuers-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rescuer-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.rescuer-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.rescuer-card.active {
    border-color: #4CAF50;
}

.rescuer-card.inactive {
    opacity: 0.6;
}

.rescuer-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.rescuer-info h4 {
    margin: 0 0 5px 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.rescuer-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 10px;
}

.rescuer-distance {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.rescuer-details {
    margin: 10px 0;
}

.rescuer-certs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.cert-badge {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}

.rescuer-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.contact-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.contact-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-btn {
    background: rgba(76, 175, 80, 0.8);
}

.voice-btn:hover:not(:disabled) {
    background: rgba(76, 175, 80, 1);
    transform: scale(1.05);
}

.text-btn {
    background: rgba(102, 126, 234, 0.8);
}

.text-btn:hover:not(:disabled) {
    background: rgba(102, 126, 234, 1);
    transform: scale(1.05);
}

.zoom-btn {
    background: rgba(33, 150, 243, 0.8);
}

.zoom-btn:hover:not(:disabled) {
    background: rgba(33, 150, 243, 1);
    transform: scale(1.05);
}

.no-rescuers {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.no-rescuers p {
    margin: 10px 0;
}
