/* ================================================
   TAROT DE MARSELLA - APP STYLES
   Dark Theme: Gold / Red / Black
   ================================================ */

.trm-app {
    --trm-oro: #d4a848;
    --trm-oro-claro: #e8c97a;
    --trm-rojo: #8b1a1a;
    --trm-rojo-claro: #c0392b;
    --trm-negro: #1a1a1a;
    --trm-gris-oscuro: #2a2a2a;
    --trm-gris-medio: #3a3a3a;
    --trm-blanco: #f0e6d3;
    --trm-gradiente-oro: linear-gradient(135deg, #b8943a 0%, #d4a848 50%, #e8c97a 100%);
    --trm-gradiente-rojo: linear-gradient(135deg, #5c1010 0%, #8b1a1a 50%, #c0392b 100%);
    --trm-sombra-oro: 0 10px 30px rgba(212, 168, 72, 0.2);
    --trm-radio: 16px;
    --trm-transicion: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

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

.trm-fase {
    animation: trmFadeIn 0.6s ease;
}

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

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

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

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

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

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

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

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

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

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

.trm-subtitulo-form {
    color: rgba(240, 230, 211, 0.7);
    margin-bottom: 2rem;
    font-size: 1rem;
}

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

.trm-input,
.trm-textarea {
    width: 100%;
    background: rgba(240, 230, 211, 0.05);
    border: 1px solid rgba(212, 168, 72, 0.3);
    border-radius: 12px;
    padding: 0.9rem 1.2rem;
    color: var(--trm-blanco);
    font-family: inherit;
    font-size: 1.05rem;
    transition: var(--trm-transicion);
    box-sizing: border-box;
}

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

.trm-input:focus,
.trm-textarea:focus {
    outline: none;
    border-color: var(--trm-oro);
    box-shadow: 0 0 0 3px rgba(212, 168, 72, 0.15);
    background-color: rgba(240, 230, 211, 0.08);
}

.trm-input::placeholder,
.trm-textarea::placeholder {
    color: rgba(240, 230, 211, 0.35);
}

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

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

.trm-instruccion {
    color: rgba(240, 230, 211, 0.5);
    font-size: 0.85rem;
    margin-top: 1.5rem;
}

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

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

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

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

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

@keyframes trmCartaGirar {
    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; }
}

.trm-loading-texto {
    color: rgba(240, 230, 211, 0.7);
    font-size: 1rem;
    animation: trmPulsoTexto 1.5s ease-in-out infinite;
}

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

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

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

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

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

.trm-pregunta-mostrada {
    text-align: center;
    color: rgba(240, 230, 211, 0.6);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 1.5rem;
    padding: 0.5rem 1rem;
    background: rgba(212, 168, 72, 0.05);
    border-radius: 8px;
}

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

.trm-carta-resultado {
    background: rgba(240, 230, 211, 0.05);
    border: 1px solid rgba(212, 168, 72, 0.15);
    border-left: 4px solid var(--trm-oro);
    border-radius: var(--trm-radio);
    padding: 1.5rem;
    margin-bottom: 1.2rem;
    animation: trmSlideIn 0.6s ease both;
}

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

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

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

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

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

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

.trm-carta-numero {
    font-size: 0.8rem;
    color: rgba(240, 230, 211, 0.4);
    margin-bottom: 0.1rem;
}

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

.trm-carta-descripcion {
    color: rgba(240, 230, 211, 0.75);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-top: 0.3rem;
    padding-left: 0.5rem;
    border-left: 2px solid rgba(212, 168, 72, 0.2);
}

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

.trm-seccion {
    background: rgba(139, 26, 26, 0.08);
    border: 1px solid rgba(212, 168, 72, 0.15);
    border-radius: var(--trm-radio);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    animation: trmSlideIn 0.6s ease both;
    animation-delay: 0.36s;
}

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

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

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

.trm-interpretacion-text {
    color: rgba(240, 230, 211, 0.85);
    font-size: 0.9rem;
    line-height: 1.7;
    font-style: italic;
}

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

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

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

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

.trm-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(212, 168, 72, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(139, 26, 26, 0.04) 0%, transparent 50%);
    animation: trmFondo 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}

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

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

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

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

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

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

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

@media (prefers-contrast: high) {
    .trm-carta-resultado { border: 2px solid rgba(240, 230, 211, 0.4); }
    .trm-input { border: 2px solid rgba(240, 230, 211, 0.4); }
    .trm-textarea { border: 2px solid rgba(240, 230, 211, 0.4); }
    .trm-seccion { border: 2px solid rgba(240, 230, 211, 0.4); }
}

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