/* ============================================================
   🎨 LINKHUB - ESTILOS
   ============================================================ */

/* --- VARIABLES POR DEFECTO --- */
:root {
  --bg-top: #e74c3c;
  --bg-bottom: #c0392b;
  --btn-bg: #ffffff;
  --btn-text: #1a1a1a;
  --btn-border: #1a1a1a;
  --btn-hover-bg: #1a1a1a;
  --btn-hover-text: #ffffff;
  --name-color: #ffffff;
  --bio-color: #ffffffcc;
  --icon-color: #ffffff;
  --avatar-border: #ffffff;
  --font-name: 'Bebas Neue', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-buttons: 'Outfit', sans-serif;
  --btn-radius: 50px;
}

/* --- RESET --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ============================================================
   PÁGINA PÚBLICA
   ============================================================ */

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: linear-gradient(165deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  font-family: var(--font-body);
  padding: 50px 20px;
  overflow-x: hidden;
}

/* Textura sutil de fondo */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 20%, rgba(255,255,255,0.09) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(0,0,0,0.08) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* --- CONTENEDOR PRINCIPAL --- */
.container {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  animation: containerIn 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes containerIn {
  from { opacity: 0; transform: translateY(40px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- AVATAR --- */
.avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.avatar {
  width: 115px;
  height: 115px;
  border-radius: 50%;
  border: 4px solid var(--avatar-border);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.25),
    0 0 0 8px rgba(255,255,255,0.08);
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar:hover {
  transform: scale(1.08) rotate(2deg);
}

.avatar-placeholder {
  width: 115px;
  height: 115px;
  border-radius: 50%;
  border: 4px solid var(--avatar-border);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.25),
    0 0 0 8px rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: var(--name-color);
  font-family: var(--font-name);
  user-select: none;
}

/* --- PERFIL --- */
.profile-info {
  text-align: center;
  margin-bottom: 24px;
}

.profile-name {
  font-family: var(--font-name);
  font-size: 2.6rem;
  color: var(--name-color);
  letter-spacing: 3px;
  text-shadow: 0 3px 12px rgba(0,0,0,0.2);
  line-height: 1.05;
}

.profile-bio {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--bio-color);
  margin-top: 6px;
  font-weight: 300;
  letter-spacing: 0.5px;
}

/* --- ICONOS SOCIALES --- */
.social-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.social-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--icon-color);
  text-decoration: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(6px);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.social-icon:hover {
  transform: translateY(-5px) scale(1.15);
  background: rgba(255,255,255,0.28);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

.social-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* --- BOTONES DE ENLACES --- */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 26px;
  background: var(--btn-bg);
  color: var(--btn-text);
  text-decoration: none;
  border-radius: var(--btn-radius);
  font-family: var(--font-buttons);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  border: 2px solid var(--btn-border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.link-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: left 0.55s ease;
}

.link-btn:hover::before {
  left: 100%;
}

.link-btn:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  border-color: var(--btn-hover-bg);
}

.link-btn:active {
  transform: translateY(0) scale(0.98);
}

.link-btn .btn-ico {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-btn .btn-ico svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* Animación escalonada de entrada */
.link-btn { opacity: 0; animation: linkSlide 0.5s ease-out forwards; }
.link-btn:nth-child(1)  { animation-delay: 0.08s; }
.link-btn:nth-child(2)  { animation-delay: 0.16s; }
.link-btn:nth-child(3)  { animation-delay: 0.24s; }
.link-btn:nth-child(4)  { animation-delay: 0.32s; }
.link-btn:nth-child(5)  { animation-delay: 0.40s; }
.link-btn:nth-child(6)  { animation-delay: 0.48s; }
.link-btn:nth-child(7)  { animation-delay: 0.56s; }
.link-btn:nth-child(8)  { animation-delay: 0.64s; }
.link-btn:nth-child(9)  { animation-delay: 0.72s; }
.link-btn:nth-child(10) { animation-delay: 0.80s; }

@keyframes linkSlide {
  from { opacity: 0; transform: translateX(-28px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* --- FOOTER --- */
.page-footer {
  text-align: center;
  margin-top: 44px;
  padding: 20px;
  color: rgba(255,255,255,0.3);
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.footer-logo {
  height: 20px;
  width: auto;
  vertical-align: middle;
  margin-left: 4px;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.footer-logo:hover {
  opacity: 0.8;
}

/* --- QR CODE --- */
.qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 36px;
  padding-top: 30px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.qr-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 14px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.18),
    0 0 0 4px rgba(255,255,255,0.08);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  line-height: 0;
}

.qr-box:hover {
  transform: scale(1.05);
}

.qr-box canvas {
  border-radius: 8px;
  display: block;
}

.qr-label {
  margin-top: 14px;
  color: rgba(255,255,255,0.4);
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: var(--font-body);
}


/* ============================================================
   ADMIN: BOTÓN TRIGGER
   ============================================================ */

.admin-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  z-index: 100;
  display: none;  /* Oculto por defecto, se muestra con ?admin */
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  transition: all 0.35s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.admin-trigger.visible {
  display: flex;
}

.admin-trigger:hover {
  transform: scale(1.1) rotate(90deg);
  background: rgba(0,0,0,0.8);
  color: white;
  border-color: rgba(255,255,255,0.3);
}


/* ============================================================
   ADMIN: OVERLAY
   ============================================================ */

.admin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.admin-overlay.open {
  opacity: 1;
  pointer-events: all;
}


/* ============================================================
   ADMIN: LOGIN
   ============================================================ */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
}

.login-screen.open {
  display: flex;
}

.login-box {
  background: #16213e;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 40px 36px;
  width: 360px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: loginPop 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes loginPop {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.login-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.login-box h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  color: #fff;
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.login-box > p {
  color: #888;
  font-size: 0.82rem;
  margin-bottom: 22px;
}

.login-input-wrap {
  display: flex;
  gap: 8px;
}

.login-input-wrap input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-input-wrap input:focus {
  border-color: #f39c12;
}

.login-input-wrap button {
  padding: 12px 22px;
  border: none;
  border-radius: 12px;
  background: #f39c12;
  color: #1a1a1a;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.login-input-wrap button:hover {
  background: #f1c40f;
  transform: translateY(-1px);
}

.login-error {
  color: #e74c3c;
  font-size: 0.8rem;
  margin-top: 12px;
  min-height: 1.2em;
}

.login-hint {
  color: #555;
  font-size: 0.72rem;
  margin-top: 16px;
}

.login-hint code {
  background: rgba(255,255,255,0.08);
  padding: 2px 8px;
  border-radius: 4px;
  color: #f39c12;
}


/* ============================================================
   ADMIN: PANEL
   ============================================================ */

.admin-panel {
  position: fixed;
  top: 0;
  right: -500px;
  width: 470px;
  max-width: 92vw;
  height: 100vh;
  background: #0f0f23;
  color: #d0d0d0;
  z-index: 960;
  display: flex;
  flex-direction: column;
  transition: right 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -12px 0 50px rgba(0,0,0,0.5);
}

.admin-panel.open {
  right: 0;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.admin-header h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  color: #fff;
  letter-spacing: 3px;
}

.admin-subtitle {
  font-size: 0.75rem;
  color: #666;
  margin-top: 2px;
}

.admin-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: #888;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.admin-close:hover {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.3);
}

.admin-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  padding: 24px 28px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.admin-body::-webkit-scrollbar {
  width: 6px;
}

.admin-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

/* --- SECCIONES --- */
.cfg-section {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.cfg-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #f39c12;
  margin-bottom: 14px;
  font-weight: 600;
}

.cfg-hint {
  font-size: 0.75rem;
  color: #555;
  margin-bottom: 12px;
  line-height: 1.5;
}

.cfg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 11px;
}

.cfg-row label {
  font-size: 0.82rem;
  min-width: 130px;
  color: #aaa;
  flex-shrink: 0;
}

.cfg-row input[type="text"],
.cfg-row input[type="url"],
.cfg-row input[type="password"],
.cfg-row select {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.2s;
}

.cfg-row select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.cfg-row select option {
  background: #1a1a2e;
  color: #fff;
  padding: 8px;
}

.cfg-row input:focus,
.cfg-row select:focus {
  border-color: #f39c12;
  background: rgba(255,255,255,0.06);
}

/* Grid de colores */
.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.color-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.05);
}

.color-item label {
  font-size: 0.75rem;
  color: #999;
  flex: 1;
}

.color-item input[type="color"] {
  width: 36px;
  height: 30px;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 1px;
  flex-shrink: 0;
}

/* --- EDITOR DE ENLACES --- */
.link-editor {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
}

.link-editor-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.link-editor-row:last-child {
  margin-bottom: 0;
}

.link-editor input,
.link-editor select {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
}

.link-editor input:focus,
.link-editor select:focus {
  border-color: #f39c12;
}

.link-editor select {
  min-width: 105px;
  flex: 0 0 auto;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.link-editor select option {
  background: #1a1a2e;
  color: #fff;
}

.btn-del {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-del:hover {
  background: #e74c3c;
  color: white;
}

.btn-add {
  width: 100%;
  padding: 13px;
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: 12px;
  background: transparent;
  color: #666;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.25s;
}

.btn-add:hover {
  border-color: #f39c12;
  color: #f39c12;
  background: rgba(243, 156, 18, 0.04);
}

/* --- BOTONES PEQUEÑOS --- */
.btn-small {
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-warning {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border: 1px solid rgba(243, 156, 18, 0.2);
}

.btn-warning:hover {
  background: #f39c12;
  color: #1a1a1a;
}

/* --- BOTONES EXPORTAR --- */
.export-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-export {
  flex: 1;
  min-width: 130px;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-green  { background: #27ae60; color: white; }
.btn-green:hover { background: #2ecc71; transform: translateY(-2px); box-shadow: 0 4px 20px rgba(39, 174, 96, 0.4); }

.btn-blue   { background: #2980b9; color: white; }
.btn-blue:hover { background: #3498db; transform: translateY(-2px); }

.btn-orange { background: #d35400; color: white; flex-basis: 100%; }
.btn-orange:hover { background: #e67e22; transform: translateY(-2px); }


/* ============================================================
   TOAST
   ============================================================ */

.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(15, 15, 35, 0.92);
  color: white;
  padding: 12px 30px;
  border-radius: 50px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 520px) {
  body { padding: 32px 16px; }
  .container { max-width: 100%; }
  .profile-name { font-size: 2.1rem; }
  .link-btn { padding: 14px 20px; font-size: 0.9rem; }
  .admin-panel { width: 100vw; max-width: 100vw; }
  .admin-body { padding: 20px; }
  .cfg-row { flex-wrap: wrap; }
  .cfg-row label { min-width: 100%; margin-bottom: -4px; }
  .color-grid { grid-template-columns: 1fr; }
  .login-box { padding: 30px 24px; }
}