/* ═══════════════════════════════════════════════════════════════
   Camello Hot Dog Monitor — estilos compartidos
   Dark theme con acentos verde menta
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Colores base */
  --bg-primary:    #0a0e0f;
  --bg-secondary:  #11171a;
  --bg-tertiary:   #1a2226;
  --bg-elevated:   #232c31;

  /* Bordes */
  --border:        #2a3439;
  --border-hover:  #3d4a52;

  /* Texto */
  --text-primary:   #e8eef0;
  --text-secondary: #98a8af;
  --text-tertiary:  #6b7a82;
  --text-disabled:  #4a575e;

  /* Acentos */
  --accent:        #45d4a8;
  --accent-dim:    #2d8f72;
  --accent-glow:   rgba(69, 212, 168, 0.15);

  --warning:       #f5b942;
  --warning-bg:    rgba(245, 185, 66, 0.1);

  --danger:        #ec5959;
  --danger-bg:     rgba(236, 89, 89, 0.1);

  --info:          #5cb1ff;
  --info-bg:       rgba(92, 177, 255, 0.1);

  /* Tipografía */
  --font-mono:     'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  --font-display:  'Space Grotesk', system-ui, sans-serif;
  --font-body:     'Inter', system-ui, -apple-system, sans-serif;

  /* Tamaños */
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;
  --radius-xl:     20px;

  /* Sombras */
  --shadow-sm:     0 1px 2px rgba(0,0,0,0.2);
  --shadow:        0 4px 14px rgba(0,0,0,0.25);
  --shadow-lg:     0 12px 32px rgba(0,0,0,0.35);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(69, 212, 168, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(69, 212, 168, 0.03) 0%, transparent 40%);
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Tipografía mono para datos ─────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.text-mono { font-family: var(--font-mono); font-size: 13px; }

/* ─── Texto auxiliar ─────────────────────────────────────────────── */
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary);  }
.text-accent    { color: var(--accent); }
.text-warning   { color: var(--warning); }
.text-danger    { color: var(--danger); }
.text-info      { color: var(--info); }

/* ─── Header del dashboard ──────────────────────────────────────── */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(8px);
}

.app-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.app-title-main {
  color: var(--text-primary);
  font-weight: 600;
}

.app-title-accent { color: var(--accent); }

.app-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.app-update {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  margin-right: 10px;
}

/* ─── Botones ───────────────────────────────────────────────────── */
.btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
}

.btn-primary {
  background: var(--accent-glow);
  border-color: var(--accent-dim);
  color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.btn-danger {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  border-color: var(--border);
}

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ─── Container principal ───────────────────────────────────────── */
.app-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
}

/* ─── Tabs ──────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 20px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: sticky;
  top: 49px;
  z-index: 150;
  background: var(--bg-primary);
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 10px 18px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tab:hover { color: var(--text-secondary); }

.tab.active {
  color: var(--accent);
  border-bottom-color: transparent;
  background: rgba(80, 227, 194, 0.06);
  border-radius: 8px 8px 0 0;
  box-shadow: 0 1px 8px rgba(80, 227, 194, 0.2), 0 0 1px rgba(80, 227, 194, 0.3);
}

/* ─── Card ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-title-accent {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-description {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* ─── Inputs ────────────────────────────────────────────────────── */
.input, .textarea, .select {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  transition: border-color 0.15s ease;
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.textarea {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  min-height: 80px;
}

.input-row {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.input-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: block;
}

/* ─── Tooltip ───────────────────────────────────────────────────── */
.info-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  border: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s ease;
}

.info-btn:hover {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent-dim);
}

.tip-wrap { position: relative; display: inline-block; }

.tip {
  position: absolute;
  left: 24px;
  top: -8px;
  width: 280px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-primary);
  z-index: 50;
  display: none;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
}

.tip-wrap:hover .tip { display: block; }

.tip-h {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
}

.tip code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-primary);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent);
}

/* ─── Switch ────────────────────────────────────────────────────── */
.switch {
  position: relative;
  width: 38px;
  height: 22px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.switch.on {
  background: var(--accent);
  border-color: var(--accent);
}

.switch-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 18px;
  height: 18px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.switch.on .switch-knob {
  transform: translateX(16px);
  background: var(--bg-primary);
}

/* ─── Chips/placeholders ────────────────────────────────────────── */
.chip {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 3px 9px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  margin: 2px 4px 2px 0;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent-dim);
}

