/* ==========================================================================
   RecuMail Enterprise Design System - UI Elegante, Clara y de Alta Precisión
   Inspirado en Stripe Dashboard, Linear, Resend y Mailpro Enterprise
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;

  --border-light: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #4f46e5;

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --brand-primary: #4f46e5;
  --brand-primary-dark: #4338ca;
  --brand-light: #eef2ff;
  --brand-accent: #3b82f6;

  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.03);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 6px 16px -3px rgba(15, 23, 42, 0.06), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -3px rgba(15, 23, 42, 0.04);
  --shadow-brand: 0 4px 14px -2px rgba(79, 70, 229, 0.32), inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
}

* {
  font-family: var(--font-sans);
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  overflow-x: hidden;
  background-image:
    radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.045) 0px, transparent 45%),
    radial-gradient(at 100% 0%, rgba(14, 165, 233, 0.035) 0px, transparent 40%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.03) 0px, transparent 45%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
}

/* ==========================================================================
   1. Superficies, Tarjetas y Paneles (Glass & Elevated Cards)
   ========================================================================== */
.glass-panel {
  background-color: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-panel:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.card-elevated {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   2. Sistema de Botones Táctiles de Alta Precisión
   ========================================================================== */
button,
a[download],
label[for="campaign-attachments-input"] {
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

button:not(:disabled):active,
a[download]:active {
  transform: translateY(0px) scale(0.985) !important;
}

/* Mejora automática de botones primarios Indigo */
button.bg-indigo-600,
a.bg-indigo-600 {
  background-image: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 2px 8px -1px rgba(79, 70, 229, 0.35), inset 0 1px 0 0 rgba(255, 255, 255, 0.22);
  border: 1px solid #4338ca;
}

button.bg-indigo-600:hover:not(:disabled),
a.bg-indigo-600:hover {
  background-image: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 6px 16px -2px rgba(79, 70, 229, 0.45), inset 0 1px 0 0 rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* Botones Esmeralda (Éxito / Exportación / Reanudar) */
button.bg-emerald-600,
a.bg-emerald-600 {
  background-image: linear-gradient(180deg, #10b981 0%, #059669 100%);
  box-shadow: 0 2px 8px -1px rgba(5, 150, 105, 0.32), inset 0 1px 0 0 rgba(255, 255, 255, 0.22);
  border: 1px solid #047857;
}

button.bg-emerald-600:hover:not(:disabled),
a.bg-emerald-600:hover {
  background-image: linear-gradient(180deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 14px -2px rgba(5, 150, 105, 0.42), inset 0 1px 0 0 rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* Botones Ámbar (Guardar / Programar / Pausar) */
button.bg-amber-500,
button.bg-amber-600 {
  background-image: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 2px 8px -1px rgba(217, 119, 6, 0.3), inset 0 1px 0 0 rgba(255, 255, 255, 0.22);
  border: 1px solid #b45309;
}

button.bg-amber-500:hover:not(:disabled),
button.bg-amber-600:hover:not(:disabled) {
  background-image: linear-gradient(180deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 6px 14px -2px rgba(217, 119, 6, 0.4);
  transform: translateY(-1px);
}

/* Botones Rose (Peligro / Bloquear / Detener) */
button.bg-rose-600 {
  background-image: linear-gradient(180deg, #f43f5e 0%, #e11d48 100%);
  box-shadow: 0 2px 8px -1px rgba(225, 29, 72, 0.3), inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
  border: 1px solid #be123c;
}

button.bg-rose-600:hover:not(:disabled) {
  background-image: linear-gradient(180deg, #e11d48 0%, #be123c 100%);
  transform: translateY(-1px);
}

/* Botones Secundarios Blancos */
button.bg-white:hover:not(:disabled),
a.bg-white:hover {
  border-color: #cbd5e1;
  box-shadow: 0 3px 8px -2px rgba(15, 23, 42, 0.07);
  transform: translateY(-0.5px);
}

/* ==========================================================================
   3. Navegación Lateral (Sidebar) Elegante y Estructurada
   ========================================================================== */
.sidebar-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  font-size: 0.8125rem;
  transition: all 0.16s ease;
  border: 1px solid transparent;
}

.sidebar-nav-item .nav-icon-box {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s ease;
  flex-shrink: 0;
}

.sidebar-nav-item.bg-indigo-50 {
  background: linear-gradient(90deg, #eef2ff 0%, rgba(238, 242, 255, 0.5) 100%);
  color: #3730a3;
  border-color: #c7d2fe;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.06);
}

.sidebar-nav-item.bg-indigo-50::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 20%;
  height: 60%;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background-color: #4f46e5;
}

.sidebar-nav-item.bg-indigo-50 .nav-icon-box {
  background-color: #4f46e5;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.sidebar-nav-item.bg-indigo-50 .nav-icon-box svg {
  color: #ffffff !important;
}

/* ==========================================================================
   4. Controles de Formulario, Inputs, Selects y Sliders
   ========================================================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
  border-color: #4f46e5 !important;
  background-color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12) !important;
}

/* Slider estilizado */
input[type="range"] {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  outline: none;
}

/* ==========================================================================
   5. Tablas de Datos Profesionales
   ========================================================================== */
table thead th {
  letter-spacing: 0.04em;
  font-weight: 700;
}

table tbody tr {
  transition: background-color 0.12s ease;
}

table tbody tr:hover {
  background-color: rgba(241, 245, 249, 0.7) !important;
}

/* ==========================================================================
   6. Scrollbars, Píldoras de Variables y Marcos de Dispositivo
   ========================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.var-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 8px;
  background-color: #f8fafc;
  color: #334155;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.var-pill:hover {
  background-color: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.08);
}

.mobile-frame-container {
  width: 360px;
  margin: 0 auto;
  border: 12px solid #1e293b;
  border-radius: 40px;
  box-shadow: 0 20px 35px -10px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  background: #ffffff;
}

.mobile-notch {
  width: 130px;
  height: 18px;
  background: #1e293b;
  margin: 0 auto;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.desktop-preview-container {
  max-width: 640px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.modular-block {
  position: relative;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: #ffffff;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
}

.modular-block:hover {
  border-color: #818cf8;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.modular-block-actions {
  display: flex;
  gap: 0.25rem;
}

.terminal-console {
  font-family: var(--font-mono);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-online {
  background-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22);
}

.status-busy {
  background-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22);
}

.status-offline {
  background-color: #94a3b8;
}

.view-section {
  display: none;
  animation: fadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.modal-overlay {
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.block-tile {
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.block-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px -2px rgba(79, 70, 229, 0.14);
}

.block-tile:active {
  transform: translateY(0);
}

[data-editable-field] {
  cursor: text;
  transition: all 0.15s ease;
  border-radius: 4px;
  min-height: 1.2em;
}

[data-editable-field]:hover {
  background-color: rgba(99, 102, 241, 0.07);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35);
}

[data-editable-field]:focus {
  background-color: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 0 2px #6366f1;
  outline: none;
}

.block-floating-bar {
  animation: fadeIn 0.15s ease-out;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

/* Insignias de Paso en Pantallas (Step Badges) */
.step-section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.28);
  flex-shrink: 0;
}
