/* ==========================================================
   MODAL OVERLAY GENÉRICA
   ========================================================== */

.modal-mago-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top:40px;
    padding-bottom:40px;
    background: rgba(0, 0, 0, 0.65);
    
    overflow-y:auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 50;
}

.modal-mago-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-mago-backdrop {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(4px);
}


/* ==========================================================
   MODAL DEL MAGO
   ========================================================== */

.modal-mago-window{
    position: relative;
    max-width: 960px;
    width: 90%;
    padding: 24px 26px 26px;
    z-index: 51;
    font-family: "Quintessential", serif;
    min-height: 550px;
    height:660px;
    background: #f3e8cf;
    background-image: url('../images/pergamino.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    border-radius: 10px;
    border: 3px solid #b88b3f;

    box-shadow:
        0 0 30px rgba(0, 0, 0, 0.85),
        inset 0 0 0 1px #e6d5aa,
        inset 0 0 25px rgba(0, 0, 0, 0.15);

    color: #3b2612;
}

.modal-mago-window::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 10px;
    pointer-events: none;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.20) 0%,
        rgba(255, 255, 255, 0.02) 40%,
        rgba(255, 255, 255, 0.10) 100%
    );
}

#mago-modal.is-open{
    opacity:1;
    pointer-events:auto;
}

#mago-modal .modal-window{
    margin-top:-20px;
    position:relative !important;
}

.mago-window{
    background-image:url("../images/circus.png") !important;
    background-size:cover !important;
    background-position:center !important;
    background-repeat:no-repeat !important;
    border:3px solid #b88b3f;
    border-radius:14px;
    padding:35px;
    width:90%;
    max-width:900px;
    height:660px;
    position:relative;
    max-height:90vh;
}

/* ==========================================================
   LAYOUT MAGO
   ========================================================== */

.mago-content-wrapper{
    display:flex !important;
    flex-direction:row !important;
    justify-content:space-between !important;
    align-items:flex-start !important;
    gap:20px !important;
    width:100% !important;
    height:100% !important;
    padding-left:50px;
    padding-top:50px;
}

.mago-left-panel{
    width:80% !important;
    height:100% !important;
    display:flex !important;
    justify-content:center !important;
    align-items:center !important;
    padding-top: 0;
    z-index:3;
}

.mago-right-panel{
    width:45% !important;
    height:100% !important;
    display:flex !important;
    justify-content:center !important;
    align-items:flex-end !important;
}

.mago-presenter {
    position: absolute !important;
    bottom: 20px !important;     /* AJUSTABLE */
    right: 40px !important;     /* AJUSTABLE */
    height: 520px !important;    /* tamaño ideal */
    width: auto !important;
    object-fit: contain !important;
    display: block !important;
    filter: drop-shadow(0 0 12px rgba(0,0,0,0.6));
    z-index: 5; /* ← queda por delante de todo */
    pointer-events: none;
}

/* ==========================================================
   CAJA TEXTO MAGO
   ========================================================== */

.mago-text-box{
    width:90%;
    max-width:420px;
    min-height: 220px;
    background:rgba(0,0,0,0.65);
    border:2px solid #b88b3f;
    border-radius:14px;
    padding:22px 26px;
    backdrop-filter:blur(6px);
    box-shadow:0 0 30px rgba(0,0,0,0.6);
    text-align:center;
    overflow:visible;
}

#mago-typewriter{
    color:#f5e6c8;
    font-family:"Quintessential",serif;
    font-size:20px;
    line-height:1.6;
}

.mago-click{
    color:#f5e6c8;
    text-decoration:underline;
    cursor:pointer;
}

.fade-out-mago{
    opacity:0;
    transform:translateY(-15px);
    transition:all .6s ease;
    pointer-events:none;
}

/* ==========================================================
   ESFERAS MAGICAS
   ========================================================== */

.orbes{
    position:absolute;
    inset:0;
    opacity:0;
    transition:opacity .6s ease;
    pointer-events:none;
    z-index:5;
    display:none;
}

