/* ================================================
   TAROT DE MARSELLA 3 - APP STYLES
   Spiritual Theme: Dark / Gold / Deep Purple
   ================================================ */

.tr3-app {
    --tr3-oro: #c9a84c;
    --tr3-oro-claro: #dfc27a;
    --tr3-purpura: #4a1a6b;
    --tr3-purpura-claro: #7b3fa0;
    --tr3-negro: #1a1a1a;
    --tr3-gris-oscuro: #2a252e;
    --tr3-gris-medio: #3a3545;
    --tr3-blanco: #ede4d8;
    --tr3-gradiente-oro: linear-gradient(135deg, #b8943a 0%, #c9a84c 50%, #dfc27a 100%);
    --tr3-gradiente-purpura: linear-gradient(135deg, #2a0a3d 0%, #4a1a6b 50%, #7b3fa0 100%);
    --tr3-sombra-oro: 0 10px 30px rgba(201, 168, 76, 0.2);
    --tr3-radio: 16px;
    --tr3-transicion: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    position: relative;
    overflow: hidden;
    width: 100%;
    background: var(--tr3-negro);
    color: var(--tr3-blanco);
}

.tr3-fase {
    animation: tr3FadeIn 0.6s ease;
}

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

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

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

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

@keyframes tr3Pulso {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.1); filter: brightness(1.3) drop-shadow(0 0 20px rgba(201, 168, 76, 0.5)); }
}

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

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

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

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

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

.tr3-subtitulo-form {
    color: rgba(237, 228, 216, 0.7);
    margin-bottom: 2rem;
    font-size: 1rem;
}

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

.tr3-input,
.tr3-textarea {
    width: 100%;
    background: rgba(237, 228, 216, 0.05);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 12px;
    padding: 0.9rem 1.2rem;
    color: var(--tr3-blanco);
    font-family: inherit;
    font-size: 1.05rem;
    transition: var(--tr3-transicion);
    box-sizing: border-box;
}

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

.tr3-input:focus,
.tr3-textarea:focus {
    outline: none;
    border-color: var(--tr3-oro);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
    background-color: rgba(237, 228, 216, 0.08);
}

.tr3-input::placeholder,
.tr3-textarea::placeholder {
    color: rgba(237, 228, 216, 0.35);
}

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

.tr3-btn-consultar:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(201, 168, 76, 0.3);
}

.tr3-instruccion {
    color: rgba(237, 228, 216, 0.5);
    font-size: 0.85rem;
    margin-top: 1.5rem;
}

/* ================================================
   LOADING - CARTAS ANIMADAS
   ================================================ */

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

