/* ================================================
   SABIDURIA - APP STYLES (Gold/Purple/Blue Theme)
   ================================================ */

.sab-app {
    --sab-oro: #fbbf24;
    --sab-purpura: #7c3aed;
    --sab-azul: #3b82f6;
    --sab-noche: #0f0a1a;
    --sab-dorado: #d97706;
    --sab-gradiente: linear-gradient(135deg, #0f0a1a 0%, #2e1065 50%, #1e3a5f 100%);
    --sab-gradiente-oro: linear-gradient(135deg, #7c3aed 0%, #3b82f6 50%, #fbbf24 100%);
    --sab-sombra: 0 10px 30px rgba(124, 58, 237, 0.3);
    --sab-radio: 16px;
    --sab-transicion: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    position: relative;
    overflow: hidden;
}

.sab-fase {
    animation: sabFadeIn 0.6s ease;
}

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

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

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

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

@keyframes sabPulso {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.1); filter: brightness(1.3) drop-shadow(0 0 20px rgba(251, 191, 36, 0.5)); }
}

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

.sab-destello::before { content: '\2726'; }
.sab-d2::before { content: '\2756'; }
.sab-d3::before { content: '\2727'; }

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

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

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

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

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

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

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

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

.sab-input:focus {
    outline: none;
    border-color: var(--sab-oro);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
    background-color: rgba(255, 255, 255, 0.08);
}

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

.sab-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 12px;
    padding: 0.9rem 1.2rem;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--sab-transicion);
    box-sizing: border-box;
    resize: vertical;
    min-height: 80px;
}

.sab-textarea:focus {
    outline: none;
    border-color: var(--sab-oro);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
    background-color: rgba(255, 255, 255, 0.08);
}

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

.sab-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--sab-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='%237c3aed' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.sab-select:focus {
    outline: none;
    border-color: var(--sab-oro);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
    background-color: rgba(255, 255, 255, 0.08);
}

.sab-select option {
    background: #0f0a1a;
    color: #fff;
}

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

.sab-btn-consultar:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.3);
}

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

/* ================================================
   LOADING
   ================================================ */

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

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

.sab-libro-centro {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    animation: sabGiroPulso 2s ease-in-out infinite;
}

@keyframes sabGiroPulso {
    0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    50% { transform: translate(-50%, -50%) scale(1.2) rotate(180deg); filter: drop-shadow(0 0 15px rgba(251, 191, 36, 0.6)); }
}

.sab-libro-arc {
    position: absolute;
    top: 5px; left: 5px;
    width: 80px; height: 80px;
    border: 2px dashed rgba(124, 58, 237, 0.25);
    border-radius: 50%;
    animation: sabArcGiro 8s linear infinite;
}

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

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

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

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

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

.sab-seccion {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(124, 58, 237, 0.1);
    border-radius: var(--sab-radio);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    animation: sabSlideIn 0.6s ease both;
}

.sab-seccion:nth-child(2) { animation-delay: 0s; }
.sab-seccion:nth-child(3) { animation-delay: 0.1s; }
.sab-seccion:nth-child(4) { animation-delay: 0.15s; }
.sab-seccion:nth-child(5) { animation-delay: 0.2s; }

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

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

/* ================================================
   CONSEJO
   ================================================ */

.sab-consejo-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.sab-consejo-icono {
    font-size: 1.8rem;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sab-consejo-titulo {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
}

.sab-consejo-texto {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.7;
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
    font-style: italic;
}

.sab-aplicacion-box {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 0.8rem 1rem;
}

.sab-aplicacion-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.sab-aplicacion-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* ================================================
   ENSEÑANZA
   ================================================ */

.sab-ensenanza-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.sab-ensenanza-icono {
    font-size: 1.5rem;
}

.sab-ensenanza-titulo {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
}

.sab-ensenanza-texto {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.7;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.sab-reflexion-box {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: rgba(251, 191, 36, 0.06);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 12px;
    padding: 0.8rem 1rem;
}

.sab-reflexion-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.sab-reflexion-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* ================================================
   AREA
   ================================================ */

.sab-area-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.sab-area-icono {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sab-area-nombre {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
}

.sab-area-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.sab-afirmacion-area {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    font-size: 0.93rem;
}

/* ================================================
   AFIRMACION FINAL
   ================================================ */

.sab-afirmacion-box {
    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: 12px;
    padding: 1rem;
}

.sab-afirmacion-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sab-afirmacion-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    line-height: 1.6;
    font-style: italic;
}

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

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

.sab-btn-nueva:hover {
    background: rgba(124, 58, 237, 0.15);
    border-color: var(--sab-oro);
    transform: translateY(-2px);
}

/* ================================================
   PARTICULAS DE FONDO
   ================================================ */

.sab-app::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(15, 10, 26, 0.8) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(124, 58, 237, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(251, 191, 36, 0.03) 0%, transparent 50%);
    animation: sabFondo 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}

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

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

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

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

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

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

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

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

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