/* ═══════════════════════════════════════════════
   Bacheando - Mapa Ciudadano de Baches del Paraguay
   Grupo SAT SRL - 2026
   ═══════════════════════════════════════════════ */

:root {
    --naranja: #f97316;
    --rojo: #ef4444;
    --verde: #22c55e;
    --amarillo: #f59e0b;
    --azul: #3b82f6;
    --morado: #6366f1;
    --oscuro: #0a0f1a;
    --oscuro2: #0d1b2a;
    --gris-oscuro: #0f172a;
    --gris: #1e293b;
    --gris-borde: #334155;
    --texto: #e2e8f0;
    --texto-sec: #94a3b8;
    --texto-mut: #64748b;
    --texto-dim: #475569;
    --font-display: 'Oswald', sans-serif;
    --font-body: 'Nunito', sans-serif;
    --nav-height: 60px;
    --header-height: 56px;
}

/* ─── Reset & Base ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0; padding: 0;
    font-family: var(--font-body);
    background: var(--oscuro);
    color: var(--texto);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}
a { color: var(--naranja); text-decoration: none; }
a:hover { color: #fb923c; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gris-borde); border-radius: 3px; }

/* ─── Header ─────────────────────────────────── */
.app-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--header-height);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
    background: var(--oscuro2);
    border-bottom: 1px solid var(--gris);
}
.logo-link {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: white;
}
.logo-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--rojo), var(--naranja));
    font-size: 20px;
}
.logo-text {
    font-family: var(--font-display);
    font-weight: 800; font-size: 1.25rem;
    letter-spacing: -0.5px;
}
.logo-badge {
    font-size: 0.6rem; background: var(--gris);
    color: var(--texto-mut); padding: 1px 6px;
    border-radius: 4px; letter-spacing: 2px;
    font-weight: 700; align-self: flex-start; margin-top: 2px;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.points-badge {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 12px; background: var(--gris);
    border-radius: 20px; font-size: 0.8rem;
    font-weight: 700; color: white; text-decoration: none;
}
.points-badge i { color: var(--naranja); }
.user-menu-wrapper { position: relative; }
.user-avatar-btn {
    width: 34px; height: 34px; border-radius: 50%;
    border: 2px solid var(--gris-borde); background: linear-gradient(135deg, var(--azul), var(--morado));
    cursor: pointer; overflow: hidden; padding: 0;
    display: flex; align-items: center; justify-content: center;
}
.avatar-img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initials { color: white; font-size: 0.75rem; font-weight: 700; }
.user-dropdown {
    display: none; position: absolute; right: 0; top: 44px;
    background: var(--gris); border: 1px solid var(--gris-borde);
    border-radius: 12px; min-width: 220px; overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.user-dropdown.show { display: block; }
.dropdown-header { padding: 14px 16px; border-bottom: 1px solid var(--gris-borde); }
.dropdown-header strong { display: block; font-size: 0.9rem; }
.dropdown-header small { color: var(--texto-mut); font-size: 0.75rem; }
.user-dropdown .dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; color: var(--texto-sec); font-size: 0.85rem;
    transition: background 0.15s;
}
.user-dropdown .dropdown-item:hover { background: var(--gris-oscuro); color: white; }
.user-dropdown .dropdown-item i { width: 18px; text-align: center; }
.user-dropdown hr { border-color: var(--gris-borde); margin: 0; }
.btn-login {
    display: flex; align-items: center; padding: 8px 16px;
    background: var(--gris); border-radius: 10px; color: white;
    font-size: 0.85rem; font-weight: 600; border: 1px solid var(--gris-borde);
    transition: background 0.2s;
}
.btn-login:hover { background: var(--gris-borde); color: white; }

/* ─── Main Content ───────────────────────────── */
.app-main {
    margin-top: var(--header-height);
    margin-bottom: var(--nav-height);
    min-height: calc(100vh - var(--header-height) - var(--nav-height));
}
.index-page { margin-bottom: var(--nav-height); }

/* ─── Bottom Nav ─────────────────────────────── */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-height);
    display: flex; justify-content: space-around; align-items: center;
    background: var(--oscuro2);
    border-top: 1px solid var(--gris);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--texto-dim); font-size: 0.65rem; font-weight: 600;
    text-decoration: none; padding: 6px 12px;
    transition: color 0.2s;
}
.nav-item i { font-size: 1.15rem; }
.nav-item.active { color: var(--naranja); }
.nav-item:hover { color: var(--naranja); }

