/* ══════════════════════════════════════════════════
   BuffCraft — styles.css
   Autores: Sebastián, Pablo, Samuel, Eva
   Versión unificada — Incluye todos los estilos comunes
   ══════════════════════════════════════════════════ */

/* ── Tema CLARO (por defecto) ───────────────────── */
:root {
  --bg:           #f8f8f6;
  --surface:      #ffffff;
  --surface-2:    #f0f0ec;
  --accent:       #16a34a;
  --accent-light: #dcfce7;
  --accent-dark:  #14532d;
  --accent-amber: #d97706;
  --text:         #111111;
  --muted:        #6b7280;
  --border:       #e5e7eb;
  --border-dark:  #d1d5db;
  --danger:       #dc2626;
  --danger-light: #fef2f2;
  --warn:         #d97706;
  --warn-light:   #fffbeb;
  --info:         #2563eb;
  --info-light:   #eff6ff;
  --success:      #16a34a;
  --success-light:#dcfce7;
  --radius:       8px;
  --radius-sm:    6px;
  --font-pixel:   'Space Grotesk', 'Courier New', monospace;
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08);
  --transition:   0.2s ease;

  /* Edu-banner (heredado por compatibilidad) */
  --edu-bg:       var(--accent-dark);
  --edu-text:     #ffffff;
  --edu-btn-bg:   #ffffff;
  --edu-btn-text: var(--accent-dark);
}

/* ── Tema OSCURO ────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #0c0c0c;
  --surface:      #141414;
  --surface-2:    #1e1e1e;
  --accent:       #4ade80;
  --accent-light: #14532d;
  --accent-dark:  #86efac;
  --accent-amber: #fbbf24;
  --text:         #f1f1f1;
  --muted:        #71717a;
  --border:       #27272a;
  --border-dark:  #3f3f46;
  --danger:       #f87171;
  --danger-light: #1f0a0a;
  --warn:         #fbbf24;
  --warn-light:   #1f1608;
  --info:         #60a5fa;
  --info-light:   #0c1829;
  --success:      #4ade80;
  --success-light:#0a1f0d;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.4);

  --edu-bg:       #111111;
  --edu-text:     #f1f1f1;
  --edu-btn-bg:   var(--accent);
  --edu-btn-text: #0c0c0c;
}

/* ── Reset y base ───────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  transition: background var(--transition), color var(--transition);
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* ── Tipografía común ───────────────────────────── */
h1, h2, h3, h4, .pixel-text {
  font-family: var(--font-pixel);
  letter-spacing: -0.3px;
}

/* ── Sistema de botones unificado ───────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-pixel);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  background: transparent;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: #991b1b;
}

.btn-danger:hover {
  opacity: 0.88;
  background: #dc2626;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
  gap: 4px;
}

.btn-block {
  width: 100%;
}

/* ── Botón de tema (claro/oscuro) ──────────────── */
.btn-theme {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-theme:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}

/* ── Iconos consistentes ────────────────────────── */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 16px;
  flex-shrink: 0;
}

.icon-sm {
  width: 18px;
  height: 18px;
  font-size: 12px;
}

.icon-lg {
  width: 32px;
  height: 32px;
  font-size: 20px;
}

/* ── Tarjetas y contenedores comunes ────────────── */
.card, .pbox, .feature-card, .plan-card, .mod-card, .catalog-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.card:hover, .pbox:hover, .feature-card:hover, .mod-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.pbox-title {
  font-family: var(--font-pixel);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
}

/* ── Headers de sección ─────────────────────────── */
.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-header h2 {
  font-family: var(--font-pixel);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent-dark);
}

[data-theme="dark"] .section-header h2 {
  color: var(--accent);
}

.section-header p {
  font-size: 15px;
  color: var(--muted);
}

.section-title {
  font-family: var(--font-pixel);
  font-size: 17px;
  font-weight: 700;
  color: var(--accent-dark);
}

[data-theme="dark"] .section-title {
  color: var(--accent);
}

.section-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ── Navegación principal ───────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 40px;
  height: 64px;
  border-bottom: 3px solid var(--accent);
  background: var(--surface);
  transition: background var(--transition);
}

.site-nav .logo {
  font-family: var(--font-pixel);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-dark);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

