/* =====================
   CSS VARIABLES
===================== */
:root {
  --green: #4ade80;
  --green-dark: #16a34a;
  --red: #f87171;
  --yellow: #fbbf24;
  --blue: #60a5fa;
  --bg: #0a0a0a;
  --surface: rgba(15, 15, 15, 0.92);
  --surface2: rgba(30, 30, 30, 0.85);
  --border: rgba(74, 222, 128, 0.2);
  --border-bright: rgba(74, 222, 128, 0.5);
  --text: #e5e7eb;
  --text-dim: #9ca3af;
  --header-bg: rgba(5, 5, 5, 0.97);
  --home-bg: rgba(0,0,0,0.65);
  --section-bg: rgba(0,0,0,0.75);
  --font-pixel: 'Press Start 2P', monospace;
  --font-body: 'Rajdhani', sans-serif;
  --radius: 6px;
  --transition: 0.2s ease;
}

/* MODO CLARO */
body.light {
  --bg: #f0f4f0;
  --surface: rgba(255,255,255,0.96);
  --surface2: rgba(240,244,240,0.95);
  --border: rgba(22,163,74,0.25);
  --border-bright: rgba(22,163,74,0.5);
  --text: #1a2e1a;
  --text-dim: #4b6b4b;
  --header-bg: rgba(255,255,255,0.97);
  --home-bg: rgba(255,255,255,0.55);
  --section-bg: rgba(240,244,240,0.88);
  --green: #16a34a;
  --green-dark: #15803d;
}
body.light input, body.light select, body.light textarea {
  background: rgba(0,0,0,0.04);
  color: var(--text);
}
body.light select option { background: #f0f4f0; color: #1a2e1a; }

/* =====================
   LOADING SCREEN
===================== */
.loading-screen {
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.loading-screen.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 320px;
}
.loading-logo {
  font-family: var(--font-pixel);
  font-size: clamp(14px, 3vw, 22px);
  letter-spacing: 1px;
  animation: loadingPulse 1.5s ease infinite;
}
@keyframes loadingPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
.loading-sub {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.loading-bar-wrap {
  width: 100%;
  height: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  border-radius: 2px;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px var(--green);
}
.loading-percent {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--green);
  letter-spacing: 2px;
}
.loading-blocks {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.loading-block {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  animation: blockBounce 0.8s ease infinite;
}
@keyframes blockBounce {
  0%, 100% { transform: translateY(0);    opacity: 1; }
  50%       { transform: translateY(-10px); opacity: 0.7; }
}

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

body {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text);
  background-color: var(--bg);
  background-image: url("fondo.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100vh;
}

/* =====================
   HEADER
===================== */
.header {
  position: fixed;
  top: 0;
  width: 100%;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  height: 60px;
  z-index: 1000;
  backdrop-filter: blur(10px);
  transition: background 0.3s;
}

/* =====================
   LOGO
===================== */
.logo, .home-logo-big {
  font-family: var(--font-pixel);
  font-size: 14px;
  letter-spacing: 1px;
  white-space: nowrap;
}
.home-logo-big {
  font-size: clamp(18px, 4vw, 32px);
  margin-bottom: 12px;
  animation: fadeDown 0.7s ease both;
}
.logo-bracket { color: var(--text-dim); }
.logo-accent { color: var(--green); }

/* =====================
   NAV
===================== */
#menu {
  display: none;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
nav a {
  color: var(--text-dim);
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
  border: none;
  background: transparent;
  text-transform: uppercase;
}
nav a:hover, nav a:focus {
  color: var(--green);
  background: rgba(74, 222, 128, 0.08);
  outline: none;
}
nav a.nav-salir {
  color: var(--red);
  margin-left: 8px;
}
nav a.nav-salir:hover {
  color: #fff;
  background: rgba(248, 113, 113, 0.15);
}

/* Hamburger */
.hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 20px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: var(--radius);
}

/* Header right group */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Theme toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color var(--transition), background var(--transition);
  line-height: 1;
}
.theme-toggle:hover {
  border-color: var(--border-bright);
  background: rgba(74,222,128,0.08);
}

/* =====================
   HOME
===================== */
.home {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: var(--home-bg);
  position: relative;
  overflow: hidden;
  transition: background 0.3s;
}
.home-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.home-sub {
  color: var(--text-dim);
  font-size: 18px;
  font-weight: 400;
  margin-bottom: 24px;
  letter-spacing: 1px;
  animation: fadeDown 0.7s 0.2s ease both;
}
.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  animation: fadeDown 0.7s 0.4s ease both;
}