.orbes.activo{
    opacity:1;
    display:block;
}

.orb{
    position:absolute;
    transform:translate(-50%,-50%);
    pointer-events:auto;
    z-index:10;
}

.orb.roja{
    left:43%;
    top:45%;
}

.orb.azul{
    left:55%;
    top:45%;
}

.bola-roja,
.bola-azul{
    width:80px;
    animation:flotar 4s ease-in-out infinite;
    cursor:pointer;
}

.bola-roja{
    filter:drop-shadow(0 0 18px rgba(255,80,60,0.9));
}

.bola-azul{
    filter:drop-shadow(0 0 18px rgba(120,170,255,0.9));
}

/* HALO */

.bola-roja::after,
.bola-azul::after{
    content:"";
    position:absolute;
    inset:-25px;
    border-radius:50%;
    z-index:-1;
    filter:blur(22px);
    animation:pulso 2.2s ease-in-out infinite;
}

.bola-roja::after{
    background:radial-gradient(circle,
        rgba(255,90,60,1) 0%,
        rgba(255,0,0,0.75) 40%,
        rgba(255,0,0,0.35) 65%,
        transparent 75%);
}

.bola-azul::after{
    background:radial-gradient(circle,
        rgba(120,170,255,1) 0%,
        rgba(0,120,255,0.75) 40%,
        rgba(0,80,255,0.35) 65%,
        transparent 75%);
}

/* TOOLTIP */

.tooltip{
    position:absolute;
    bottom:135%;
    left:50%;
    transform:translateX(-50%) translateY(15px);

    background:linear-gradient(145deg,rgba(15,15,15,0.97),rgba(35,25,10,0.95));
    padding:14px 24px;
    border-radius:14px;

    font-family:"Quintessential",serif;
    font-size:19px;
    text-align:center;
    white-space:nowrap;

    border:1px solid rgba(212,168,79,0.9);

    color:#ffd76a;

    box-shadow:
        0 0 20px rgba(0,0,0,0.8),
        0 0 35px rgba(212,168,79,0.35);

    opacity:0;
    transition:all .35s ease;
    pointer-events:none;
}

.orb:hover .tooltip{
    opacity:1;
    transform:translateX(-50%) translateY(-10px) scale(1.03);
}

.orb.azul .tooltip{
    top:135%;
    bottom:auto;
}

/* ==========================================================
   FORGE PANEL
   ========================================================== */

.forge-roja,
.forge-azul{
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
    display:flex;
    justify-content:flex-start;
    align-items:center;
    pointer-events:none;
    opacity:0;
    padding-left:120px;
    transition:opacity .6s ease;
    z-index:50;
}

.forge-roja.activo,
.forge-azul.activo{
    opacity:1;
    pointer-events:auto;
}

.forge-roja .forge-body,
.forge-azul .forge-body{
    position:relative;
    background:rgba(10,10,10,0.92);
    border:2px solid #b88b3f;
    border-radius:16px;
    padding:28px;
    min-width:360px;
    min-height:240px;
    color:#f5e6c8;
    font-family:"Quintessential", serif;
    text-align:center;
    box-shadow:0 0 30px rgba(0,0,0,0.6);
    z-index:20;
    transform: none !important;
}

.forge-roja .forge-close,
.forge-azul .forge-close{
    position:absolute;
    top:3px;
    right:5px;
    width:12px;
    height:12px;
    border-radius:50%;
    background:#d62828;
    border:none;
    color:white;
    font-size:8px;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
}

/* ============================= */
/* CONTENIDO INTERNO FORGE ROJO */
/* ============================= */

/* Alineamos contenido interno sin tocar forge-body */
.forge-header,
.nivel-selector,
.materiales-wrapper,
.cantidad-wrapper,
.forge-actions,
.resultado-wrapper {
    text-align: left;
    width: 100%;
}

