/* ========================================================
   MariA 🤖 Admin Panel - Design System & Styles
   Palette: Slate Dark / Emerald / Indigo / Amber
   ======================================================== */

:root {
  --bg-main: #0b1120;
  --bg-card: #151f32;
  --bg-card-hover: #1e293b;
  --bg-sidebar: #0f172a;
  --border-color: #1e293b;
  --border-focus: #3b82f6;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #00a884;
  --primary-hover: #029070;
  --accent-indigo: #6366f1;
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.4);
}

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

body.admin-body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ================= LOGIN OVERLAY ================= */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top right, #1e1b4b 0%, #0b1120 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(21, 31, 50, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg), 0 0 50px rgba(0, 168, 132, 0.1);
  text-align: center;
}

.login-avatar {
  font-size: 48px;
  margin-bottom: 12px;
  display: inline-block;
  animation: floatBounce 3s ease-in-out infinite;
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.login-header h2 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  margin-bottom: 6px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-form {
  text-align: left;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrap .icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  pointer-events: none;
  opacity: 0.6;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.input-icon-wrap input {
  padding-left: 42px;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.2);
  background: rgba(15, 23, 42, 1);
}

.login-error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #00a884 0%, #059669 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 168, 132, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 168, 132, 0.4);
}

.btn-block {
  width: 100%;
}

.login-footer {
  margin-top: 24px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.badge-hint {
  display: inline-block;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.badge-hint code {
  color: #ffffff;
  font-weight: 700;
}

.crypto-note {
  font-size: 12px;
  color: var(--text-muted);
}

/* ================= APP LAYOUT ================= */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  font-size: 28px;
  background: rgba(0, 168, 132, 0.15);
  border: 1px solid rgba(0, 168, 132, 0.3);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(0, 168, 132, 0.15);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.nav-icon {
  font-size: 18px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: rgba(0,0,0,0.2);
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

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

.status-dot.online {
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.btn-logout {
  width: 100%;
  background: rgba(244, 63, 94, 0.1);
  color: #f87171;
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: rgba(244, 63, 94, 0.2);
}

/* ================= MAIN CONTENT ================= */
.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 70px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-title h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
}

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-outline {
  border: 1px solid var(--primary);
  color: var(--primary);
  background: rgba(0, 168, 132, 0.08);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: var(--primary);
  color: #ffffff;
}

.btn-refresh {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}

.btn-refresh:hover {
  color: #ffffff;
  border-color: var(--text-secondary);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

/* CONTENT BODY & PANES */
.content-body {
  padding: 32px;
  flex: 1;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

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

/* ================= STATS GRID ================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.stat-icon.green  { background: rgba(0, 168, 132, 0.15); color: var(--primary); }
.stat-icon.blue   { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.stat-icon.amber  { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }

.stat-value {
  display: block;
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ================= PANELS & CARDS ================= */
.dashboard-panels-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.panel-body {
  padding: 24px;
}

.active-survey-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.detail-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
}

.detail-row .label {
  color: var(--text-muted);
  width: 170px;
}

.tag-bot {
  background: rgba(0, 168, 132, 0.15);
  border: 1px solid rgba(0, 168, 132, 0.3);
  color: #34d399;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.quick-actions-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-secondary {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #334155;
  color: #ffffff;
}

.feature-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.check-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 168, 132, 0.2);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.feature-checklist strong {
  display: block;
  font-size: 14px;
  color: #ffffff;
}

.feature-checklist p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ================= TABLES ================= */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: #ffffff;
}

.badge-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-status.online {
  background: rgba(0, 168, 132, 0.15);
  color: #34d399;
}

.badge-status.active {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.badge-status.completed {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

/* ================= FORMS & TOGGLES ================= */
.max-w-700 { max-width: 700px; }
.max-w-600 { max-width: 600px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }

.form-group small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 6px;
}

.form-check-group {
  margin-bottom: 16px;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-control input {
  display: none;
}

.toggle-slider {
  width: 44px;
  height: 24px;
  background: #334155;
  border-radius: 12px;
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.toggle-control input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-control input:checked + .toggle-slider::after {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 14px;
  color: var(--text-primary);
}

/* ================= LINKS & QR ================= */
.links-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
}

.input-copy-group {
  display: flex;
  gap: 8px;
}

.btn-copy {
  background: #1e293b;
  color: #ffffff;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

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

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.qr-box {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.qr-hint {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ================= MODAL & TOAST ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  border: 1px solid var(--primary);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Estilos para Modal Enriquecido de Respuestas y Escáner */
.session-meta-strip {
  display: flex;
  gap: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13.5px;
}

.modal-search-box, .scanner-search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.modal-search-box input, .scanner-search-box input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  outline: none;
  transition: var(--transition);
}

.modal-search-box input:focus, .scanner-search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.counter-badge {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  border: 1px solid var(--border-glow);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.enriched-table td {
  vertical-align: top;
  padding: 12px 14px;
}

.badge-code {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: #38bdf8;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-family: monospace;
  font-weight: 600;
  display: inline-block;
}

.q-title {
  color: var(--text-main);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.4;
  margin-bottom: 3px;
}

.q-item {
  color: var(--text-muted);
  font-size: 12.5px;
  display: inline-block;
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 2px;
}

.val-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.badge-val {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
  align-self: flex-start;
  display: inline-block;
}

.val-text {
  color: #e2e8f0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}

@media (max-width: 900px) {
  .dashboard-panels-grid, .links-grid { grid-template-columns: 1fr; }
  .sidebar { width: 70px; }
  .brand-text, .nav-item span:last-child, .sidebar-footer { display: none; }
  .main-content { margin-left: 70px; }
}
