/* ============================================
   TAROT DE MARSELLA - ESTILOS PRINCIPALES
   Diseño místico y profesional
   ============================================ */

/* Variables CSS */
:root {
    /* Colores base - Compatible con tema Astra #111111 */
    --bg-primary: #171E36;
    --bg-secondary: #1F2742;
    --bg-card: #252D4A;
    --bg-hover: #2A3454;
    
    /* Acentos dorados místicos */
    --accent-gold: #D4AF37;
    --accent-gold-light: #F4D03F;
    --accent-gold-dark: #B8960F;
    
    /* Texto */
    --text-primary: #FFFFFF;
    --text-secondary: #B8C5DB;
    --text-muted: #8895B2;
    
    /* Sombras y efectos */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-strong: 0 12px 48px rgba(0, 0, 0, 0.5);
    --glow-gold: 0 0 20px rgba(212, 175, 55, 0.4);
    
    /* Fuentes */
    --font-display: 'Cinzel', serif;
    --font-body: 'Cormorant Garamond', serif;
    
    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.4s ease;
    --transition-slow: 0.6s ease;
}

/* Reset específico para la app (sin !important global) */
.tarot-container * {
    box-sizing: border-box;
}

.tarot-container {
    font-family: var(--font-body);
    color: var(--text-primary);
    line-height: 1.6;
    background: var(--bg-primary);
    min-height: 600px;
    position: relative;
    overflow: hidden;
    padding: 40px 20px;
}

/* Fondo animado místico */
.mystical-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.3;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--accent-gold);
    border-radius: 50%;
    animation: twinkle 3s infinite ease-in-out;
}

.star:nth-child(1) {
    top: 20%;
    left: 15%;
    animation-delay: 0s;
}

.star:nth-child(2) {
    top: 60%;
    right: 20%;
    animation-delay: 1s;
}

.star:nth-child(3) {
    bottom: 30%;
    left: 40%;
    animation-delay: 2s;
}

.moon {
    position: absolute;
    top: 10%;
    right: 10%;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at 30% 30%, var(--accent-gold-light), var(--accent-gold));
    border-radius: 50%;
    opacity: 0.15;
    filter: blur(2px);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
}

/* Contenedor principal */
.app-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Pasos - Sistema de navegación */
.step {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.step.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   PASO 1: FORMULARIO DE PREGUNTA
   ============================================ */

.question-container {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.app-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: 2px;
}

.app-title [data-lang-key="main_title"] {
    background: linear-gradient(135deg, var(--accent-gold-light), var(--accent-gold-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-icon {
    font-size: 0.7em;
    opacity: 0.8;
    animation: rotate-slow 10s infinite linear;
    display: inline-block;
}

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

.app-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 48px;
    font-style: italic;
}

.question-form {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(212, 175, 55, 0.1);
}

.question-label {
    display: block;
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--accent-gold);
    font-weight: 600;
}

.question-input {
    width: 100%;
    padding: 20px;
    font-family: var(--font-body);
    font-size: 1.1rem;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--text-primary);
    resize: vertical;
    transition: all var(--transition-medium);
}

.question-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: var(--glow-gold);
    background: var(--bg-primary);
}

.question-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.char-counter {
    text-align: right;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Botones */
.btn-primary, .btn-secondary, .btn-modal {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 18px 40px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-medium);
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dark));
    color: var(--bg-primary);
    margin-top: 24px;
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium), var(--glow-gold);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--accent-gold);
    border: 2px solid var(--accent-gold);
    margin-top: 32px;
}

.btn-secondary:hover {
    background: var(--accent-gold);
    color: var(--bg-primary);
    transform: translateY(-2px);
    box-shadow: var(--glow-gold);
}

.btn-icon {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0 8px;
}

/* ============================================
   PASO 2: SELECCIÓN DE CARTAS
   ============================================ */

.selection-container {
    max-width: 1100px;
    margin: 0 auto;
}

.selection-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
    margin-bottom: 32px;
    color: var(--accent-gold);
    font-weight: 600;
}

/* Contador de cartas */
.card-counter {
    text-align: center;
    margin-bottom: 48px;
}

.counter-circles {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.circle {
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent-gold);
    border-radius: 50%;
    transition: all var(--transition-medium);
}

.circle.filled {
    background: var(--accent-gold);
    box-shadow: var(--glow-gold);
    animation: pulse-circle 0.6s ease;
}

@keyframes pulse-circle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.counter-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

#selected-count {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-gold);
}

/* Grid de cartas */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 20px;
    padding: 20px;
    justify-items: center;
}