/* Particles */
.particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--green);
  opacity: 0;
  border-radius: 1px;
  animation: floatParticle linear infinite;
}

@keyframes floatParticle {
  0%   { opacity: 0; transform: translateY(100vh) rotate(0deg); }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-10vh) rotate(360deg); }
}

/* =====================
   BUTTONS
===================== */
.btn {
  padding: 12px 28px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--radius);
  border: 2px solid transparent;
  transition: all var(--transition);
  min-width: 200px;
}
.btn-primary {
  background: var(--green);
  color: #000;
  border-color: var(--green);
}
.btn-primary:hover {
  background: transparent;
  color: var(--green);
}
.btn-secondary {
  background: transparent;
  color: var(--green);
  border-color: var(--border-bright);
}
.btn-secondary:hover {
  background: rgba(74, 222, 128, 0.1);
  border-color: var(--green);
}
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: rgba(156,163,175,0.3);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.btn-green {
  background: var(--green);
  color: #000;
  border-color: var(--green);
  min-width: unset;
  padding: 10px 20px;
  font-weight: 700;
}
.btn-green:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-red {
  background: transparent;
  color: var(--red);
  border-color: rgba(248,113,113,0.4);
  min-width: unset;
  padding: 10px 20px;
  font-weight: 700;
}
.btn-red:hover { background: rgba(248,113,113,0.1); border-color: var(--red); }

/* =====================
   OVERLAY / MODAL (forms)
===================== */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 999;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  animation: fadeUp 0.3s ease;
}
.modal-title {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--green);
  margin-bottom: 24px;
  text-align: center;
}
.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

/* =====================
   INPUTS
===================== */
.input-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
}
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  margin: 6px 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color var(--transition);
  box-sizing: border-box;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
}
input.invalid, textarea.invalid {
  border-color: var(--red);
}
.input-error {
  font-size: 12px;
  color: var(--red);
  min-height: 16px;
  padding-left: 2px;
}
select option { background: #1a1a1a; }
textarea { resize: vertical; min-height: 100px; }

/* File input */
.file-label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin: 10px 0 4px;
  cursor: pointer;
}
.file-label input[type="file"] {
  margin-top: 6px;
  font-size: 13px;
}
.img-preview {
  display: none;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border-bright);
  margin: 10px auto;
}

/* =====================
   SECTIONS
===================== */
.section {
  display: none;
  padding-top: 80px;
  min-height: 100vh;
  background: var(--section-bg);
  transition: background 0.3s;
}
.section-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}
.section-title {
  font-family: var(--font-pixel);
  font-size: clamp(14px, 2.5vw, 22px);
  color: var(--green);
  margin-bottom: 36px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* =====================
   INTRO CARDS
===================== */
.intro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.intro-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 22px;
  transition: border-color var(--transition), transform var(--transition);
}
.intro-card:hover { border-color: var(--border-bright); transform: translateY(-3px); }
.intro-icon { font-size: 32px; display: block; margin-bottom: 14px; }
.intro-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--green); }
.intro-card p { font-size: 15px; color: var(--text-dim); line-height: 1.6; }

/* =====================
   VERSIONS
===================== */
.versions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}
.version-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  position: relative;
  transition: border-color var(--transition);
}
.version-card.selected {
	border: 2px solid #4CAF50;
	background-color: #e8ffe8;
}
.version-card:hover { border-color: var(--border-bright); }
.version-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.version-card p { font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.version-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.version-tag.latest { background: var(--green); color: #000; }

/* =====================
   MODS
===================== */
.mods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}
.mod-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  transition: border-color var(--transition), transform var(--transition);
}
.mod-card:hover { border-color: var(--border-bright); transform: translateY(-3px); }
.mod-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(74, 222, 128, 0.15);
  color: var(--green);
  border: 1px solid var(--border-bright);
  margin-bottom: 10px;
}
.mod-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.mod-card p { font-size: 14px; color: var(--text-dim); line-height: 1.5; }

/* =====================
   SERVER PANEL
===================== */
.server-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.server-panel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.server-panel-wide {
  grid-column: 1 / -1;
}
.panel-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.select-styled {
  cursor: pointer;
}

/* Status */
.status-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}
.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  transition: background 0.3s;
  flex-shrink: 0;
}
.status-dot.on {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 1.5s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Timer */
.timer-display {
  font-family: var(--font-pixel);
  font-size: 20px;
  color: var(--green);
  letter-spacing: 2px;
  padding: 10px 0;
}

/* Server buttons */
.server-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Stats */
.stat-big {
  font-family: var(--font-pixel);
  font-size: 36px;
  color: var(--green);
  line-height: 1;
}

/* XP Bar */
.xp-bar-wrap {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}
.xp-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  border-radius: 4px;
  width: 0%;
  transition: width 0.5s ease;
}

