/* ======================================
   SAHELI • DELHI SAFETY MAP
====================================== */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:Inter, Arial, sans-serif;
}

body{
    background:#FFF7F8;
    overflow:hidden;
}

.app{
    height:100vh;
    position:relative;
}

#map{
    width:100%;
    height:100%;
    z-index:1;
}

/* ======================================
   SEARCH BAR
====================================== */

.searchBar{
    position:absolute;
    top:18px;
    left:16px;
    right:16px;
    display:flex;
    align-items:center;
    gap:10px;
    z-index:2000;
}

.searchWrap{
    position:relative;
    flex:1;
}

.searchBar input{
    width:100%;
    padding:15px 18px;
    border:none;
    border-radius:18px;
    background:rgba(255,255,255,.95);
    backdrop-filter:blur(18px);
    font-size:15px;
    box-shadow:0 8px 25px rgba(0,0,0,.08);
    outline:none;
}

.searchBar input:focus{
    box-shadow:0 0 0 3px rgba(225,29,72,.15);
}

#searchBtn{
    width:52px;
    height:52px;
    border:none;
    border-radius:16px;
    background:#FFFFFF;
    font-size:20px;
    cursor:pointer;
    box-shadow:0 8px 25px rgba(0,0,0,.08);
}

/* ======================================
   SEARCH DROPDOWN
====================================== */

.suggestions{
    position:absolute;
    top:58px;
    left:0;
    right:0;
    background:#FFFFFF;
    border-radius:18px;
    box-shadow:0 12px 35px rgba(0,0,0,.18);
    overflow:hidden;
    max-height:280px;
    overflow-y:auto;
    display:none;
    z-index:9999;
}

.suggestion{
    padding:14px 16px;
    cursor:pointer;
    border-bottom:1px solid #F1F5F9;
    transition:.2s;
}

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

.suggestion:hover{
    background:#FFF1F5;
}

.place{
    font-weight:600;
    font-size:14px;
    color:#111827;
}

.area{
    margin-top:3px;
    font-size:12px;
    color:#64748B;
}

/* ======================================
   FLOATING BUTTONS
====================================== */

.topButtons{
    position:absolute;
    top:82px;
    right:16px;
    display:flex;
    flex-direction:column;
    gap:10px;
    z-index:1500;
}

.topButtons button{
    width:48px;
    height:48px;
    border:none;
    border-radius:16px;
    background:#FFFFFF;
    font-size:20px;
    cursor:pointer;
    box-shadow:0 6px 20px rgba(0,0,0,.12);
}

/* ======================================
   SOS BUTTON
====================================== */

.sos{
    position:absolute;
    right:18px;
    bottom:calc(48vh + 16px);
    width:60px;
    height:60px;
    border:none;
    border-radius:50%;
    background:#E11D48;
    color:#FFFFFF;
    font-size:16px;
    font-weight:700;
    cursor:pointer;
    z-index:1500;
    box-shadow:0 10px 25px rgba(225,29,72,.40);
}

/* ======================================
   BOTTOM SHEET
====================================== */

.bottomSheet{
    position:absolute;
    left:0;
    right:0;
    bottom:0;
    background:#FFFFFF;
    border-radius:28px 28px 0 0;
    padding:18px;
    max-height:48vh;
    overflow-y:auto;
    z-index:1200;
    box-shadow:0 -10px 30px rgba(0,0,0,.12);
}

.handle{
    width:48px;
    height:5px;
    margin:0 auto 16px;
    background:#D1D5DB;
    border-radius:999px;
}

.titleRow{
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.titleRow h2{
    font-size:22px;
    color:#111827;
}

.titleRow p{
    margin-top:3px;
    color:#6B7280;
}

.badge{
    padding:6px 12px;
    border-radius:999px;
    background:#FCE7F3;
    color:#BE185D;
    font-size:13px;
    font-weight:600;
}

/* ======================================
   STATS
====================================== */

.stats{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    margin:20px 0;
    text-align:center;
}

.stats span{
    font-size:12px;
    color:#6B7280;
}

.stats h3{
    margin-top:6px;
    font-size:22px;
    color:#111827;
}

/* ======================================
   NEARBY
====================================== */

.nearby{
    display:flex;
    flex-direction:column;
    gap:12px;
    margin:18px 0;
    font-size:14px;
    color:#374151;
}

/* ======================================
   REPORT BUTTON
====================================== */

.report{
    width:100%;
    padding:15px;
    border:none;
    border-radius:16px;
    background:#E11D48;
    color:#FFFFFF;
    font-size:15px;
    font-weight:600;
    cursor:pointer;
}

/* OSM licence requires visible attribution */
.leaflet-control-attribution{font-size:10px}

/* ==============================
   REPORT MODAL
============================== */

.modal{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.35);
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:5000;
    backdrop-filter:blur(4px);
}

.hidden{
    display:none;
}

.modalCard{
    width:90%;
    max-width:360px;
    background:#fff;
    border-radius:22px;
    padding:22px;
    max-height:90vh;
    overflow-y:auto;
    display:flex;
    flex-direction:column;
    gap:14px;
}

.modalCard h3{
    color:#BE185D;
}

.modalCard select,
.modalCard input,
.modalCard textarea{
    width:100%;
    border:1px solid #E5E7EB;
    border-radius:12px;
    padding:12px;
    font-size:14px;
}

.modalButtons{
    display:flex;
    gap:10px;
}

.modalButtons button{
    flex:1;
    padding:12px;
    border:none;
    border-radius:12px;
    cursor:pointer;
}

#cancelReport{
    background:#F3F4F6;
}

#submitReport{
    background:#E11D48;
    color:#fff;
}