@media (min-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 24px;
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

/* Carta individual */
.tarot-card {
    width: 100%;
    max-width: 140px;
    aspect-ratio: 2/3;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-medium);
    border-radius: 8px;
    overflow: hidden;
}

.card-back {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
    border: 3px solid var(--accent-gold-dark);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.card-back::before {
    content: '✦';
    font-size: 3rem;
    color: var(--accent-gold);
    opacity: 0.3;
}

.card-back::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid var(--accent-gold);
    border-radius: 4px;
    opacity: 0.5;
}

/* Estados de la carta */
.tarot-card:hover:not(.selected) {
    transform: translateY(-8px) scale(1.05);
    box-shadow: var(--shadow-medium);
}

.tarot-card.selected {
    animation: golden-pulse 1.5s infinite ease-in-out;
    transform: scale(1.05);
}

.tarot-card.selected .card-back {
    border-color: var(--accent-gold-light);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.6), 
                0 0 60px rgba(212, 175, 55, 0.3);
}

@keyframes golden-pulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.4),
                    0 0 40px rgba(212, 175, 55, 0.2);
    }
    50% { 
        box-shadow: 0 0 40px rgba(212, 175, 55, 0.8),
                    0 0 80px rgba(212, 175, 55, 0.4);
    }
}

/* ============================================
   PASO 3: REVELACIÓN Y LECTURA
   ============================================ */

.reading-container {
    max-width: 900px;
    margin: 0 auto;
}

/* Cartas seleccionadas */
.selected-cards-display {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 48px;
    flex-wrap: wrap;
}

.revealed-card {
    width: 160px;
    perspective: 1000px;
}

.card-flip-container {
    width: 100%;
    aspect-ratio: 2/3;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s ease;
}

.card-flip-container.flipped {
    transform: rotateY(180deg);
}

.card-face, .card-back-reveal {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
}

.card-back-reveal {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
    border: 3px solid var(--accent-gold-dark);
}

.card-face {
    transform: rotateY(180deg);
    box-shadow: var(--shadow-strong);
}

.card-face img {
    width: 100%;
    height: 100%;
    /*object-fit: cover;*/
}

.card-name {
    text-align: center;
    margin-top: 12px;
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--accent-gold);
    font-weight: 600;
}

/* Indicador de carga */
.loading-container {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.spinner-circle {
    width: 16px;
    height: 16px;
    background: var(--accent-gold);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.spinner-circle:nth-child(1) { animation-delay: -0.32s; }
.spinner-circle:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.loading-text {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Resultado de la lectura */
.reading-result {
    display: none;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reading-result.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.reading-title {
    font-family: var(--font-display);
    font-size: 2rem;
    text-align: center;
    margin-bottom: 32px;
    color: var(--accent-gold);
    font-weight: 600;
}

.reading-text {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: var(--shadow-medium);
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-primary);
    text-align: justify;
    margin-bottom: 32px;
}

.reading-text p {
    margin-bottom: 20px;
}

.reading-text p:last-child {
    margin-bottom: 0;
}

/* ============================================
   MODAL DE ERROR/SUSPENSIÓN
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-secondary);
    padding: 48px 40px;
    border-radius: 16px;
    max-width: 500px;
    margin: 20px;
    border: 2px solid var(--accent-gold-dark);
    box-shadow: var(--shadow-strong), var(--glow-gold);
    text-align: center;
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-icon {
    font-size: 4rem;
    color: var(--accent-gold);
    margin-bottom: 24px;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--accent-gold);
    margin-bottom: 16px;
    font-weight: 600;
}

.modal-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-modal {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-modal-secondary {
    background: transparent;
    border: 2px solid var(--accent-gold);
    color: var(--accent-gold);
}

.btn-modal-secondary:hover {
    background: var(--accent-gold);
    color: var(--bg-primary);
}

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

@media (max-width: 768px) {
    .tarot-container {
        padding: 24px 16px;
    }
    
    .question-form {
        padding: 28px 20px;
    }
    
    .app-title {
        font-size: 2rem;
    }
    
    .selected-cards-display {
        gap: 20px;
    }
    
    .revealed-card {
        width: 120px;
    }
    
    .reading-text {
        padding: 28px 20px;
        font-size: 1.05rem;
    }
    
    .modal-content {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
    
    .tarot-card {
        max-width: 90px;
    }
    
    .revealed-card {
        width: 100px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .btn-modal {
        width: 100%;
    }
}

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

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.shimmer {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(212, 175, 55, 0.2),
        transparent
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Estados de carga */
.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}