/* ─── Map Page ───────────────────────────────── */
#map-container {
    width: 100%; height: calc(100vh - var(--header-height) - var(--nav-height));
    position: relative;
}
#map { width: 100%; height: 100%; }
.map-controls {
    position: absolute; bottom: 20px; right: 16px; z-index: 50;
    display: flex; flex-direction: column; gap: 10px;
}
.map-btn {
    width: 48px; height: 48px; border-radius: 14px;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; transition: transform 0.15s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.map-btn:hover { transform: scale(1.08); }
.map-btn-report {
    width: 56px; height: 56px; border-radius: 16px;
    background: linear-gradient(135deg, var(--rojo), var(--naranja));
    color: white; font-size: 1.5rem;
}
.map-btn-location {
    background: var(--gris); color: var(--azul);
    border: 1px solid var(--gris-borde);
}
.map-btn-filter {
    background: var(--gris); color: var(--texto-sec);
    border: 1px solid var(--gris-borde);
}

/* ─── Bache Info Window ──────────────────────── */
.bache-info {
    max-width: 280px; font-family: var(--font-body); color: #333;
}
.bache-info h6 { font-weight: 700; margin-bottom: 6px; }
.bache-info .badge-severity {
    display: inline-block; padding: 2px 8px; border-radius: 6px;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px;
}
.bache-info .badge-leve { background: #fef3c7; color: #92400e; }
.bache-info .badge-moderado { background: #ffedd5; color: #9a3412; }
.bache-info .badge-grave { background: #fee2e2; color: #991b1b; }
.bache-info img { max-width: 100%; border-radius: 8px; margin-top: 8px; }

/* ─── Report Modal ───────────────────────────── */
.modal-bachepy .modal-content {
    background: var(--gris); border: 1px solid var(--gris-borde);
    border-radius: 16px; color: var(--texto);
}
.modal-bachepy .modal-header { border-bottom-color: var(--gris-borde); }
.modal-bachepy .modal-footer { border-top-color: var(--gris-borde); }
.modal-bachepy .btn-close { filter: invert(1); }

.severity-option {
    display: flex; align-items: center; gap: 12px;
    padding: 14px; border-radius: 12px; border: 2px solid var(--gris-borde);
    background: var(--gris-oscuro); cursor: pointer; transition: all 0.2s;
    margin-bottom: 8px;
}
.severity-option:hover { border-color: var(--texto-dim); }
.severity-option.selected { border-color: var(--naranja); background: rgba(249,115,22,0.08); }
.severity-option .sev-emoji { font-size: 1.8rem; }
.severity-option .sev-label { font-weight: 700; }
.severity-option .sev-desc { font-size: 0.8rem; color: var(--texto-mut); }

.photo-area {
    border: 2px dashed var(--gris-borde); border-radius: 12px;
    padding: 20px; text-align: center; cursor: pointer;
    transition: border-color 0.2s; color: var(--texto-sec);
}
.photo-area:hover { border-color: var(--naranja); }
.photo-preview {
    position: relative; border-radius: 12px; overflow: hidden;
}
.photo-preview img { width: 100%; border-radius: 12px; }
.photo-preview .remove-photo {
    position: absolute; top: 8px; right: 8px;
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(0,0,0,0.6); border: none; color: white;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ─── Ranking Page ───────────────────────────── */
.ranking-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px; border-radius: 12px; margin-bottom: 8px;
    background: var(--gris-oscuro); border: 1px solid var(--gris);
    transition: background 0.15s;
}
.ranking-card:hover { background: var(--gris); }
.ranking-card.top-1 { background: rgba(245,151,0,0.08); border-color: rgba(245,151,0,0.25); }
.ranking-card.top-2 { background: rgba(148,163,184,0.06); border-color: rgba(148,163,184,0.2); }
.ranking-card.top-3 { background: rgba(205,127,50,0.06); border-color: rgba(205,127,50,0.2); }
.rank-number {
    width: 32px; text-align: center; font-size: 1.1rem;
    font-weight: 900; color: var(--texto-dim);
}
.rank-avatar {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700; overflow: hidden;
    background: var(--gris);
}
.rank-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rank-info { flex: 1; }
.rank-name { font-weight: 600; font-size: 0.9rem; }
.rank-stats { font-size: 0.75rem; color: var(--texto-mut); margin-top: 2px; }
.rank-points { text-align: right; }
.rank-points-num { font-size: 1.1rem; font-weight: 800; color: var(--naranja); }
.rank-points-label { font-size: 0.6rem; color: var(--texto-mut); text-transform: uppercase; letter-spacing: 1px; }

/* ─── Profile Page ───────────────────────────── */
.profile-card {
    padding: 28px; border-radius: 16px; text-align: center;
    background: linear-gradient(135deg, var(--gris-oscuro), var(--gris));
    border: 1px solid var(--gris-borde); margin-bottom: 20px;
}
.profile-avatar {
    width: 80px; height: 80px; border-radius: 20px;
    margin: 0 auto 14px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--azul), var(--morado));
    font-size: 1.8rem; font-weight: 800;
    box-shadow: 0 8px 24px rgba(59,130,246,0.25);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-stats {
    display: flex; justify-content: center; gap: 28px;
    margin-top: 20px;
}
.stat-item { text-align: center; }
.stat-num { font-size: 1.5rem; font-weight: 900; }
.stat-label {
    font-size: 0.65rem; color: var(--texto-mut);
    text-transform: uppercase; letter-spacing: 1px; margin-top: 2px;
}
.achievement-card {
    padding: 14px; border-radius: 12px;
    background: var(--gris-oscuro); border: 1px solid var(--gris);
    position: relative;
}
.achievement-card.locked { opacity: 0.45; }
.achievement-icon { font-size: 1.8rem; margin-bottom: 6px; }
.achievement-name { font-weight: 700; font-size: 0.85rem; }
.achievement-desc { font-size: 0.75rem; color: var(--texto-mut); margin-top: 2px; }
.achievement-check {
    position: absolute; top: 8px; right: 8px;
    color: var(--verde); font-size: 0.9rem;
}

/* ─── Conductor Mode ─────────────────────────── */
.conductor-page .app-main { margin-bottom: 0; }
.conductor-page .bottom-nav { display: none; }
.conductor-page .app-header { display: none; }
.conductor-page .app-main { margin-top: 0; }
.conductor-fullscreen {
    height: 100vh; display: flex; flex-direction: column;
    background: #070c15;
}
.conductor-map { flex: 1; position: relative; }
.conductor-counter {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    background: rgba(15,23,42,0.9); border-radius: 20px;
    padding: 8px 22px; display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--gris);
}
.conductor-counter .count { font-size: 1.5rem; font-weight: 900; color: var(--naranja); }
.conductor-controls {
    padding: 16px 24px 28px;
    background: #0a1020;
    display: flex; justify-content: space-around; align-items: center;
}
.voice-btn {
    width: 56px; height: 56px; border-radius: 50%;
    border: 2px solid var(--gris-borde); background: var(--gris);
    color: var(--texto-mut); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; transition: all 0.2s;
}
.voice-btn.active { border-color: var(--verde); color: var(--verde); background: rgba(34,197,94,0.1); }
.mark-btn {
    width: 80px; height: 80px; border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, var(--rojo), #dc2626);
    border: 4px solid rgba(239,68,68,0.35); color: white;
    cursor: pointer; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    font-size: 1.5rem; box-shadow: 0 0 40px rgba(239,68,68,0.2);
    transition: transform 0.1s;
}
.mark-btn:active { transform: scale(0.92); }
.stop-btn {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--gris); border: 2px solid var(--gris-borde);
    color: var(--rojo); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* ─── Modals & Alerts ────────────────────────── */
.toast-bachepy {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 9999; padding: 12px 24px; border-radius: 12px;
    font-weight: 600; font-size: 0.9rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: slideDown 0.3s ease;
}
.toast-success { background: var(--verde); color: white; }
.toast-warning { background: var(--amarillo); color: #1a1a1a; }
.toast-error { background: var(--rojo); color: white; }

.flash-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: radial-gradient(circle at center, rgba(34,197,94,0.25), transparent 70%);
    animation: flash 0.6s ease-out forwards;
    pointer-events: none;
}

/* ─── Section Headers ────────────────────────── */
.section-title {
    font-size: 0.8rem; font-weight: 700; color: var(--texto-sec);
    text-transform: uppercase; letter-spacing: 2px;
    margin-bottom: 14px;
}

/* ─── Cards ──────────────────────────────────── */
.card-dark {
    background: var(--gris-oscuro); border: 1px solid var(--gris);
    border-radius: 14px; padding: 16px;
}

/* ─── Buttons ────────────────────────────────── */
.btn-bachepy {
    background: linear-gradient(135deg, var(--rojo), var(--naranja));
    border: none; color: white; font-weight: 700;
    padding: 12px 28px; border-radius: 10px;
    transition: opacity 0.2s, transform 0.2s;
}
.btn-bachepy:hover { opacity: 0.9; color: white; transform: translateY(-1px); }
.btn-bachepy:active { transform: translateY(0); }
.btn-dark-outline {
    background: none; border: 1px solid var(--gris-borde);
    color: var(--texto-sec); border-radius: 10px; padding: 10px 20px;
}
.btn-dark-outline:hover { background: var(--gris); color: white; }

/* ─── Sound Wave ─────────────────────────────── */
.sound-wave {
    display: flex; align-items: center; justify-content: center;
    gap: 2px; height: 40px; padding: 8px 16px;
    background: #0a1020; border-top: 1px solid #1a2535;
}
.sound-bar {
    width: 3px; border-radius: 2px;
    background: var(--gris-borde); height: 4px;
    transition: background 0.3s;
}
.sound-wave.active .sound-bar {
    background: var(--naranja);
    animation: wave 0.8s ease-in-out infinite alternate;
}
.sound-wave.triggered .sound-bar { background: var(--verde); }

/* ─── Animations ─────────────────────────────── */
@keyframes slideDown {
    from { transform: translate(-50%, -20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
@keyframes flash {
    0% { opacity: 1; } 100% { opacity: 0; }
}
@keyframes wave {
    from { height: 4px; }
    to { height: 28px; }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.3; }
}
@keyframes pop {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ─── Admin ──────────────────────────────────── */
.admin-sidebar {
    width: 240px; min-height: calc(100vh - var(--header-height));
    background: var(--oscuro2); border-right: 1px solid var(--gris);
    padding: 16px 0; position: fixed; left: 0; top: var(--header-height);
}
.admin-sidebar a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: var(--texto-sec); font-size: 0.9rem;
    transition: all 0.15s;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
    background: var(--gris); color: white;
}
.admin-sidebar a i { width: 20px; text-align: center; }
.admin-content {
    margin-left: 240px; padding: 24px;
}
.stat-card-admin {
    background: var(--gris); border-radius: 14px; padding: 20px;
    border: 1px solid var(--gris-borde);
}
.stat-card-admin .stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; margin-bottom: 10px;
}
.table-dark-custom {
    background: var(--gris-oscuro); border-radius: 12px; overflow: hidden;
}
.table-dark-custom th {
    background: var(--gris); color: var(--texto-sec);
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px;
    font-weight: 700; border-bottom: 1px solid var(--gris-borde);
}
.table-dark-custom td { border-bottom: 1px solid rgba(51,65,85,0.3); vertical-align: middle; }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
    .admin-sidebar { display: none; }
    .admin-content { margin-left: 0; }
    .profile-stats { gap: 16px; }
    .conductor-controls { padding: 12px 16px 20px; }
}
@media (min-width: 769px) {
    .bottom-nav { display: none; }
    .app-main { margin-bottom: 0; }
    #map-container { height: calc(100vh - var(--header-height)); }
}

/* ═══ NOTIFICATIONS ═══ */
.notif-badge { position:absolute;top:-2px;right:-2px;min-width:16px;height:16px;border-radius:8px;background:#ef4444;color:white;font-size:0.6rem;font-weight:800;display:flex;align-items:center;justify-content:center;padding:0 4px;line-height:1; }
.notif-panel { position:absolute;top:100%;right:0;width:320px;max-height:400px;background:var(--gris);border:1px solid var(--gris-borde);border-radius:12px;box-shadow:0 12px 40px rgba(0,0,0,0.4);z-index:200;overflow:hidden; }
.notif-header { display:flex;justify-content:space-between;align-items:center;padding:12px 14px;border-bottom:1px solid var(--gris-borde);font-size:0.85rem; }
.notif-list { max-height:340px;overflow-y:auto; }
.notif-item { display:flex;gap:10px;padding:12px 14px;border-bottom:1px solid rgba(51,65,85,0.3);cursor:pointer;transition:background 0.15s; }
.notif-item:hover { background:rgba(255,255,255,0.03); }
.notif-item.unread { background:rgba(20,184,166,0.04);border-left:3px solid #14b8a6; }
.notif-icon { width:32px;height:32px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:0.9rem;flex-shrink:0; }
.notif-text { flex:1;min-width:0; }
.notif-title { font-size:0.8rem;font-weight:700;margin-bottom:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.notif-msg { font-size:0.75rem;color:var(--texto-mut);line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden; }
.notif-time { font-size:0.65rem;color:var(--texto-dim);margin-top:3px; }

/* ═══ AMBASSADOR / REFERRAL ═══ */

/* ═══ FORM PLACEHOLDERS (dark theme) ═══ */
::placeholder { color: #64748b !important; opacity: 1; }
::-webkit-input-placeholder { color: #64748b !important; }
::-moz-placeholder { color: #64748b !important; }
:-ms-input-placeholder { color: #64748b !important; }
.form-control::placeholder, .form-select::placeholder { color: #64748b !important; }
input[style*="gris-oscuro"]::placeholder, textarea[style*="gris-oscuro"]::placeholder { color: #64748b !important; }

.ref-card { background:linear-gradient(135deg,rgba(249,115,22,0.06),rgba(239,68,68,0.04));border:1px solid rgba(249,115,22,0.15);border-radius:14px;padding:20px;text-align:center; }
.ref-code { font-family:'Oswald',sans-serif;font-size:1.8rem;font-weight:800;color:var(--naranja);letter-spacing:4px;margin:8px 0; }
.ref-stats { display:flex;gap:12px;justify-content:center;margin-top:12px; }
.ref-stat { background:var(--gris-oscuro);border-radius:10px;padding:12px 16px;text-align:center; }
.ref-stat .num { font-size:1.3rem;font-weight:800;font-family:'Oswald',sans-serif; }
.ref-stat .label { font-size:0.7rem;color:var(--texto-mut);margin-top:2px; }
