/* ================================================
   SORTILEGIO MAGICO - APP STYLES
   Mystical / Purple / Magic Theme
   ================================================ */

.sm-app {
    --sm-purpura-oscuro: #1a0a2e;
    --sm-purpura: #6a1b9a;
    --sm-purpura-claro: #ab47bc;
    --sm-magenta: #e91e63;
    --sm-dorado: #ffd700;
    --sm-oro-claro: #ffe44d;
    --sm-gradiente: linear-gradient(135deg, #1a0a2e 0%, #2d0a4a 50%, #3d0a5e 100%);
    --sm-gradiente-magico: linear-gradient(135deg, #6a1b9a 0%, #ab47bc 50%, #e91e63 100%);
    --sm-sombra: 0 10px 30px rgba(106, 27, 154, 0.3);
    --sm-radio: 16px;
    --sm-transicion: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    position: relative;
    overflow: hidden;
}

.sm-fase {
    animation: smFadeIn 0.6s ease;
}

@keyframes smFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================================================
   FASE FORMULARIO
   ================================================ */

.sm-form-contenido {
    text-align: center;
    padding: 2.5rem 1rem;
}

.sm-icono-oraculo {
    font-size: 4rem;
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
    animation: smPulso 3s ease-in-out infinite;
}

@keyframes smPulso {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.1); filter: brightness(1.3) drop-shadow(0 0 20px rgba(171, 71, 188, 0.5)); }
}

.sm-destello {
    position: absolute;
    font-size: 1rem;
    opacity: 0;
    animation: smDestello 3s ease-in-out infinite;
    pointer-events: none;
}

.sm-destello::before { content: '\2726'; color: var(--sm-dorado); }
.sm-d2::before { content: '\2756'; color: var(--sm-purpura-claro); }
.sm-d3::before { content: '\2727'; color: var(--sm-magenta); }

.sm-d1 { animation-delay: -0.5s; top: -10px; left: 10px; }
.sm-d2 { animation-delay: -1.5s; top: -5px; right: 15px; }
.sm-d3 { animation-delay: -2.5s; bottom: 5px; left: 25px; }

@keyframes smDestello {
    0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
    50% { opacity: 0.8; transform: translateY(-20px) scale(1); }
}

.sm-titulo-form {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: var(--sm-gradiente-magico);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sm-subtitulo-form {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.sm-form-campo {
    max-width: 500px;
    margin: 0 auto 1rem;
    text-align: left;
}

.sm-form-seccion {
    margin-bottom: 1.5rem;
}

.sm-seccion-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    font-weight: 500;
}

.sm-input,
.sm-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(171, 71, 188, 0.3);
    border-radius: 12px;
    padding: 0.9rem 1.2rem;
    color: #fff;
    font-family: inherit;
    font-size: 1.05rem;
    transition: var(--sm-transicion);
    box-sizing: border-box;
}

.sm-textarea {
    min-height: 100px;
    resize: vertical;
}

.sm-input:focus,
.sm-textarea:focus {
    outline: none;
    border-color: var(--sm-dorado);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
    background-color: rgba(255, 255, 255, 0.08);
}

.sm-input::placeholder,
.sm-textarea::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.sm-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(171, 71, 188, 0.3);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--sm-transicion);
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23ab47bc' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.sm-select:focus {
    outline: none;
    border-color: var(--sm-dorado);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
    background-color: rgba(255, 255, 255, 0.08);
}

.sm-select option {
    background: var(--sm-purpura-oscuro);
    color: #fff;
}

.sm-btn-consultar {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--sm-gradiente-magico);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.9rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--sm-transicion);
    margin-top: 1.5rem;
    font-family: inherit;
}

.sm-btn-consultar:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(171, 71, 188, 0.3);
}

.sm-instruccion {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    margin-top: 1.5rem;
}

/* ================================================
   LOADING - MAGIC SPARKLES
   ================================================ */

.sm-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.sm-loading-varita {
    width: 90px;
    height: 90px;
    position: relative;
    margin-bottom: 1.5rem;
}

.sm-varita-icono {
    font-size: 3.5rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: smVaritaBrillar 2s ease-in-out infinite;
}

.sm-varita-chispa {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sm-dorado);
    opacity: 0;
    animation: smChispa 1.5s ease-out infinite;
}

.sm-varita-chispa-1 {
    top: 0;
    left: 50%;
    animation-delay: 0s;
}

.sm-varita-chispa-2 {
    top: 30%;
    right: 5px;
    animation-delay: -0.3s;
    background: var(--sm-purpura-claro);
}

.sm-varita-chispa-3 {
    bottom: 20%;
    left: 10px;
    animation-delay: -0.6s;
    background: var(--sm-magenta);
}

.sm-varita-chispa-4 {
    top: 10%;
    left: 20%;
    animation-delay: -0.9s;
    background: var(--sm-dorado);
}

@keyframes smVaritaBrillar {
    0%, 100% { transform: translate(-50%, -50%) scale(1); filter: brightness(1); }
    50% { transform: translate(-50%, -50%) scale(1.15); filter: brightness(1.4) drop-shadow(0 0 20px rgba(171, 71, 188, 0.5)); }
}

@keyframes smChispa {
    0% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1.5); }
    100% { opacity: 0; transform: scale(0) translateY(-15px); }
}

.sm-loading-texto {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    animation: smPulsoTexto 1.5s ease-in-out infinite;
}