/* ===== FIXES / ADDITIONS ===== */
.nearby a{color:#BE185D;font-weight:600;text-decoration:none;margin-left:6px}
.toast{position:fixed;top:84px;left:50%;transform:translateX(-50%);max-width:90%;
  background:#111827;color:#fff;padding:10px 16px;border-radius:14px;font-size:13px;
  z-index:9000;opacity:0;pointer-events:none;transition:opacity .25s}
.toast.show{opacity:1}
.sosActions{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.sosActions a,.sosActions button{padding:12px;border:none;border-radius:12px;text-align:center;
  text-decoration:none;font-size:14px;font-weight:600;cursor:pointer;background:#F3F4F6;color:#111827}
.sosActions .danger{background:#E11D48;color:#fff}
#sosInfo{font-size:14px;color:#374151;line-height:1.5}
.modalCard .ghost{background:#FFF1F5;color:#BE185D;border:none;border-radius:12px;padding:10px;cursor:pointer;font-weight:600}

.fileLabel{display:block;text-align:center;cursor:pointer;padding:10px;border-radius:12px;font-size:14px}
.voiceRow{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.voiceRow .ghost{font-size:13px}
.preview{width:100%;max-height:160px;object-fit:cover;border-radius:12px}
#audioPreview{width:100%}
#recBtn.recording{background:#E11D48;color:#fff}

/* ===== NIGHT MODE + INCIDENT GLOW ===== */
.nightStat{padding:10px 12px;border-radius:12px;font-size:13px;font-weight:600;margin-bottom:12px;background:#F3F4F6;color:#374151}
.nightStat.lvl-ok{background:#DCFCE7;color:#166534}
.nightStat.lvl-warn{background:#FEF3C7;color:#92400E}
.nightStat.lvl-bad{background:#FEE2E2;color:#B91C1C}
body,.bottomSheet,.searchBar input,.topButtons button,#searchBtn,.modalCard{transition:background .4s,color .4s}
body.night{background:#0B1020}
body.night .bottomSheet{background:#111827;box-shadow:0 -10px 40px rgba(236,72,153,.18)}
body.night .titleRow h2,body.night .stats h3,body.night .place{color:#F9FAFB}
body.night .titleRow p,body.night .stats span,body.night .area,body.night .nearby{color:#9CA3AF}
body.night .nearby b{color:#F3F4F6}
body.night hr{border-color:#1F2937}
body.night .handle{background:#374151}
body.night .searchBar input{background:rgba(17,24,39,.92);color:#F9FAFB}
body.night .searchBar input::placeholder{color:#6B7280}
body.night #searchBtn,body.night .topButtons button{background:#1F2937;color:#fff}
body.night .suggestions{background:#111827}
body.night .suggestion{border-color:#1F2937}
body.night .suggestion:hover{background:#1F2937}
body.night .modalCard{background:#111827;color:#E5E7EB}
body.night .modalCard select,body.night .modalCard input,body.night .modalCard textarea{background:#1F2937;color:#F9FAFB;border-color:#374151}
body.night #cancelReport,body.night .sosActions a,body.night .sosActions button{background:#1F2937;color:#F9FAFB}
body.night .sosActions .danger{background:#E11D48}
body.night #sosInfo{color:#D1D5DB}
body.night .modalCard .ghost{background:#3B1029;color:#F9A8D4}
body.night .leaflet-popup-content-wrapper,body.night .leaflet-popup-tip{background:#1F2937;color:#F9FAFB}
body.night .leaflet-control-zoom a{background:#1F2937;color:#fff;border-color:#374151}
body.night .leaflet-control-attribution{background:rgba(17,24,39,.8);color:#9CA3AF}
body.night .leaflet-control-attribution a{color:#F9A8D4}
body.night .nightStat{background:#1F2937;color:#D1D5DB}
body.night .nightStat.lvl-ok{background:#052e1a;color:#86efac}
body.night .nightStat.lvl-warn{background:#3a2a05;color:#fcd34d}
body.night .nightStat.lvl-bad{background:#3b0a12;color:#fca5a5}

/* Night look for plain OpenStreetMap tiles (no API key needed) */
body.night.osmTiles .leaflet-tile-pane{filter:invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.55)}

.legal{margin-top:12px;font-size:11px;color:#6B7280;text-align:center}
.legal a{color:#BE185D}
body.night .legal{color:#9CA3AF}
/* Desktop: side card instead of a full-width bottom sheet */
@media (min-width:900px){
  .searchBar{right:auto;left:24px;width:440px}
  .bottomSheet{left:24px;right:auto;bottom:24px;width:400px;border-radius:24px;max-height:calc(100vh - 120px)}
  .handle{display:none}
  .sos{right:24px;bottom:24px}
  .topButtons{right:24px}
}

.regionNote{padding:10px 12px;border-radius:12px;font-size:12px;line-height:1.4;margin-bottom:12px;background:#EEF2FF;color:#3730A3}
body.night .regionNote{background:#1e1b4b;color:#c7d2fe}

#langBtn{width:52px;height:52px;border:none;border-radius:16px;background:#fff;font-size:16px;font-weight:700;color:#BE185D;cursor:pointer;box-shadow:0 8px 25px rgba(0,0,0,.08)}
body.night #langBtn{background:#1F2937;color:#F9A8D4}
.linkBtn{display:block;margin:10px auto 0;background:none;border:none;color:#BE185D;font-weight:600;font-size:13px;cursor:pointer}
.sosActions .openContacts{grid-column:span 2}
#saveContacts{background:#E11D48;color:#fff}
#cancelContacts{background:#F3F4F6}
body.night #cancelContacts{background:#1F2937;color:#F9FAFB}