[data-theme="dark"] .site-nav .logo {
  color: var(--accent);
}

.site-nav ul {
  display: flex;
  gap: 24px;
  flex: 1;
}

.site-nav ul a {
  font-size: 14px;
  color: var(--muted);
  transition: color var(--transition);
  font-weight: 500;
}

.site-nav ul a:hover {
  color: var(--accent);
}

.nav-end {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── Sidebar (paneles) ──────────────────────────── */
.sidebar {
  width: 260px;
  min-height: 100vh;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
}

.sidebar-logo {
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  font-family: var(--font-pixel);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-dark);
  border-bottom: 3px solid var(--accent);
  letter-spacing: -0.5px;
}

[data-theme="dark"] .sidebar-logo {
  color: var(--accent);
}

.sidebar-group {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-group-label {
  font-family: var(--font-pixel);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  padding: 0 16px 8px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-family: var(--font-pixel);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  user-select: none;
}

.sidebar-item:hover {
  color: var(--text);
  background: var(--surface-2);
}

.sidebar-item.active {
  color: var(--accent-dark);
  background: var(--accent-light);
  border-left-color: var(--accent);
  font-weight: 700;
}

[data-theme="dark"] .sidebar-item.active {
  color: var(--text);
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 2px solid var(--border);
}

.sidebar-user {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.sidebar-user strong {
  display: block;
  font-family: var(--font-pixel);
  color: var(--text);
  font-size: 13px;
  margin-bottom: 4px;
}

/* ── Selector de tipo de servidor ───────────────── */
.server-type-selector {
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
}

.server-type-selector label {
  font-family: var(--font-pixel);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.server-type-selector select {
  font-family: var(--font-pixel);
  font-size: 12px;
  width: 100%;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
}

.server-type-selector select:hover {
  border-color: var(--accent);
}

/* ── Main content ───────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-header {
  height: 64px;
  padding: 0 28px;
  border-bottom: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 16px;
}

.main-header h1 {
  font-family: var(--font-pixel);
  font-size: 15px;
  font-weight: 700;
  flex: 1;
}

.content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
  background: var(--bg);
}

/* ── Status pill ────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-family: var(--font-pixel);
  padding: 5px 12px;
  border-radius: 99px;
  border: 2px solid var(--border);
  background: var(--surface);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.online {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  animation: blink 2s infinite;
}

.status-dot.offline {
  background: var(--danger);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Controles del servidor ─────────────────────── */
.srv-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

/* ── Grid de estadísticas ───────────────────────── */
.card-row, .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.stat-card {
  padding: 16px 20px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  text-align: center;
}

.stat-card:last-child {
  border-right: none;
}

.stat-card .sc-label, .stat-card .stat-label {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-card .sc-val, .stat-card .stat-value {
  font-family: var(--font-pixel);
  font-size: 22px;
  font-weight: 700;
}

.stat-value.green, .sc-val.green { color: var(--accent); }
.stat-value.red, .sc-val.red   { color: var(--danger); }
.stat-value.gold, .sc-val.gold  { color: #d97706; }

/* ── Formularios ────────────────────────────────── */
input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
  transition: border-color var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

select option {
  background: var(--surface);
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-pixel);
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.form-group, .fgroup {
  margin-bottom: 16px;
}

/* ── Grid de configuración ──────────────────────── */
.config-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* ── Toggle switches ────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: all var(--transition);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--muted);
  border-radius: 50%;
  transition: all var(--transition);
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent-dark);
}

.toggle input:checked + .toggle-track::after {
  left: 20px;
  background: #fff;
}

/* ── Filas de información ───────────────────────── */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .ir-label, .info-row .info-label {
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: 11px;
}

/* ── Consola ────────────────────────────────────── */
.console-out {
  background: #0a0a0a;
  color: var(--accent);
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  padding: 14px;
  height: 280px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.console-out::-webkit-scrollbar {
  width: 6px;
}

.console-out::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 3px;
}

.console-out::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.cmd-row {
  display: flex;
  gap: 10px;
}

.cmd-row input {
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

/* ── Tabla de jugadores ─────────────────────────── */
.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.player-row:last-child {
  border-bottom: none;
}

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.player-info {
  flex: 1;
}

.player-name {
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-pixel);
}

.player-meta {
  font-size: 11px;
  color: var(--muted);
}

.player-actions {
  display: flex;
  gap: 6px;
}

/* ── Gestor de archivos ─────────────────────────── */
.file-path {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
  margin-bottom: 14px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: color var(--transition);
}

.file-row:hover {
  color: var(--accent);
}

.file-row:last-child {
  border-bottom: none;
}

.file-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.file-name {
  flex: 1;
  font-size: 13px;
  font-family: monospace;
}

.file-size {
  font-size: 11px;
  color: var(--muted);
}

/* ── Copias de seguridad ────────────────────────── */
.backup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.backup-row:last-child {
  border-bottom: none;
}

.backup-info {
  flex: 1;
}

.backup-name {
  font-size: 13px;
  font-weight: 600;
}

.backup-date {
  font-size: 11px;
  color: var(--muted);
}

.backup-size {
  font-size: 11px;
  color: var(--muted);
  width: 70px;
  text-align: right;
}

/* ── Barra de progreso ──────────────────────────── */
.progress-bar {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}

/* ── Toast notifications ────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-family: var(--font-pixel);
  font-size: 12px;
  display: none;
  z-index: 999;
  box-shadow: var(--shadow-md);
  max-width: 320px;
}

/* ── Footer ─────────────────────────────────────── */
footer {
  border-top: 3px solid var(--accent);
  padding: 36px 40px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  transition: background var(--transition);
}

.footer-logo {
  font-family: var(--font-pixel);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-dark);
}

[data-theme="dark"] .footer-logo {
  color: var(--accent);
}

.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  font-size: 12px;
  color: var(--muted);
  transition: color var(--transition);
  font-family: var(--font-pixel);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-copy {
  font-size: 11px;
  color: var(--muted);
}

/* ── Botón volver arriba ────────────────────────── */
#scrollTopBtn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--accent-dark);
  border-radius: var(--radius-sm);
  font-size: 18px;
  font-family: var(--font-pixel);
  cursor: pointer;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
}

