/* ============================================
   SALAMA WATCH — Style PWA
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, sans-serif;
}

:root {
    --navy: #1A1A8C;
    --gold: #C9A84C;
    --red: #C62828;
    --orange: #E65100;
    --green: #2E7D32;
    --blue: #1565C0;
    --white: #FFFFFF;
    --light-gray: #F5F5F5;
    --dark-gray: #333333;
}

body {
    background: var(--light-gray);
    color: var(--dark-gray);
    min-height: 100vh;
    padding-bottom: 80px;
}

/* ── HEADER ─────────────────────────────── */
.header {
    background: var(--navy);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
}

.header-info h1 {
    color: var(--white);
    font-size: 18px;
    font-weight: 700;
}

.tagline {
    color: var(--gold);
    font-size: 11px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--green);
    margin-left: auto;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* ── NAVIGATION ─────────────────────────── */
.nav-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--navy);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.3);
}

.nav-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    position: relative;
    transition: all 0.2s;
}

.nav-btn.active {
    color: var(--gold);
}

.nav-icon {
    font-size: 20px;
}

.panic-btn {
    background: var(--red) !important;
    color: white !important;
    border-radius: 50% !important;
    width: 56px;
    height: 56px;
    margin-top: -20px;
    box-shadow: 0 4px 12px rgba(198,40,40,0.5);
    font-size: 9px !important;
}

.badge {
    position: absolute;
    top: 0;
    right: 4px;
    background: var(--red);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── MAIN CONTENT ───────────────────────── */
.main-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

.page { display: none; }
.page.active { display: block; }
.hidden { display: none !important; }

/* ── WELCOME BANNER ─────────────────────── */
.welcome-banner {
    background: linear-gradient(135deg, var(--navy), #2A2A9C);
    color: white;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 16px;
}

.welcome-banner h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.welcome-banner p {
    font-size: 13px;
    opacity: 0.8;
}

/* ── KPI GRID ───────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid transparent;
}

.kpi-green { border-left-color: var(--green); }
.kpi-blue { border-left-color: var(--blue); }
.kpi-orange { border-left-color: var(--orange); }
.kpi-navy { border-left-color: var(--navy); }

.kpi-icon { font-size: 24px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--navy); }
.kpi-label { font-size: 11px; color: #777; text-align: center; }

/* ── SECTION CARD ───────────────────────── */
.section-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.section-card h3 {
    font-size: 15px;
    color: var(--navy);
    margin-bottom: 8px;
}

.section-desc {
    font-size: 12px;
    color: #777;
    margin-bottom: 12px;
}

/* ── MODE EVENEMENT ─────────────────────── */
.evenement-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.select-input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
}

.btn-evenement {
    background: var(--navy);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
}

.btn-evenement.active {
    background: var(--orange);
}

.evenement-actif {
    background: var(--orange);
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

/* ── ALERTES LIST ───────────────────────── */
.alertes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alerte-item {
    background: white;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid transparent;
}

.alerte-n1 { border-left-color: var(--blue); }
.alerte-n2 { border-left-color: var(--orange); }
.alerte-n3 { border-left-color: var(--red); }

.alerte-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.alerte-niveau {
    font-weight: 700;
    font-size: 13px;
}

.alerte-heure {
    font-size: 11px;
    color: #777;
}

.alerte-desc {
    font-size: 13px;
    color: #555;
}

.no-alerte {
    text-align: center;
    color: #aaa;
    padding: 40px 0;
    font-size: 14px;
}

/* ── CAMERAS ────────────────────────────── */
.camera-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.camera-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.camera-nom { font-weight: 600; font-size: 15px; }

.camera-status.online { color: var(--green); font-size: 12px; }
.camera-status.offline { color: var(--red); font-size: 12px; }

.camera-details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #777;
    margin-bottom: 10px;
}

.btn-live {
    background: var(--navy);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
}

/* ── PROFIL ─────────────────────────────── */
.profil-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.profil-avatar {
    font-size: 48px;
    margin-bottom: 8px;
}

.profil-card h3 { font-size: 18px; color: var(--navy); }
.profil-card p { font-size: 13px; color: #777; margin-top: 4px; }

.formule-badge {
    display: inline-block;
    background: var(--navy);
    color: var(--gold) !important;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px !important;
    margin-top: 8px !important;
}

.parametre-ligne {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.input-field {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 10px;
}

.btn-save {
    background: var(--green);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    width: 100%;
    font-size: 14px;
    cursor: pointer;
}

/* ── PAGE HEADER ────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.page-header h2 { font-size: 18px; color: var(--navy); }

.btn-clear {
    background: none;
    border: 1px solid var(--red);
    color: var(--red);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
}

/* ── MODALS ─────────────────────────────── */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px;
    text-align: center;
    color: white;
}

.modal-header.orange { background: var(--orange); }
.modal-header.red { background: var(--red); }

.modal-header h2 { font-size: 20px; }

.modal-body {
    padding: 20px;
    text-align: center;
}

.alerte-img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
    max-height: 200px;
    object-fit: cover;
}

.alerte-meta { font-size: 12px; color: #777; margin-top: 4px; }

.timer-bar {
    background: #eee;
    border-radius: 4px;
    height: 8px;
    margin: 12px 0 4px;
    overflow: hidden;
}

.timer-progress {
    height: 100%;
    background: var(--orange);
    border-radius: 4px;
    width: 100%;
    transition: width 1s linear;
}

.timer-text { font-size: 12px; color: #777; }

.modal-actions {
    display: flex;
    gap: 8px;
    padding: 16px;
}

.btn-non {
    flex: 1;
    background: #eee;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    color: var(--red);
    font-weight: 600;
}

.btn-oui {
    flex: 1;
    background: var(--green);
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    color: white;
    font-weight: 600;
}

.btn-urgence {
    flex: 1;
    background: var(--red);
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    color: white;
    font-weight: 600;
}

.panic-info {
    text-align: left;
    padding: 12px;
    background: var(--light-gray);
    border-radius: 8px;
    margin: 12px 0;
    font-size: 13px;
    list-style: none;
}

.panic-info li { padding: 4px 0; }

.panic-warning {
    color: var(--red);
    font-weight: 600;
    font-size: 13px;
}

.btn-panic-confirm {
    flex: 2;
    background: var(--red);
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    color: white;
    font-weight: 700;
}

.sirene-animation {
    font-size: 60px;
    animation: sireneFlash 0.5s infinite;
}

@keyframes sireneFlash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.sirene-duree {
    font-size: 20px;
    font-weight: 700;
    color: var(--red);
    margin-top: 8px;
}

.btn-arreter-sirene {
    width: 100%;
    background: var(--green);
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    color: white;
    font-weight: 700;
}