/* ==========================================================================
   COLIGUA PORTAL - ESTILOS PRINCIPALES (MINIMAL CON BOTÓN DINÁMICO)
   ========================================================================== */

:root {
  --theme-header-bg: linear-gradient(180deg, #3d60a2 0%, #254480 100%);
  --theme-primary: #3d60a2;
  --theme-primary-dark: #254480;
  --theme-search-bg: #6a8cce;
  --theme-accent-text: #1f3664;
  
  --theme-btn-glass: rgba(61, 96, 162, 0.2);
  --theme-btn-glass-hover: rgba(61, 96, 162, 0.35);
  --theme-btn-border: rgba(96, 165, 250, 0.4);

  --bg-dark: #0f172a;
  --bg-light: #f8fafc;
  --card-bg-dark: rgba(30, 41, 59, 0.7);
  --card-bg-light: rgba(255, 255, 255, 0.8);
  --border-dark: rgba(255, 255, 255, 0.08);
  --border-light: rgba(0, 0, 0, 0.08);
  --text-dark: #f8fafc;
  --text-light: #0f172a;
  --text-muted-dark: #94a3b8;
  --text-muted-light: #64748b;

  --bg-color: var(--bg-dark);
  --card-bg: var(--card-bg-dark);
  --border-color: var(--border-dark);
  --text-color: var(--text-dark);
  --text-muted: var(--text-muted-dark);
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-speed: 0.3s;
}

[data-theme="esmeralda"] {
  --theme-header-bg: linear-gradient(180deg, #2e8b57 0%, #195333 100%);
  --theme-primary: #2e8b57;
  --theme-primary-dark: #195333;
  --theme-btn-glass: rgba(46, 139, 87, 0.2);
  --theme-btn-glass-hover: rgba(46, 139, 87, 0.35);
  --theme-btn-border: rgba(52, 211, 153, 0.4);
}
[data-theme="carmesi"] {
  --theme-header-bg: linear-gradient(180deg, #b03a3a 0%, #751c1c 100%);
  --theme-primary: #b03a3a;
  --theme-primary-dark: #751c1c;
  --theme-btn-glass: rgba(176, 58, 58, 0.2);
  --theme-btn-glass-hover: rgba(176, 58, 58, 0.35);
  --theme-btn-border: rgba(248, 113, 113, 0.4);
}
[data-theme="morado"] {
  --theme-header-bg: linear-gradient(180deg, #7e41b5 0%, #492070 100%);
  --theme-primary: #7e41b5;
  --theme-primary-dark: #492070;
  --theme-btn-glass: rgba(126, 65, 181, 0.2);
  --theme-btn-glass-hover: rgba(126, 65, 181, 0.35);
  --theme-btn-border: rgba(192, 132, 252, 0.4);
}
[data-theme="dorado"] {
  --theme-header-bg: linear-gradient(180deg, #b8860b 0%, #785602 100%);
  --theme-primary: #b8860b;
  --theme-primary-dark: #785602;
  --theme-btn-glass: rgba(184, 134, 11, 0.2);
  --theme-btn-glass-hover: rgba(184, 134, 11, 0.35);
  --theme-btn-border: rgba(251, 191, 36, 0.4);
}
[data-theme="carbon"] {
  --theme-header-bg: linear-gradient(180deg, #383838 0%, #1c1c1c 100%);
  --theme-primary: #383838;
  --theme-primary-dark: #1c1c1c;
  --theme-btn-glass: rgba(56, 56, 56, 0.3);
  --theme-btn-glass-hover: rgba(56, 56, 56, 0.5);
  --theme-btn-border: rgba(255, 255, 255, 0.2);
}

[data-theme-mode="light"] {
  --bg-color: var(--bg-light);
  --card-bg: var(--card-bg-light);
  --border-color: var(--border-light);
  --text-color: var(--text-light);
  --text-muted: var(--text-muted-light);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.bg-glows {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.glow-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  animation: float 20s infinite alternate ease-in-out;
}
.glow-1 {
  width: 500px;
  height: 500px;
  background: var(--theme-primary);
  top: 15%;
  left: 15%;
}
.glow-2 {
  width: 500px;
  height: 500px;
  background: var(--theme-primary-dark);
  bottom: 15%;
  right: 15%;
  animation-delay: -5s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 5%) scale(1.05); }
  100% { transform: translate(-5%, -5%) scale(0.95); }
}

/* ================= CABECERA SUPERIOR ================= */
.top-header {
  background: var(--theme-header-bg);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 100;
  transition: background var(--transition-speed) ease;
}

.logo-text {
  color: #ffffff;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 1px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-btn-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease;
}

.theme-btn-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* ================= CENTER LAYOUT ================= */
.portal-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 10;
}

.portal-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.portal-title {
  font-size: 4.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(135deg, var(--text-color) 30%, var(--theme-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.portal-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Dynamic Interactive Central Layout */
.portal-interactive-area {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 320px;
  gap: 0;
  transition: gap 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-interactive-area.expanded {
  gap: 2rem;
}

/* 3D Central Logo Container */
.center-logo-wrapper {
  perspective: 1000px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-card-3d {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.06), transparent 70%);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out, border-color 0.3s;
  cursor: pointer;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.logo-card-3d:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.logo-card-3d::after {
  content: '';
  position: absolute;
  width: 130%;
  height: 130%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.06);
  animation: spin 60s linear infinite;
  pointer-events: none;
}

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

.logo-img {
  width: 170px;
  height: 170px;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.4));
  transform: translateZ(50px);
  transition: filter 0.3s ease;
  pointer-events: none; /* Make sure click goes through to the parent card */
}

.logo-card-3d:hover .logo-img {
  filter: drop-shadow(0 15px 30px rgba(59, 130, 246, 0.5));
}

/* Sliding / Expanding Buttons Container */
.buttons-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateX(-20px);
  pointer-events: none;
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: max-width 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.4s ease,
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-interactive-area.expanded .buttons-container {
  max-width: 280px;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.slide-button {
  width: 240px; /* fixed width inside container so text doesn't wrap during transition */
  white-space: nowrap;
  background: var(--theme-btn-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-color);
  padding: 1.1rem 1.8rem;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 750;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transform-style: preserve-3d;
  transition: background 0.3s, 
              border-color 0.3s,
              box-shadow 0.3s,
              transform 0.1s ease-out;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--theme-btn-border);
}

.slide-button:hover {
  background: var(--theme-btn-glass-hover);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25), 0 0 15px var(--theme-btn-border);
  border-color: var(--text-color);
}

/* Wiki button - slightly smaller */
.slide-button.btn-wiki {
  padding: 0.8rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* ================= THEME MODAL ================= */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 24px;
  width: 90%;
  max-width: 440px;
  color: #ffffff;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #ffffff;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.theme-option {
  background: #0f172a;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  transition: all 0.2s;
}

.theme-option:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.theme-option.active {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.theme-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.swatch-azul { background: linear-gradient(135deg, #3d60a2, #254480); }
.swatch-esmeralda { background: linear-gradient(135deg, #2e8b57, #195333); }
.swatch-carmesi { background: linear-gradient(135deg, #b03a3a, #751c1c); }
.swatch-morado { background: linear-gradient(135deg, #7e41b5, #492070); }
.swatch-dorado { background: linear-gradient(135deg, #b8860b, #785602); }
.swatch-carbon { background: linear-gradient(135deg, #383838, #1c1c1c); }

.theme-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.mode-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
}

.mode-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #475569;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #3b82f6;
}

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

/* ================= FOOTER ================= */
.portal-footer {
  text-align: center;
  padding: 2rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  z-index: 10;
  margin-top: auto;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 600px) {
  .portal-interactive-area {
    flex-direction: column;
  }
  .portal-interactive-area.expanded {
    gap: 1.5rem;
  }
  .buttons-container {
    transform: translateY(-15px);
  }
  .portal-interactive-area.expanded .buttons-container {
    transform: translateY(0);
  }
}