/* ─── Preview boxes ─────────────────────────────────────────────── */
.msg-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}
.msg-editor-col {
  display: flex;
  flex-direction: column;
}
.msg-editor-col .textarea {
  flex: 1;
  min-height: 120px;
}
.msg-preview-col {
  padding: 14px 16px;
  background: var(--accent-glow);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
  align-self: start;
}
.msg-preview-col.off {
  background: var(--bg-tertiary);
  border-left-color: var(--border);
  color: var(--text-tertiary);
}
.msg-preview-col.off .preview-label { color: var(--text-tertiary); }
@media (max-width: 768px) {
  .msg-layout { grid-template-columns: 1fr; }
}

.preview {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--accent-glow);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
}

.preview-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
  color: var(--accent);
  display: block;
}

.preview.off {
  background: var(--bg-tertiary);
  border-left-color: var(--border);
  color: var(--text-tertiary);
}
.preview.off .preview-label { color: var(--text-tertiary); }

/* ─── Toast ─────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideIn 0.25s ease;
  min-width: 280px;
}

.toast.success { border-left: 3px solid var(--accent); }
.toast.error   { border-left: 3px solid var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Empty state ───────────────────────────────────────────────── */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ─── Loading skeleton ──────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Section dentro de card ────────────────────────────────────── */
.section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.section:last-child { border-bottom: none; padding-bottom: 0; }
.section:first-child { padding-top: 0; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.section-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.5;
}

/* ─── Toggle row ────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
}

/* Luz testigo WhatsApp */
.wa-light { display:inline-block; width:8px; height:8px; border-radius:50%; margin-left:4px; vertical-align:middle; }
.wa-light.on { background:#4ade80; box-shadow:0 0 6px #4ade80; }
.wa-light.warn { background:#fbbf24; box-shadow:0 0 6px #fbbf24; }
.wa-light.off { background:#ef4444; box-shadow:0 0 6px #ef4444; }
/* Bot mode chip */
.bot-mode-chip{position:relative;display:inline-flex;align-items:center;gap:6px;padding:5px 14px;border-radius:20px;font-size:12px;font-weight:600;cursor:pointer;margin:auto 8px auto 0;white-space:nowrap;user-select:none;transition:opacity .2s;align-self:center}
.bot-mode-chip.trabajo{background:#d1fae5;color:#065f46}
.bot-mode-chip.pruebas{background:#fef3c7;color:#92400e}
.bot-mode-chip.apagado{background:#fee2e2;color:#991b1b}
.bmc-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}
.bmc-dot.green{background:#22c55e}
.bmc-dot.yellow{background:#eab308}
.bmc-dot.red{background:#ef4444}
.bmc-arrow{font-size:10px;opacity:.7}
.bmc-dropdown{display:none;position:absolute;top:calc(100% + 6px);right:0;background:var(--bg-secondary,#11171a);border:1px solid var(--border,#2a3439);border-radius:8px;padding:4px;min-width:180px;z-index:999;box-shadow:0 8px 24px rgba(0,0,0,.4)}
.bmc-dropdown.open{display:block}
.bmc-option{display:flex;align-items:center;gap:8px;padding:9px 14px;font-size:13px;font-weight:500;color:var(--text-primary,#e8eef0);border-radius:6px;cursor:pointer}
.bmc-option:hover{background:var(--bg-tertiary,#1a2228)}
.bmc-option.active{background:var(--bg-tertiary,#1a2228)}

.resto-row > div:first-child { text-align: left; }

/* ═══ RESPONSIVE MÓVIL ═══ */
@media (max-width: 600px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
  }
  .app-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .tabs {
    gap: 0;
    scrollbar-width: none;
  }
  .tab {
    padding: 10px 12px;
    font-size: 12px;
  }
  .tip {
    left: auto;
    right: 0;
    width: 220px;
    max-width: 80vw;
  }
  .toast {
    min-width: auto;
    width: calc(100vw - 32px);
    right: 16px;
  }
  .card {
    padding: 14px;
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
