/* ===================== RESET & BASE ===================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #000000;
  color: #ffffff;
  min-height: 100vh;
  padding: 24px;
}

a {
  color: #ffffff;
  text-decoration: underline;
}

a:hover {
  text-decoration: underline;
  opacity: 0.8;
}

/* ===================== LOGIN PAGE ===================== */
.login-wrapper {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-card h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.login-card h1 i {
  color: #6f42c1;
  margin-right: 8px;
}

.login-subtitle {
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 20px;
}

.login-card label {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 6px;
  margin-top: 12px;
}

.login-card button {
  margin-top: 20px;
}

.login-error {
  margin-top: 14px;
  font-size: 13px;
  color: #dc3545;
  text-align: center;
}

/* ===================== PAGE SYSTEM ===================== */
.dashboard-page {
  display: none;
  max-width: 1200px;
  margin: 0 auto;
  animation: fadeIn 300ms ease;
}

.dashboard-page.active {
  display: block;
}

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

/* ===================== MAIN HEADER ===================== */
.main-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 30px 0;
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.main-title {
  font-family: 'Poppins', sans-serif;
  font-size: 36px;
  font-weight: 900;
  color: #ffffff;
}

.main-title i {
  color: #ffffff;
  margin-right: 10px;
}

.session-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto 16px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

/* ===================== ACCOUNT GRID ===================== */
.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.account-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.account-card:hover {
  transform: translateY(-3px);
  border-color: rgba(111, 66, 193, 0.5);
  box-shadow: 0 8px 30px rgba(111, 66, 193, 0.2);
}

.account-card i {
  font-size: 32px;
  color: #6f42c1;
  margin-bottom: 14px;
  display: block;
}

.account-card h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 17px;
  font-weight: 700;
}

.account-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
  border: 1px solid rgba(40, 167, 69, 0.3);
  animation: pulse 2s infinite;
}

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

.empty-state {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  padding: 40px 0;
}

/* ===================== FUNCTION GRID ===================== */
.function-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.function-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.function-card:hover {
  transform: translateY(-3px);
  border-color: rgba(111, 66, 193, 0.5);
  box-shadow: 0 8px 30px rgba(111, 66, 193, 0.2);
}

.function-card i {
  font-size: 36px;
  color: #6f42c1;
  margin-bottom: 16px;
  display: block;
}

.function-card h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.function-card p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

/* ===================== PAGE HEADER ===================== */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.page-header h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 24px;
  font-weight: 700;
  flex: 1;
}

.back-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* ===================== STATUS INDICATOR ===================== */
.status-container {
  display: flex;
  align-items: center;
}

.status-indicator {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-indicator.stopped {
  background: rgba(220, 53, 69, 0.2);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.3);
}

.status-indicator.running {
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
  border: 1px solid rgba(40, 167, 69, 0.3);
  animation: pulse 2s infinite;
}

/* ===================== CONFIG CARD ===================== */
.config-card {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.config-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-card h4 i {
  color: #6f42c1;
  font-size: 14px;
}

/* ===================== FORMS ===================== */
textarea,
input[type="text"],
input[type="number"],
input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  font-family: 'Fira Code', monospace;
  outline: none;
  resize: vertical;
  transition: all 0.2s ease;
}

textarea::placeholder,
input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

textarea:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus {
  border-color: #6f42c1;
  transform: scale(1.01);
  box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.15);
}

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

.form-group label {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 6px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #6f42c1;
}

.field-info {
  margin-top: 10px;
  font-size: 13px;
  opacity: 0.7;
}

/* ===================== WARMUP MODE SELECTOR ===================== */
.warmup-mode-selector {
  display: flex;
  gap: 12px;
}

.scraping-type-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  transition: all 0.2s ease;
}

.scraping-type-option:hover {
  border-color: rgba(111, 66, 193, 0.4);
}

.scraping-type-option:has(input:checked) {
  background: rgba(111, 66, 193, 0.2);
  border-color: rgba(111, 66, 193, 0.5);
  color: #ffffff;
}

.scraping-type-option input[type="radio"] {
  accent-color: #6f42c1;
}

/* ===================== BUTTONS ===================== */
.control-panel {
  margin: 20px 0;
}

.button-group {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.primary-btn,
.danger-btn,
.warning-btn,
.secondary-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn {
  background: #6f42c1;
  color: #ffffff;
  width: 100%;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(111, 66, 193, 0.4);
}

.danger-btn {
  background: #dc3545;
  color: #ffffff;
}

.danger-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(220, 53, 69, 0.4);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.secondary-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

/* ===================== STATS GRID ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  color: #ffffff;
}

/* ===================== MONITOR CARD ===================== */
.monitor-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.log-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.log-header h4 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.8);
}