/* Título */
.forge-title {
    font-family: "Quintessential", serif;
    font-size: 18px;
    margin-bottom: 10px;

    color: #ffd76a; /* oro base */

    text-shadow:
        0 0 4px rgba(255,215,100,0.6),
        0 0 8px rgba(212,168,79,0.5);

    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* HEADER */
.forge-header{
  margin-bottom: 8px;
}


/* WRAPPER */
.info-wrapper{
  position: relative;
  display: inline-flex;
  align-items: center;
}


/* BOTÓN I */
.info-btn{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #d4af37; /* borde dorado elegante */

  background: #f4efe6; /* blanco roto */
  color: #111; /* i negra */

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 12px;
  font-weight: bold;

  cursor: pointer;
  padding: 0;

  transition: transform .2s ease, box-shadow .2s ease;
}

.info-btn:hover{
  transform: scale(1.1);
  box-shadow: 0 0 6px rgba(255,255,255,.6);
}


/* TOOLTIP */
.info-tip{
  position: absolute;
  bottom: 26px;                /* aparece arriba */
  left: 50%;
  transform: translateX(-50%) translateY(4px);

  width: 200px;
  padding: 12px 14px;

  background: #f4efe6;         /* blanco roto elegante */
  color: #111;                 /* texto negro */

  border: 1px solid #d4af37;
  border-radius: 12px;

  font-size: 13px;
  text-align: center;

  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;

  z-index: 1000;
}

/* Mostrar tooltip */
.info-btn:hover + .info-tip{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================= */
/* SELECTOR DE NIVEL */
/* ============================= */

.nivel-selector{
  display:flex;
  justify-content: space-between; /* <-- esto es el “justificado” */
  align-items:center;
  width:100%;
  margin-top:6px;
  padding-right: 6px; /* micro aire a la derecha */
}

.nivel input {
    display: none;
}

.nivel span {
 position: relative;   
 width: 20px;
 height: 20px;
 border-radius: 50%;
 display: inline-block;
 cursor: pointer;
 transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;

  /* forma gema */
  border-radius: 7px;                 /* <-- deja de ser círculo */
  transform: rotate(45deg);           /* <-- rombo */
  border: 1px solid rgba(212,168,79,.75);

  /* brillo / volumen */
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,.25),
    inset 0 -3px 6px rgba(0,0,0,.45),
    0 0 6px rgba(0,0,0,.55);
}
/* el “núcleo” brillante de la gema */
.nivel span::after{
  content:"";
  position:absolute;
  width: 10px;
  height: 10px;
  top: 3px;
  left: 3px;
  border-radius: 3px;
  background: rgba(255,255,255,.35);
  filter: blur(.2px);
  transform: rotate(-45deg); /* para compensar el rombo */
}

/* Colores */
.nivel.gris span   { background: radial-gradient(circle at 30% 30%, #ffffff55, #9e9e9e 55%, #4d4d4d 100%); }
.nivel.verde span  { background: radial-gradient(circle at 30% 30%, #ffffff55, #4caf50 55%, #0b4a12 100%); }
.nivel.azul span   { background: radial-gradient(circle at 30% 30%, #ffffff55, #3498db 55%, #0c2f6a 100%); }
.nivel.morado span { background: radial-gradient(circle at 30% 30%, #ffffff55, #9b59b6 55%, #3b114e 100%); }
.nivel.dorado span { background: radial-gradient(circle at 30% 30%, #ffffff66, #d4af37 55%, #7a4f12 100%); }

/* Seleccionado */
.nivel input:checked + span{
  transform: rotate(45deg) scale(1.18);
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,.35),
    inset 0 -3px 7px rgba(0,0,0,.55),
    0 0 10px rgba(255,215,106,.65),
    0 0 16px rgba(212,168,79,.55);
}

/* ============================= */
/* INPUTS MATERIALES */
/* ============================= */

.materiales{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 16px;
    margin-top: 12px;
}

.material-input {
    display: flex;
    flex-direction: column;
    font-size: 13px;
}

.forge-azul .material-input{
  width: 180px;
}

.material-input input {
    margin-top: 4px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #b88b3f;
    background: rgba(0,0,0,0.6);
    color: #f5e6c8;
}
/* Quitar flechas en Chrome, Edge, Safari */
.material-input input::-webkit-outer-spin-button,
.material-input input::-webkit-inner-spin-button,
.cantidad input::-webkit-outer-spin-button,
.cantidad input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Quitar flechas en Firefox */
.material-input input[type=number],
.cantidad input[type=number] {
    -moz-appearance: textfield;
}

.material-input select{
    position:relative;
    margin-top:4px;
    padding:4px 6px;
    border-radius:6px;
    border:1px solid #b88b3f;
    background: rgba(0,0,0,0.6);
    color:#f5e6c8;
    z-index: 500; 
}

.material-input select{
    appearance:auto;
}

/* ============================= */
/* BOTÓN FORJAR */
/* ============================= */

.forge-actions {
    margin-top: 12px;
}

.btn-forjar {
    padding: 6px 14px;
    background: #2e7d32; /* verde */
    border: 1px solid #b88b3f;
    border-radius: 8px;
    color: #ffd76a; /* amarillo oro */
    cursor: pointer;
    font-family: "Quintessential", serif;
    font-size: 16px;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.btn-forjar:hover {
    transform: scale(1.05);
    box-shadow: 0 0 8px rgba(46,125,50,0.6);
}

.btn-reset {
    background: linear-gradient(145deg, #2a5fb3, #1c3f85); /* azul más vivo */
    margin-left: 130px;
    padding: 6px 16px;
    border: 1px solid #d4a84f; /* mismo dorado que el resto */
    border-radius: 8px;
    color: #ffd76a; /* oro */
    font-family: "Quintessential", serif;
    font-size: 16px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.25s ease;

    /* brillo elegante */
    box-shadow:
        inset 0 0 6px rgba(255,255,255,0.12),
        0 0 6px rgba(42,95,179,0.4);

    text-shadow: 0 0 4px rgba(255,215,106,0.4);
}

.btn-reset:hover {
    transform: scale(1.05);
    box-shadow:
        inset 0 0 8px rgba(255,255,255,0.18),
        0 0 12px rgba(42,95,179,0.8);
}

/* ==========================================================
   FORGE RESULTADOS
   ========================================================== */

.forge-overlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0.75);
    display:flex;
    justify-content:center;
    align-items:center;
    opacity:0;
    pointer-events:none;
    transition:opacity .4s ease;
    z-index:200;
}

.forge-overlay.activo{
    opacity:1;
    pointer-events:auto;
}

.forge-popup{
    background:rgba(10,10,10,0.95);
    border:2px solid #b88b3f;
    border-radius:20px;
    padding:40px;
    width:90%;
    max-width:500px;
}

.forge-popup {
    background: rgba(10,10,10,0.95);
    border: 2px solid #b88b3f;
    border-radius: 20px;
    padding: 40px;
    width:90%;
    max-width:500px;
    min-width:unset;
    display: flex;
    justify-content: center;
    align-items: center;

    transform: scale(.7);
    opacity: 0;
    transition: all .35s ease;

    cursor: default;
}

.forge-overlay.activo .forge-popup {
    transform: scale(1);
    opacity: 1;
}

.forge-overlay:not(.activo) .forge-popup {
    transform: scale(.8);
    opacity: 0;
}

#forge-popup-results {
    display: flex;
    align-items: flex-end;
    gap: 50px;
   
}

/* Scrollbar opcional */
#forge-popup-results::-webkit-scrollbar {
    height: 6px;
}

#forge-popup-results::-webkit-scrollbar-thumb {
    background: #b88b3f;
    border-radius: 4px;
}

.forge-carousel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

/* Ventana visible (4 items) */
.carousel-viewport {
    overflow: hidden;
    width: 100%;
    max-width: 800px;
    position:relative;
}

/* Track que se mueve */
.carousel-track {
    display: flex;
    gap: 50px;
    transition: transform 0.4s ease;
}

/* Botones laterales */
.carousel-btn {
    background: none;
    border: none;
    font-size: 40px;
    color: #d4a84f;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.carousel-btn:hover {
    transform: scale(1.2);
    opacity: 0.8;
}
/* ==========================================================
   RESULTADOS ITEMS
   ========================================================== */

.forge-result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 150px;
    animation: flotarResultado 4s ease-in-out infinite;
}

/* Desfase animación */
.forge-result-item:nth-child(1) { animation-delay: 0s; }
.forge-result-item:nth-child(2) { animation-delay: .6s; }
.forge-result-item:nth-child(3) { animation-delay: 1.2s; }
.forge-result-item:nth-child(4) { animation-delay: 1.8s; }
.forge-result-item:nth-child(5) { animation-delay: 2.4s; }


/* Imagen */
.forge-item-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    filter: drop-shadow(0 0 18px rgba(0,0,0,0.8));
    transition: transform 0.3s ease;
}

.forge-item-img:hover {
    transform: scale(1.08);
}


/* Cantidad */
.forge-qty {
    margin-top: 12px;
    font-size: 24px;
    font-family: "Quintessential", serif;
    color: #ffd76a;
    text-shadow:
        0 0 6px rgba(255,215,100,0.6),
        0 0 12px rgba(212,168,79,0.5);
}


/* ==========================================================
   RESULTADOS AZUL
   ========================================================== */

.forge-popup-blue{

display:flex;
justify-content:center;
align-items:center;
padding:40px;

background:rgba(10,10,10,0.92);
border:2px solid #d4a24c;
border-radius:16px;

}

.blue-results-popup{

display:flex;
gap:60px;
align-items:center;
justify-content:center;

}

.blue-material{

display:flex;
flex-direction:column;
align-items:center;
gap:8px;

}

.blue-material img{
width:80px;
}

.blue-material span{
font-size:28px;
color:#e8c06b;
font-family:'Cinzel', serif;
}

.forge-azul.oculto{
opacity:0;
pointer-events:none;
}



/* ==========================================================
   ANIMACIONES
   ========================================================== */

@keyframes flotar{
    0%{transform:translateY(0)}
    50%{transform:translateY(-18px)}
    100%{transform:translateY(0)}
}

@keyframes pulso{
    0%{transform:scale(1);opacity:.7}
    50%{transform:scale(1.15);opacity:1}
    100%{transform:scale(1);opacity:.7}
}

/* ==========================================================
   ANIMACIÓN FLOTAR
   ========================================================== */

@keyframes flotarResultado {
    0%   { transform: translateY(0px); }
    50%  { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}


/* ==========================================================
   SHAKE COCTELERA REAL
   ========================================================== */

@keyframes shakeForge {

    0%   { transform: translate(0,0) rotate(0deg); }

    5%   { transform: translate(-18px, 10px) rotate(-6deg); }
    10%  { transform: translate(16px, -12px) rotate(6deg); }
    15%  { transform: translate(-14px, 8px) rotate(-5deg); }
    20%  { transform: translate(15px, -10px) rotate(5deg); }

    30%  { transform: translate(-12px, 7px) rotate(-4deg); }
    40%  { transform: translate(12px, -7px) rotate(4deg); }

    50%  { transform: translate(-9px, 5px) rotate(-3deg); }
    60%  { transform: translate(9px, -5px) rotate(3deg); }

    70%  { transform: translate(-6px, 3px) rotate(-2deg); }
    80%  { transform: translate(6px, -3px) rotate(2deg); }

    90%  { transform: translate(-2px, 1px) rotate(-1deg); }

    100% { transform: translate(0,0) rotate(0deg); }
}

.forge-body.shake {
    animation: shakeForge 1.8s ease-in-out;
}
