/* ── RESET & ESTILOS BASE ────────────────────────────────────────── */
:root {
  --bg-dark: #0b0f19;
  --panel-bg: rgba(23, 31, 48, 0.75);
  --panel-border: rgba(255, 255, 255, 0.08);
  --primary: #25d366;
  --primary-hover: #1fbd59;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --card-bg: rgba(30, 41, 59, 0.7);
  --radius: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow-x: hidden;
}

.background-glow {
  position: fixed;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(circle, rgba(37, 211, 102, 0.15) 0%, rgba(99, 102, 241, 0.1) 40%, rgba(0,0,0,0) 70%);
  z-index: 0;
  pointer-events: none;
}

.app-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* ── VISTA DE AUTENTICACIÓN ───────────────────────────────────────── */
.auth-view {
  min-height: 85vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  padding: 36px;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.brand-logo {
  color: var(--primary);
  display: inline-flex;
  margin-bottom: 12px;
}

.auth-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-tabs {
  display: flex;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  border-color: var(--accent);
}

/* Selector de Planes en Registro */
.plan-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.plan-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.plan-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.plan-card input[type="radio"] {
  accent-color: var(--accent);
}

.plan-info {
  display: flex;
  flex-direction: column;
}

.plan-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.plan-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.plan-card.featured {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.08);
}

.plan-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

/* Botones */
.btn {
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-success {
  background: var(--primary);
  color: #0b0f19;
  font-weight: 700;
}
.btn-success:hover {
  background: var(--primary-hover);
}

.btn-outline-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}
.btn-outline-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-block {
  width: 100%;
}
.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

/* Alertas */
.alert-box {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}
.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* ── VISTA DE DASHBOARD PRINCIPAL ────────────────────────────────── */
.dashboard-view {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--primary);
}

.brand h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.plan-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}
.plan-tag.starter { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.plan-tag.growth { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.plan-tag.enterprise { background: rgba(168, 85, 247, 0.2); color: #c084fc; }

/* Resumen de Cuota */
.usage-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding: 20px 24px;
}

.summary-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.summary-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 10px;
  transition: width 0.4s ease;
}

.action-card {
  justify-content: center;
}

/* Cuadrícula de Slots */
.slots-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.section-title-bar h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.help-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.slot-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

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

.slot-number {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.slot-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.slot-status-pill.connected { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.slot-status-pill.qr { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.slot-status-pill.disconnected { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.slot-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slot-ghl-box, .slot-wa-box {
  background: rgba(15, 23, 42, 0.6);
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.box-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.box-value {
  font-weight: 600;
  font-size: 0.95rem;
}

/* ── MODAL ESCANER QR ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 440px;
  padding: 28px;
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.qr-wrapper {
  background: rgba(15, 23, 42, 0.8);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 240px;
  margin-bottom: 20px;
}

.qr-wrapper img {
  width: 220px;
  height: 220px;
  border-radius: 8px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.connected-box {
  text-align: center;
}
.connected-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.qr-instructions ol {
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