.log-header h4 i {
  color: #6f42c1;
}

.log-container {
  max-height: 300px;
  overflow-y: auto;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  transition: max-height 0.3s ease;
}

.log-container.collapsed {
  max-height: 0;
  padding: 0 20px;
  overflow: hidden;
}

.log-entry {
  padding: 6px 0;
  font-size: 13px;
  font-family: 'Fira Code', monospace;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  line-height: 1.5;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-time {
  color: rgba(255, 255, 255, 0.65);
  margin-right: 8px;
}

.log-info { color: rgba(255, 255, 255, 0.8); }
.log-warning { color: #ffc107; }
.log-error { color: #dc3545; }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ===================== DM PAGE: 2-COLUMN LAYOUT ===================== */
.dm-content {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 30px;
  align-items: start;
  max-width: 1100px;
  margin: 0 auto;
}

.dm-config-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dm-monitor-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 24px;
  padding: 4px;
}

/* DM Mode selector grid */
.dm-mode-box {
  margin-bottom: 15px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.dm-mode-box-label {
  font-weight: 600;
  margin-bottom: 10px;
  display: block;
  opacity: 0.9;
}

.dm-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dm-mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all 200ms ease;
  font-size: 13px;
}

.dm-mode-option:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
}

.dm-mode-option:has(input:checked) {
  border-color: #6f42c1;
  background: rgba(111, 66, 193, 0.15);
}

/* Total messages input */
.total-messages-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.total-messages-row .total-messages-input {
  flex-shrink: 0;
  width: 100px;
  padding: 10px;
  border: 2px solid #6f42c1;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.total-messages-label {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.8;
}

/* Variants textarea */
.variants-textarea {
  border: 2px solid #6f42c1 !important;
  min-height: 120px;
}

/* Stat cards with icons */
.stat-icon {
  font-size: 20px;
  opacity: 0.7;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

/* ===================== CONFIG ROWS (sliders grid) ===================== */
.config-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.config-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.config-row-3 .config-card {
  margin: 0;
}

.config-row .config-card > label {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 8px;
}

.slider-container {
  margin-bottom: 16px;
}

.slider-container label span {
  color: #ffffff;
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6f42c1;
  cursor: pointer;
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(111, 66, 193, 0.5);
}

/* ===================== HUMANIZATION TOGGLE ===================== */
.humanization-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 15px 0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.2);
  transition: 300ms;
}

.switch .slider.round {
  border-radius: 26px;
}

.switch .slider.round:before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #ffffff;
  transition: 300ms;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background: #6f42c1;
}

.switch input:checked + .slider:before {
  transform: translateX(24px);
}

/* ===================== INFO BOX (anti-deteccion, azul) ===================== */
.info-box {
  background: rgba(14, 165, 233, 0.1);
  padding: 12px;
  border-radius: 6px;
  border-left: 4px solid #0ea5e9;
  margin-top: 12px;
}

.info-box p {
  margin: 0;
  font-size: 13px;
}

.field-warning {
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.7;
}

/* ===================== INFO CARD (Warmup, purpura) ===================== */
.info-card {
  background: rgba(111, 66, 193, 0.15);
  border: 1px solid rgba(111, 66, 193, 0.3);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-icon {
  font-size: 20px;
  color: #6f42c1;
  flex-shrink: 0;
}

.info-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
}

/* ===================== USER STATUS TABLE ===================== */
.users-table-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.7;
  margin-bottom: 8px;
}

#userStatusContainer {
  max-height: 200px;
  overflow-y: auto;
}

.user-status-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  font-size: 13px;
}

.user-status-entry.success {
  background: rgba(40, 167, 69, 0.1);
  border: 1px solid rgba(40, 167, 69, 0.2);
}

.user-status-entry.error {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.2);
}

/* ===================== WARNING BUTTON ===================== */
.warning-btn {
  background: #ffc107;
  color: #000000;
}

.warning-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 193, 7, 0.4);
}

/* ===================== TOAST NOTIFICATIONS ===================== */
@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

/* ===================== RESPONSIVE ===================== */
@media (max-width: 600px) {
  body {
    padding: 16px;
  }

  .function-grid,
  .account-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .button-group {
    flex-direction: column;
  }

  .page-header {
    flex-wrap: wrap;
  }

  .warmup-mode-selector {
    flex-direction: column;
  }

  .dm-content {
    grid-template-columns: 1fr;
  }

  .dm-monitor-section {
    position: static;
  }

  .dm-mode-grid {
    grid-template-columns: 1fr;
  }
}
