/* ═══════════════════════════════════════════
   shared.css – Estilos comunes Zento v3
═══════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Paleta ZENTO */
  --purple:      #FF5E78;   /* Sunset Coral — color primario de marca */
  --purple-d:    #D43A5F;   /* Coral oscuro — hover/active */
  --purple-l:    #FFF0F3;   /* Coral claro — fondos activos */
  --teal:        #00B4D8;   /* Ocean Cyan */
  --teal-l:      #E0F7FC;   /* Cyan claro */
  --amber:       #FF8A00;   /* Vibrant Orange */
  --amber-l:     #FFF3E0;   /* Orange claro */
  --red:         #E24B4A;
  --red-l:       #FCEBEB;
  --blue:        #8A5CF6;   /* Vivid Purple — acento secundario */
  --blue-l:      #F3EFFE;
  --green:       #22C55E;

  --bg:          #F8F7F4;
  --surface:     #FFFFFF;
  --surface2:    #F5F1F2;
  --border:      rgba(0,0,0,0.09);
  --border-md:   rgba(0,0,0,0.16);
  --text:        #0D0D0D;   /* Deep Black */
  --text-2:      #5F5E5A;
  --text-3:      #888780;

  --radius:      8px;
  --radius-lg:   12px;
  --sidebar-w:   220px;
  --topbar-h:    56px;
}

body { font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--purple); text-decoration: none; }

/* ── LAYOUT ─────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--surface);
  border-right: 0.5px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  padding: 0 24px; display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0;
  position: sticky; top: 0; z-index: 50;
}
.content { flex: 1; padding: 22px 24px; overflow-y: auto; }

/* ── SIDEBAR ────────────────────────────── */
.sidebar-logo {
  padding: 16px 16px 12px;
  border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700;
}
.logo-dot {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--purple-l); color: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
}
.nav-section { padding: 8px; flex: 1; }
.nav-group-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-3); font-weight: 600; padding: 10px 8px 4px;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--text-2); font-size: 13px;
  transition: background .12s, color .12s;
  cursor: pointer; border: none; background: transparent; width: 100%; text-align: left;
}
.nav-link:hover  { background: var(--surface2); color: var(--text); }
.nav-link.active { background: var(--purple-l); color: var(--purple-d); font-weight: 500; }
.nav-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  border-radius: 10px; padding: 1px 6px; font-size: 10px; font-weight: 600;
}
.sidebar-footer {
  padding: 12px; border-top: 0.5px solid var(--border);
}
.user-row { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--purple-l); color: var(--purple-d);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.user-name  { font-size: 12px; font-weight: 500; }
.user-role  { font-size: 10px; color: var(--text-3); }
.logout-btn { font-size: 11px; color: var(--text-3); background: none; border: none; cursor: pointer; }
.logout-btn:hover { color: var(--red); }

