/* ==========================================================================
   Design System & Reset
   ========================================================================== */
:root {
  --bg-dark: #07090e;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border-light: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(0, 242, 254, 0.5);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  
  --color-success: #00e676;
  --color-warning: #ff9800;
  --color-info: #00b0ff;
  --color-danger: #ff5252;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 2rem;
}

/* ==========================================================================
   Efectos de Fondo (Decoración)
   ========================================================================== */
.background-decor {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
}

.circle-1 {
  top: -10%;
  right: -5%;
  width: 500px;
  height: 500px;
  background: var(--accent-cyan);
}

.circle-2 {
  bottom: -10%;
  left: -5%;
  width: 600px;
  height: 600px;
  background: var(--accent-blue);
}

/* ==========================================================================
   Estructura Principal
   ========================================================================== */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 20px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.logo-icon {
  font-size: 1.8rem;
}

.logo-area h1 {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-version {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-muted);
}

.stats-bar {
  display: flex;
  gap: 1.5rem;
}

.stat-item {
  display: flex;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.stat-label {
  color: var(--text-muted);
}

.stat-value {
  font-weight: 600;
}

/* Content Layout */
.app-content {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2rem;
}

@media (max-width: 960px) {
  .app-content {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Paneles Glassmorphism
   ========================================================================== */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

/* ==========================================================================
   Formularios
   ========================================================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

input, select {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--border-focus);
  background: rgba(255, 255, 255, 0.05);
}

.alert-info {
  background: rgba(0, 176, 255, 0.08);
  border: 1px solid rgba(0, 176, 255, 0.2);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #a3e2ff;
}

.hidden {
  display: none !important;
}

/* Botones */
.btn {
  padding: 0.8rem 1.2rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #07090e;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 242, 254, 0.4);
}

.btn-danger {
  background: rgba(255, 82, 82, 0.15);
  color: var(--color-danger);
  border: 1px solid rgba(255, 82, 82, 0.3);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-success {
  background: rgba(0, 230, 118, 0.15);
  color: var(--color-success);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.btn-success:hover {
  background: var(--color-success);
  color: #07090e;
}

/* ==========================================================================
   Grilla y Tarjetas de Bots
   ========================================================================== */
.bots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.small {
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* Tarjeta Bot */
.bot-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  transition: all 0.3s ease;
}

.bot-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-4px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.bot-info-title h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.bot-phone {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Status Badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-connected {
  background: rgba(0, 230, 118, 0.1);
  color: var(--color-success);
}
.status-connected::before {
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.status-connecting {
  background: rgba(255, 152, 0, 0.1);
  color: var(--color-warning);
}
.status-connecting::before {
  background: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
}

.status-qr {
  background: rgba(0, 176, 255, 0.1);
  color: var(--color-info);
}
.status-qr::before {
  background: var(--color-info);
  box-shadow: 0 0 8px var(--color-info);
}

.status-disconnected {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}
.status-disconnected::before {
  background: #6b7280;
}

.card-body {
  margin-bottom: 1.5rem;
}

.config-tag {
  display: inline-flex;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  margin-right: 0.4rem;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

.card-actions .btn {
  flex: 1;
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
}

/* ==========================================================================
   Modales (Cajas de diálogo de QR)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-content {
  width: 420px;
  max-width: 90%;
  padding: 2rem;
  text-align: center;
  border-color: rgba(255, 255, 255, 0.15);
}

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

.modal-header h3 {
  font-size: 1.2rem;
}

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

.close-btn:hover {
  color: var(--text-main);
}

.modal-body p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.qr-container {
  width: 250px;
  height: 250px;
  margin: 0 auto 1.5rem;
  background: white;
  border-radius: 16px;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.qr-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-timer {
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

/* Spinner de Carga */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 242, 254, 0.1);
  border-top: 4px solid var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: absolute;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.text-success { color: var(--color-success); }