/* Inventory */
.inventario-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  min-height: 48px;
}
.inventario-grid li {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--green);
  animation: fadeUp 0.2s ease;
}

/* =====================
   CONTACT
===================== */
.contact-wrap {
  max-width: 520px;
}
.contact-success {
  color: var(--green);
  font-weight: 600;
  margin-top: 12px;
  font-size: 15px;
  min-height: 20px;
}

/* =====================
   PROFILE
===================== */
.profile-card {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.profile-img-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}
.profile-img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-bright);
  background: var(--surface2);
  display: block;
}
.profile-img-edit {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: var(--green);
  color: #000;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  border: 2px solid var(--bg);
}
.profile-img-edit input { display: none; }
.profile-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
}
.profile-info p {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dim);
}
.profile-info p span {
  color: var(--text);
  font-weight: 700;
}

/* =====================
   CHAT
===================== */
.chat-layout {
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.chat-box::-webkit-scrollbar { width: 6px; }
.chat-box::-webkit-scrollbar-track { background: transparent; }
.chat-box::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: fadeUp 0.2s ease;
  max-width: 80%;
}
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.other { align-self: flex-start; align-items: flex-start; }
.chat-msg.system { align-self: center; align-items: center; max-width: 100%; }

.chat-author {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}
.chat-msg.mine .chat-author { color: var(--green); }

.chat-bubble {
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
}
.chat-msg.mine .chat-bubble {
  background: var(--green);
  color: #000;
  border-bottom-right-radius: 3px;
}
.chat-msg.other .chat-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 3px;
}
.chat-msg.system .chat-bubble {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  border-radius: 20px;
  padding: 5px 16px;
}

.chat-time {
  font-size: 10px;
  color: var(--text-dim);
  padding: 0 4px;
}

.chat-input-row {
  display: flex;
  gap: 10px;
}
.chat-input-row input {
  margin: 0;
  flex: 1;
}
.chat-send-btn {
  min-width: unset;
  padding: 10px 22px;
  white-space: nowrap;
}
.chat-hint {
  font-size: 13px;
  color: var(--text-dim);
}

/* =====================
   ANIMATIONS
===================== */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =====================
   RESPONSIVE
===================== */
@media (max-width: 768px) {
  .header { padding: 16px; }
  .hamburger { display: block; }
  .header-right { gap: 6px; }
  #menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    width: 95%;
    background: var(--header-bg);
    flex-direction: column;
    padding: 10px;
    border-bottom: 1px solid var(--border);
    z-index: 999;
    gap: 0;
  }
  #menu.open { display: flex; }
  #menu.menu-visible { display: flex; }
  #menu.menu-visible.open { display: flex; }
  nav a { padding: 12px 24px; border-radius: 0; font-size: 16px; }

  .home-buttons .btn { min-width: 260px; }
  .modal { margin: 16px; max-width: 100%; }
  .section-inner { padding: 32px 16px 48px; }
  .profile-card { flex-direction: column; align-items: center; text-align: center; }
  .server-layout { grid-template-columns: 1fr; }
  .server-panel-wide { grid-column: 1; }
  .chat-input-row { flex-direction: column; }
  .chat-send-btn { width: 100%; }
}

/* Mod seleccionable */
.mod-card.selectable-mod {
  cursor: pointer;
  position: relative;
  transition: border-color var(--transition), transform var(--transition);
}
.mod-card.selectable-mod:hover {
  border-color: var(--border-bright);
  transform: translateY(-3px);
}
.mod-card.selectable-mod.selected {
  border-color: var(--green);
  background: rgba(74, 222, 128, 0.07);
}

/* Tick de seleccionado (oculto por defecto) */
.mod-check {
  display: none;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
}
.mod-card.selected .mod-check {
  display: block;
}

/* Botón e indicador de estado */
.mods-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.mods-status {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dim);
}

.mods-category {
	margin-bottom: 2.5rem;
}

.intro-item {
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 2rem;
}

.intro-item h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: #4ade80;
}

.intro-item p {
  font-size: 1rem;
  line-height: 1.7;
  margin: 0;
  color: #e0e0e0;
}
.version-card.selected h3,
.version-card.selected p,
.selectable-version.selected h3,
.selectable-version.selected p,
.selectable.selected h3,
.selectable.selected p {
  color: #1a1a1a;
}