#scrollTopBtn.visible {
  opacity: 1;
  pointer-events: auto;
}

#scrollTopBtn:hover {
  opacity: 0.9;
  transform: translateY(-3px);
}

/* ── Menú móvil (hamburguesa) ───────────────────── */
.nav-mobile-menu {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 3px solid var(--accent);
  padding: 8px 0;
  z-index: 49;
  flex-direction: column;
  box-shadow: var(--shadow-md);
}

.nav-mobile-menu a {
  display: block;
  padding: 12px 20px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}

.nav-mobile-menu a:last-child {
  border-bottom: none;
}

.nav-mobile-menu a:hover {
  color: var(--accent);
  background: var(--surface-2);
}

.nav-mobile-menu.open {
  display: flex;
}

.btn-hamburger {
  display: none;
  background: none;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 18px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.btn-hamburger:hover {
  border-color: var(--accent);
}

/* ── Overlay para sidebar móvil ─────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
}

.sidebar-overlay.open {
  display: block;
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .site-nav {
    padding: 0 16px;
    gap: 8px;
    position: relative;
  }
  
  .site-nav ul {
    display: none;
  }
  
  .btn-hamburger {
    display: flex;
  }
  
  .nav-end {
    gap: 6px;
  }
  
  .nav-end .btn-ghost {
    display: none;
  }
  
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    z-index: 100;
    transition: left 0.25s ease;
    height: 100%;
    overflow-y: auto;
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .main {
    width: 100%;
  }
  
  .main-header {
    padding: 0 14px;
    gap: 10px;
  }
  
  .content {
    padding: 16px;
  }
  
  .config-grid {
    grid-template-columns: 1fr;
  }
  
  .card-row, .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stat-card {
    border-bottom: 1px solid var(--border);
    border-right: none;
  }
  
  .stat-card:nth-child(even) {
    border-right: none;
  }
  
  .srv-controls {
    flex-wrap: wrap;
  }
  
  .backup-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .backup-size {
    width: auto;
  }
  
  .section-top {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .player-actions {
    flex-wrap: wrap;
  }
  
  .console-out {
    height: 200px;
  }
  
  footer {
    padding: 24px 16px;
  }
  
  .footer-links {
    gap: 12px;
  }
}