/* ── TOPBAR ─────────────────────────────── */
.topbar-title { font-size: 16px; font-weight: 500; }
.topbar-sub   { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.notif-chip   {
  font-size: 11px; background: var(--surface2); padding: 4px 10px;
  border-radius: 6px; color: var(--text-2); cursor: pointer;
}

/* ── BUTTONS ────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius);
  font-size: 12px; font-weight: 500; cursor: pointer;
  border: 0.5px solid var(--border-md);
  background: var(--surface); color: var(--text);
  transition: background .12s; white-space: nowrap;
}
.btn:hover    { background: var(--surface2); }
.btn:active   { transform: scale(.98); }
.btn-primary  { background: var(--purple); color: #fff; border-color: var(--purple); }
.btn-primary:hover { background: var(--purple-d); }
.btn-danger   { background: var(--red-l); color: #791F1F; border-color: #F09595; }
.btn-success  { background: var(--teal-l); color: #085041; border-color: #5DCAA5; }
.btn-warning  { background: var(--amber-l); color: #633806; border-color: #FAC775; }
.btn-blue     { background: var(--blue-l); color: #1D4ED8; border-color: #93C5FD; }
.btn-sm       { padding: 4px 10px; font-size: 11px; }
.btn-block    { width: 100%; justify-content: center; }
.btn-icon     { padding: 6px 8px; border-radius: 6px; }

/* ── FORMS ──────────────────────────────── */
.form-group   { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-group label { font-size: 10px; font-weight: 600; color: var(--text-2);
                    text-transform: uppercase; letter-spacing: 0.4px; }
.form-control {
  padding: 8px 11px; border-radius: var(--radius);
  border: 0.5px solid var(--border-md);
  background: var(--surface2); font-size: 13px; color: var(--text);
  outline: none; font-family: inherit; width: 100%;
  transition: border-color .12s;
}
.form-control:focus { border-color: var(--purple); background: var(--surface); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── CARDS ──────────────────────────────── */
.card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
}
.card-title { font-size: 13px; font-weight: 500; margin-bottom: 14px; color: var(--text); }
.card-subtitle { font-size: 11px; color: var(--text-3); margin-top: -10px; margin-bottom: 14px; }

/* ── KPIs ───────────────────────────────── */
.kpi-row  { display: grid; gap: 12px; margin-bottom: 18px; }
.kpi-row-4 { grid-template-columns: repeat(4,1fr); }
.kpi-row-3 { grid-template-columns: repeat(3,1fr); }
.kpi-row-2 { grid-template-columns: repeat(2,1fr); }
.kpi-card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
}
.kpi-label { font-size: 11px; color: var(--text-3); margin-bottom: 5px; }
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1; letter-spacing: -0.5px; }
.kpi-delta { margin-top: 5px; font-size: 11px; }
.up   { background: var(--teal-l);  color: #085041; border-radius: 4px; padding: 1px 5px; }
.down { background: var(--red-l);   color: #791F1F; border-radius: 4px; padding: 1px 5px; }

/* ── BADGES ─────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 3px;
         padding: 2px 7px; border-radius: 5px; font-size: 11px; font-weight: 500; }
.badge::before { content:''; width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge-green  { background: var(--teal-l);   color: #085041; }
.badge-amber  { background: var(--amber-l);  color: #633806; }
.badge-red    { background: var(--red-l);    color: #791F1F; }
.badge-purple { background: var(--purple-l); color: var(--purple-d); }
.badge-blue   { background: var(--blue-l);   color: #1D4ED8; }
.badge-gray   { background: var(--surface2); color: var(--text-2); }

/* ── TABLES ─────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { padding: 9px 14px; text-align: left; font-size: 10px; font-weight: 600;
           color: var(--text-3); text-transform: uppercase; letter-spacing: 0.3px;
           border-bottom: 0.5px solid var(--border-md); white-space: nowrap; }
tbody tr { border-bottom: 0.5px solid var(--border); }
tbody tr:nth-child(even) { background: var(--surface2); }
tbody tr:hover { background: var(--purple-l); }
tbody td { padding: 10px 14px; vertical-align: middle; }
.td-mono { font-family: monospace; font-size: 12px; }

/* ── ALERTS ─────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px; }
.alert-error   { background: var(--red-l);    color: #791F1F; border: 0.5px solid #F09595; }
.alert-success { background: var(--teal-l);   color: #085041; border: 0.5px solid #5DCAA5; }
.alert-warning { background: var(--amber-l);  color: #633806; border: 0.5px solid #FAC775; }
.alert-info    { background: var(--blue-l);   color: #1D4ED8; border: 0.5px solid #93C5FD; }

/* ── MODAL ──────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: none; align-items: center; justify-content: center; z-index: 200;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  border: 0.5px solid var(--border-md);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 0.5px solid var(--border); position: sticky; top: 0;
  background: var(--surface); z-index: 1;
}
.modal-head h3 { font-size: 14px; font-weight: 500; }
.modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text-3); padding: 4px; }
.modal-close:hover { color: var(--red); }
.modal-body { padding: 20px; }

/* ── TOAST ──────────────────────────────── */
#toast-container { position: fixed; bottom: 22px; right: 22px; z-index: 300;
                   display: flex; flex-direction: column; gap: 7px; }
.toast { padding: 10px 16px; border-radius: var(--radius); font-size: 13px;
         min-width: 220px; animation: toastIn .2s ease;
         background: var(--text); color: #fff; }
.toast.success { background: #085041; }
.toast.error   { background: #791F1F; }
.toast.warning { background: #633806; }
@keyframes toastIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

/* ── CHAT ───────────────────────────────── */
.chat-wrap {
  display: flex; flex-direction: column; height: 480px;
  border: 0.5px solid var(--border-md); border-radius: var(--radius-lg); overflow: hidden;
}
.chat-header {
  padding: 12px 16px; background: var(--surface); border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.chat-online { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex;
                 flex-direction: column; gap: 10px; background: var(--bg); }
.msg { display: flex; flex-direction: column; max-width: 75%; }
.msg.sent  { align-self: flex-end; align-items: flex-end; }
.msg.recv  { align-self: flex-start; }
.msg-bubble {
  padding: 9px 13px; border-radius: 12px; font-size: 13px; line-height: 1.5;
}
.msg.recv  .msg-bubble { background: var(--surface); border: 0.5px solid var(--border); color: var(--text); border-radius: 2px 12px 12px 12px; }
.msg.sent  .msg-bubble { background: var(--purple); color: #fff; border-radius: 12px 12px 2px 12px; }
.msg-time { font-size: 10px; color: var(--text-3); margin-top: 3px; padding: 0 4px; }
.msg-name { font-size: 10px; color: var(--text-3); margin-bottom: 3px; padding: 0 4px; font-weight: 500; }
.chat-input-row {
  padding: 10px 12px; border-top: 0.5px solid var(--border);
  background: var(--surface); display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0;
}
.chat-input {
  flex: 1; padding: 8px 12px; border-radius: 20px;
  border: 0.5px solid var(--border-md); font-size: 13px;
  outline: none; background: var(--surface2); resize: none; max-height: 80px;
}
.chat-input:focus { border-color: var(--purple); }
.chat-send { background: var(--purple); color: #fff; border: none; border-radius: 50%;
             width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
             cursor: pointer; flex-shrink: 0; font-size: 15px; }
.chat-send:hover { background: var(--purple-d); }

/* ── TICKET ─────────────────────────────── */
.ticket-card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
  display: flex; gap: 12px; align-items: flex-start;
}
.ticket-card:hover { border-color: var(--purple); }
.ticket-priority {
  width: 4px; border-radius: 2px; align-self: stretch; flex-shrink: 0;
}
.priority-high   { background: var(--red); }
.priority-medium { background: var(--amber); }
.priority-low    { background: var(--teal); }
.ticket-title  { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.ticket-meta   { font-size: 11px; color: var(--text-3); }
.ticket-list   { display: flex; flex-direction: column; gap: 8px; }

/* ── EMERGENCY ──────────────────────────── */
.emerg-panel {
  background: #FFF5F5; border: 1.5px solid #F09595;
  border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 16px;
}
.emerg-active { background: var(--red); color: #fff; border-radius: 6px;
                padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--red);
         animation: pulseAnim 1.2s infinite; display: inline-block; }
.pulse.green { background: var(--green); }
@keyframes pulseAnim { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.4)} }
.emerg-toggle { display: flex; align-items: center; gap: 8px; }
.toggle-sw {
  width: 36px; height: 20px; border-radius: 10px; cursor: pointer;
  background: var(--surface2); border: 0.5px solid var(--border-md);
  position: relative; transition: background .18s;
}
.toggle-sw.on { background: var(--red); border-color: var(--red); }
.toggle-sw::after {
  content:''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  transition: transform .18s;
}
.toggle-sw.on::after { transform: translateX(16px); }

/* ── NEARBY MAP ─────────────────────────── */
.map-frame { width: 100%; height: 260px; border-radius: var(--radius-lg);
             border: 0.5px solid var(--border); overflow: hidden; }
.nearby-card {
  background: var(--surface); border: 0.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.nearby-card.has-emerg { border-color: #F09595; background: #FFF8F8; }

/* ── TWO/THREE COL ──────────────────────── */
.two-col   { display: grid; grid-template-columns: 1fr 1fr;     gap: 16px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── FILTERS ────────────────────────────── */
.filter-bar { display: flex; gap: 7px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.filter-btn {
  padding: 5px 12px; border-radius: 6px; border: 0.5px solid var(--border-md);
  background: transparent; font-size: 12px; cursor: pointer; color: var(--text-2);
}
.filter-btn.active { background: var(--purple-l); color: var(--purple-d);
                     border-color: var(--purple); font-weight: 500; }
.search-box {
  padding: 6px 11px; border-radius: 6px; border: 0.5px solid var(--border-md);
  background: var(--surface2); font-size: 12px; color: var(--text); outline: none; width: 200px;
}
.spacer { flex: 1; }

/* ── LOGIN SCREEN ───────────────────────── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg);
}
.login-box {
  background: var(--surface); border: 0.5px solid var(--border-md);
  border-radius: var(--radius-lg); padding: 2.5rem 2rem; width: 100%; max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-dot { width: 52px; height: 52px; border-radius: 14px; font-size: 22px; margin: 0 auto 10px; }
.login-logo h1 { font-size: 22px; font-weight: 700; }
.login-logo p  { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.panel-switch  { text-align: center; margin-top: 14px; font-size: 12px; color: var(--text-3); }
.panel-switch a { color: var(--purple); font-weight: 500; }

/* ── RESPONSIVE ─────────────────────────── */
@media (max-width: 900px) {
  .kpi-row-4 { grid-template-columns: 1fr 1fr; }
  .three-col  { grid-template-columns: 1fr; }
  .two-col    { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
}