.tr3-loading-cartas {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tr3-carta-animada {
    font-size: 3rem;
    animation: tr3CartaGirar 2s ease-in-out infinite;
}

.tr3-carta1 { animation-delay: 0s; }
.tr3-carta2 { animation-delay: 0.3s; }
.tr3-carta3 { animation-delay: 0.6s; }

@keyframes tr3CartaGirar {
    0% { transform: translateY(0) rotateY(0deg); opacity: 0.3; }
    50% { transform: translateY(-20px) rotateY(180deg); opacity: 1; }
    100% { transform: translateY(0) rotateY(360deg); opacity: 0.3; }
}

.tr3-loading-texto {
    color: rgba(237, 228, 216, 0.7);
    font-size: 1rem;
    animation: tr3PulsoTexto 1.5s ease-in-out infinite;
}

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

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

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

.tr3-titulo-resultado {
    color: var(--tr3-oro);
    font-size: 1.6rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.tr3-nombre-saludo {
    text-align: center;
    color: var(--tr3-oro-claro);
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.tr3-pregunta-mostrada {
    text-align: center;
    color: rgba(237, 228, 216, 0.6);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 1.5rem;
    padding: 0.5rem 1rem;
    background: rgba(201, 168, 76, 0.05);
    border-radius: 8px;
}

/* ================================================
   CARTAS RESULTADO (3 posiciones espirituales)
   ================================================ */

.tr3-carta-resultado {
    background: rgba(237, 228, 216, 0.05);
    border: 1px solid rgba(201, 168, 76, 0.15);
    border-left: 4px solid var(--tr3-purpura);
    border-radius: var(--tr3-radio);
    padding: 1.5rem;
    margin-bottom: 1.2rem;
    animation: tr3SlideIn 0.6s ease both;
}

.tr3-carta-resultado:nth-child(4) { animation-delay: 0s; }
.tr3-carta-resultado:nth-child(5) { animation-delay: 0.12s; }
.tr3-carta-resultado:nth-child(6) { animation-delay: 0.24s; }

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

.tr3-carta-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.tr3-carta-posicion {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--tr3-purpura-claro);
    font-weight: 700;
    background: rgba(74, 26, 107, 0.2);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
}

.tr3-carta-emoji {
    font-size: 2.2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(201, 168, 76, 0.08);
    border-radius: 12px;
    flex-shrink: 0;
    border: 1px solid rgba(201, 168, 76, 0.2);
}

.tr3-carta-info {
    flex: 1;
}

.tr3-carta-numero {
    font-size: 0.8rem;
    color: rgba(237, 228, 216, 0.4);
    margin-bottom: 0.1rem;
}

.tr3-carta-nombre {
    color: var(--tr3-oro);
    font-size: 1.2rem;
    font-weight: 700;
}

.tr3-carta-descripcion {
    color: rgba(237, 228, 216, 0.75);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-top: 0.3rem;
    padding-left: 0.5rem;
    border-left: 2px solid rgba(201, 168, 76, 0.2);
}

/* ================================================
   INTERPRETACION
   ================================================ */

.tr3-seccion {
    background: rgba(74, 26, 107, 0.1);
    border: 1px solid rgba(201, 168, 76, 0.15);
    border-radius: var(--tr3-radio);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    animation: tr3SlideIn 0.6s ease both;
    animation-delay: 0.36s;
}

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

.tr3-interpretacion-box {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: rgba(201, 168, 76, 0.04);
    border: 1px solid rgba(201, 168, 76, 0.12);
    border-radius: 12px;
    padding: 1rem;
}

.tr3-interpretacion-icon {
    flex-shrink: 0;
    font-size: 1.2rem;
    color: var(--tr3-oro);
}

.tr3-interpretacion-text {
    color: rgba(237, 228, 216, 0.85);
    font-size: 0.9rem;
    line-height: 1.7;
    font-style: italic;
}

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

.tr3-btn-nueva {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(237, 228, 216, 0.08);
    color: var(--tr3-blanco);
    border: 2px solid rgba(201, 168, 76, 0.3);
    border-radius: 50px;
    padding: 0.9rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--tr3-transicion);
    font-family: inherit;
    display: block;
    margin: 0 auto;
}

.tr3-btn-nueva:hover {
    background: rgba(201, 168, 76, 0.15);
    border-color: var(--tr3-oro);
    transform: translateY(-2px);
}

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

.tr3-app::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(26, 26, 26, 0.9) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(201, 168, 76, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(74, 26, 107, 0.05) 0%, transparent 50%);
    animation: tr3Fondo 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}

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

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

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

@media (max-width: 768px) {
    .tr3-titulo-form { font-size: 1.6rem; }
    .tr3-icono-oraculo { font-size: 3rem; }
    .tr3-carta-header { flex-direction: column; text-align: center; }
    .tr3-carta-descripcion { border-left: none; padding-left: 0; }
}

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

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

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

@media (prefers-contrast: high) {
    .tr3-carta-resultado { border: 2px solid rgba(237, 228, 216, 0.4); }
    .tr3-input { border: 2px solid rgba(237, 228, 216, 0.4); }
    .tr3-textarea { border: 2px solid rgba(237, 228, 216, 0.4); }
    .tr3-seccion { border: 2px solid rgba(237, 228, 216, 0.4); }
}

@media print {
    .tr3-app::before { display: none; }
    .tr3-btn-nueva { display: none; }
    .tr3-btn-consultar { display: none; }
    .tr3-carta-resultado { break-inside: avoid; }
}