@keyframes smPulsoTexto {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ================================================
   FASE RESULTADO
   ================================================ */

.sm-resultado-contenido {
    padding: 2rem 1rem;
}

.sm-seccion {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(171, 71, 188, 0.12);
    border-radius: var(--sm-radio);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    animation: smSlideIn 0.6s ease both;
}

.sm-seccion:nth-child(1) { animation-delay: 0s; }
.sm-seccion:nth-child(2) { animation-delay: 0.08s; }
.sm-seccion:nth-child(3) { animation-delay: 0.15s; }
.sm-seccion:nth-child(4) { animation-delay: 0.2s; }

@keyframes smSlideIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.sm-seccion-titulo {
    color: var(--sm-dorado);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* ================================================
   TIPO SORTILEGIO CARD
   ================================================ */

.sm-tipo-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.sm-tipo-icono {
    font-size: 2rem;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid currentColor;
}

.sm-tipo-info {
    flex: 1;
}

.sm-tipo-nombre {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
}

.sm-tipo-elemento {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 0.2rem;
}

.sm-tipo-desc {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* ================================================
   PALABRA MAGICA CARD
   ================================================ */

.sm-palabra-box {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: rgba(255, 215, 0, 0.06);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.sm-palabra-icon {
    flex-shrink: 0;
    font-size: 1rem;
    color: var(--sm-dorado);
}

.sm-palabra-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    line-height: 1.6;
    font-style: italic;
}

/* ================================================
   HECHIZO
   ================================================ */

.sm-hechizo-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.sm-hechizo-icono {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.sm-hechizo-titulo {
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
}

.sm-hechizo-invocacion {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.7;
    font-size: 0.95rem;
    font-style: italic;
    margin-bottom: 0.8rem;
}

.sm-hechizo-poder {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(233, 30, 99, 0.06);
    border: 1px solid rgba(233, 30, 99, 0.2);
    border-radius: 10px;
    padding: 0.6rem 1rem;
}

.sm-hechizo-poder-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.sm-hechizo-poder-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.sm-hechizo-poder-fill {
    height: 100%;
    background: var(--sm-gradiente-magico);
    border-radius: 4px;
}

.sm-hechizo-poder-num {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--sm-magenta);
    flex-shrink: 0;
}

/* ================================================
   RITUAL
   ================================================ */

.sm-ritual-box {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.sm-ritual-nombre {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
}

.sm-ritual-pasos {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.8rem 1rem;
}

.sm-ritual-duracion {
    font-size: 0.85rem;
    color: var(--sm-purpura-claro);
    font-weight: 500;
}

/* ================================================
   AFIRMACIONES
   ================================================ */

.sm-afirmacion-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.88rem;
    line-height: 1.5;
}

.sm-afirmacion-item:last-child {
    margin-bottom: 0;
}

.sm-afirmacion-icon {
    flex-shrink: 0;
    font-size: 0.9rem;
    color: var(--sm-dorado);
}

/* ================================================
   INTENCION BOX
   ================================================ */

.sm-intencion-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    font-size: 0.93rem;
    margin-bottom: 0.8rem;
}

.sm-intencion-box strong {
    color: var(--sm-dorado);
}

/* ================================================
   NUEVA CONSULTA
   ================================================ */

.sm-btn-nueva {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 2px solid rgba(171, 71, 188, 0.3);
    border-radius: 50px;
    padding: 0.9rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--sm-transicion);
    font-family: inherit;
}

.sm-btn-nueva:hover {
    background: rgba(171, 71, 188, 0.15);
    border-color: var(--sm-dorado);
    transform: translateY(-2px);
}

/* ================================================
   FONDO
   ================================================ */

.sm-app::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(26, 10, 46, 0.8) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(171, 71, 188, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(255, 215, 0, 0.03) 0%, transparent 50%);
    animation: smFondo 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes smFondo {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sm-fase { position: relative; z-index: 1; }
.sm-loading { position: relative; z-index: 1; }

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 768px) {
    .sm-titulo-form { font-size: 1.6rem; }
    .sm-icono-oraculo { font-size: 3rem; }
    .sm-tipo-header { flex-direction: column; text-align: center; }
    .sm-hechizo-header { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
    .sm-form-contenido { padding: 1.5rem 0.5rem; }
    .sm-titulo-form { font-size: 1.4rem; }
    .sm-subtitulo-form { font-size: 0.85rem; }
    .sm-resultado-contenido { padding: 1.5rem 0.5rem; }
    .sm-seccion { padding: 1.2rem; }
    .sm-btn-nueva { padding: 0.8rem 1.5rem; font-size: 0.9rem; }
    .sm-btn-consultar { padding: 0.8rem 1.8rem; font-size: 0.9rem; }
}

/* ================================================
   ACCESIBILIDAD
   ================================================ */

@media (prefers-reduced-motion: reduce) {
    .sm-app::before { animation: none; }
    .sm-icono-oraculo { animation: none; }
    .sm-destello { animation: none; display: none; }
    .sm-varita-icono,
    .sm-varita-chispa { animation: none; display: none; }
    .sm-loading-texto { animation: none; opacity: 1; }
    .sm-seccion { animation: none; opacity: 1; transform: none; }
    * { transition-duration: 0.05ms !important; animation-duration: 0.05ms !important; }
}

@media (prefers-contrast: high) {
    .sm-seccion { border: 2px solid rgba(255, 255, 255, 0.4); }
    .sm-input { border: 2px solid rgba(255, 255, 255, 0.4); }
    .sm-select { border: 2px solid rgba(255, 255, 255, 0.4); }
}

@media print {
    .sm-app::before { display: none; }
    .sm-btn-nueva { display: none; }
    .sm-seccion { break-inside: avoid; }
}
