/**
 * Tarot Español AI - Estilos principales
 * Diseño responsive y moderno
 */

/* Reset y variables con prefijos únicos para evitar conflictos con WordPress */
:root {
    --tarot-primary-color: #1a0052;
    --tarot-secondary-color: #4a0e78;
    --tarot-accent-color: #ffb700;
    --tarot-text-light: #ffffff;
    --tarot-text-dark: #333333;
    --tarot-bg-gradient-start: rgba(10, 0, 40, 0.95);
    --tarot-bg-gradient-end: rgba(40, 10, 80, 0.95);
    --tarot-card-bg: #1a1a2e;
    --tarot-border-radius: 12px;
    --tarot-transition: all 0.3s ease;
    --tarot-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Contenedor principal con prefijos únicos */
#tarot-app-container.tarot-app-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    font-family: 'Arial', 'Helvetica', sans-serif !important;
    position: relative !important;
    min-height: 600px !important;
    background: linear-gradient(135deg, var(--tarot-bg-gradient-start), var(--tarot-bg-gradient-end)) !important;
    border-radius: var(--tarot-border-radius) !important;
    overflow: hidden !important;
}

/* Fondo decorativo */
.tarot-app-wrapper .tarot-background {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-image: radial-gradient(circle at 20% 50%, rgba(138, 43, 226, 0.1) 0%, transparent 50%),
                      radial-gradient(circle at 80% 80%, rgba(75, 0, 130, 0.1) 0%, transparent 50%) !important;
    pointer-events: none !important;
    z-index: 0 !important;
}

/* Pantallas */
.tarot-app-wrapper .tarot-screen {
    display: none !important;
    position: relative !important;
    z-index: 1 !important;
    animation: tarotFadeIn 0.5s ease !important;
}

.tarot-app-wrapper .tarot-screen.active {
    display: block !important;
}

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

/* Contenido de bienvenida */
.tarot-app-wrapper .tarot-welcome-content {
    position: relative !important;
    z-index: 2 !important;
}

/* Títulos */
.tarot-app-wrapper .tarot-title {
    font-size: 2.5rem !important;
    font-weight: bold !important;
    color: var(--tarot-accent-color) !important;
    text-align: center !important;
    margin: 0 0 20px 0 !important;
    text-shadow: 3px 3px 6px rgba(138, 43, 226, 0.6) !important;
    letter-spacing: 2px !important;
}

.tarot-app-wrapper .tarot-subtitle {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: var(--tarot-text-light) !important;
    text-align: center !important;
    margin: 30px 0 20px 0 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5) !important;
}

/* Instrucciones */
.tarot-app-wrapper .tarot-instructions {
    font-size: 1.1rem !important;
    color: var(--tarot-text-light) !important;
    text-align: center !important;
    margin: 0 auto 30px auto !important;
    max-width: 600px !important;
    line-height: 1.6 !important;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5) !important;
}

/* Contenedor de pregunta */
.tarot-app-wrapper .tarot-question-container {
    max-width: 600px !important;
    margin: 0 auto 30px auto !important;
    padding: 0 10px !important;
}

.tarot-app-wrapper .tarot-label {
    display: block !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: var(--tarot-accent-color) !important;
    margin-bottom: 10px !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
}

.tarot-app-wrapper .tarot-textarea {
    width: 100% !important;
    padding: 15px !important;
    border: 2px solid var(--tarot-secondary-color) !important;
    border-radius: var(--tarot-border-radius) !important;
    background: rgba(26, 26, 46, 0.8) !important;
    color: var(--tarot-text-light) !important;
    font-size: 1rem !important;
    font-family: inherit !important;
    resize: vertical !important;
    min-height: 80px !important;
    box-sizing: border-box !important;
    transition: var(--tarot-transition) !important;
}

.tarot-app-wrapper .tarot-textarea:focus {
    outline: none !important;
    border-color: var(--tarot-accent-color) !important;
    box-shadow: 0 0 15px rgba(255, 183, 0, 0.3) !important;
}

.tarot-app-wrapper .tarot-textarea::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

.tarot-app-wrapper .tarot-char-count {
    text-align: right !important;
    font-size: 0.85rem !important;
    color: rgba(255, 255, 255, 0.6) !important;
    margin-top: 5px !important;
}

/* Selección de cartas - Container con flexbox */
.tarot-app-wrapper .tarot-cards-selection {
    margin: 40px 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

.tarot-app-wrapper .tarot-deck-container {
    position: relative !important;
    margin: 30px auto 0 auto !important;
    max-width: 800px !important;
    min-height: 200px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 2 !important;
    order: 1 !important;
    margin-bottom: 40px !important;
}

.tarot-app-wrapper .tarot-deck {
    position: relative !important;
    width: 100% !important;
    height: 180px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    padding: 20px !important;
    z-index: 10 !important;
}

/* Cartas en el mazo */
.tarot-app-wrapper .tarot-card {
    width: 80px !important;
    height: 120px !important;
    position: relative !important;
    cursor: pointer !important;
    transition: var(--tarot-transition) !important;
    transform-style: preserve-3d !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
    z-index: 10 !important;
}

.tarot-app-wrapper .tarot-card:hover {
    transform: translateY(-10px) scale(1.05) !important;
    box-shadow: 0 8px 16px rgba(255, 183, 0, 0.4) !important;
}

.tarot-app-wrapper .tarot-card.selected {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
}

.tarot-app-wrapper .tarot-card-back {
    width: 100% !important;
    height: 100% !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #2d1b69 0%, #1a0f3d 100%) !important;
    border: 2px solid var(--tarot-accent-color) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    overflow: hidden !important;
}

.tarot-app-wrapper .tarot-card-back::before {
    content: '' !important;
    position: absolute !important;
    width: 60% !important;
    height: 60% !important;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="%23ffb700" stroke-width="2"/><path d="M50 20 L50 80 M20 50 L80 50" stroke="%23ffb700" stroke-width="2"/></svg>') !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

/* Cartas seleccionadas - SIEMPRE DEBAJO del mazo */
.tarot-app-wrapper .tarot-selected-cards {
    display: flex !important;
    justify-content: center !important;
    gap: 20px !important;
    margin: 0 0 40px 0 !important;
    flex-wrap: wrap !important;
    position: relative !important;
    z-index: 1 !important;
    clear: both !important;
    order: 2 !important;
    padding: 60px 10px !important;
}

.tarot-app-wrapper .tarot-selected-card-slot {
    width: 100px !important;
    height: 150px !important;
    border: 3px dashed rgba(255, 183, 0, 0.5) !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    background: rgba(26, 26, 46, 0.3) !important;
    transition: var(--tarot-transition) !important;
    z-index: 1 !important;
}

.tarot-app-wrapper .tarot-selected-card-slot.filled {
    border-color: var(--tarot-accent-color) !important;
    border-style: solid !important;
    background: rgba(26, 26, 46, 0.6) !important;
}

.tarot-app-wrapper .tarot-slot-number {
    font-size: 2rem !important;
    font-weight: bold !important;
    color: rgba(255, 183, 0, 0.3) !important;
    position: absolute !important;
}

.tarot-app-wrapper .tarot-selected-card-slot.filled .tarot-slot-number {
    display: none !important;
}

.tarot-app-wrapper .tarot-slot-card-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 6px !important;
    display: block !important;
}

.tarot-app-wrapper .tarot-selected-card-mini {
    width: 100% !important;
    height: 100% !important;
    border-radius: 6px !important;
    background-size: cover !important;
    background-position: center !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* Botones */
.tarot-app-wrapper .tarot-btn {
    display: inline-block !important;
    padding: 15px 40px !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    text-align: center !important;
    border: none !important;
    border-radius: 50px !important;
    cursor: pointer !important;
    transition: var(--tarot-transition) !important;
    text-decoration: none !important;
    box-shadow: var(--tarot-shadow) !important;
    margin: 20px auto !important;
    display: block !important;
    max-width: 400px !important;
}

.tarot-app-wrapper .tarot-btn-primary {
    background: linear-gradient(135deg, var(--tarot-accent-color) 0%, #ff9500 100%) !important;
    color: var(--tarot-text-dark) !important;
}

.tarot-app-wrapper .tarot-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff9500 0%, var(--tarot-accent-color) 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 40px rgba(255, 183, 0, 0.4) !important;
}

.tarot-app-wrapper .tarot-btn-secondary {
    background: linear-gradient(135deg, var(--tarot-secondary-color) 0%, var(--tarot-primary-color) 100%) !important;
    color: var(--tarot-text-light) !important;
    border: 2px solid var(--tarot-accent-color) !important;
}

.tarot-app-wrapper .tarot-btn-secondary:hover {
    background: linear-gradient(135deg, var(--tarot-primary-color) 0%, var(--tarot-secondary-color) 100%) !important;
    transform: translateY(-2px) !important;
}

.tarot-app-wrapper .tarot-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

/* Pantalla de carga */
.tarot-app-wrapper .tarot-loading-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 400px !important;
    padding: 40px !important;
}

.tarot-app-wrapper .tarot-spinner {
    width: 80px !important;
    height: 80px !important;
    border: 6px solid rgba(255, 183, 0, 0.2) !important;
    border-top-color: var(--tarot-accent-color) !important;
    border-radius: 50% !important;
    animation: tarotSpin 1s linear infinite !important;
    margin-bottom: 30px !important;
}

@keyframes tarotSpin {
    to { transform: rotate(360deg); }
}

.tarot-app-wrapper .tarot-loading-text {
    font-size: 1.3rem !important;
    color: var(--tarot-text-light) !important;
    text-align: center !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5) !important;
}

/* Pantalla de resultado */
.tarot-app-wrapper .tarot-result-content {
    padding: 20px !important;
}

.tarot-app-wrapper .tarot-result-title {
    font-size: 2rem !important;
    font-weight: bold !important;
    color: var(--tarot-accent-color) !important;
    text-align: center !important;
    margin: 0 0 30px 0 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5) !important;
}

/* Cartas reveladas */
.tarot-app-wrapper .tarot-revealed-cards {
    display: flex !important;
    justify-content: center !important;
    gap: 20px !important;
    margin: 30px 0 !important;
    flex-wrap: wrap !important;
}

.tarot-app-wrapper .tarot-revealed-card {
    text-align: center !important;
    animation: tarotReveal 0.6s ease !important;
}

.tarot-app-wrapper .tarot-revealed-card[data-card="1"] {
    animation-delay: 0.2s !important;
}

.tarot-app-wrapper .tarot-revealed-card[data-card="2"] {
    animation-delay: 0.4s !important;
}

.tarot-app-wrapper .tarot-revealed-card[data-card="3"] {
    animation-delay: 0.6s !important;
}

@keyframes tarotReveal {
    from {
        opacity: 0;
        transform: rotateY(90deg) scale(0.8);
    }
    to {
        opacity: 1;
        transform: rotateY(0) scale(1);
    }
}

.tarot-app-wrapper .tarot-card-image-wrapper {
    width: 140px !important;
    height: 210px !important;
    margin: 0 auto 15px auto !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    border: 3px solid var(--tarot-accent-color) !important;
}

.tarot-app-wrapper .tarot-card-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.tarot-app-wrapper .tarot-card-name {
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: var(--tarot-accent-color) !important;
    margin: 0 !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
}

/* Interpretación */
.tarot-app-wrapper .tarot-interpretation {
    max-width: 800px !important;
    margin: 40px auto !important;
    padding: 30px !important;
    background: rgba(26, 26, 46, 0.7) !important;
    border-radius: var(--tarot-border-radius) !important;
    border: 2px solid var(--tarot-secondary-color) !important;
    box-shadow: var(--tarot-shadow) !important;
}

.tarot-app-wrapper .tarot-interpretation-title {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: var(--tarot-accent-color) !important;
    margin: 0 0 20px 0 !important;
    text-align: center !important;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5) !important;
}

.tarot-app-wrapper .tarot-interpretation-text {
    font-size: 1.1rem !important;
    line-height: 1.8 !important;
    color: var(--tarot-text-light) !important;
    text-align: justify !important;
}

/* Modal */
.tarot-app-wrapper .tarot-modal {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.8) !important;
    z-index: 9999 !important;
    align-items: center !important;
    justify-content: center !important;
}

.tarot-app-wrapper .tarot-modal.active {
    display: flex !important;
}

.tarot-app-wrapper .tarot-modal-content {
    background: linear-gradient(135deg, var(--tarot-primary-color), var(--tarot-secondary-color)) !important;
    padding: 40px !important;
    border-radius: var(--tarot-border-radius) !important;
    max-width: 500px !important;
    width: 90% !important;
    text-align: center !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
    border: 2px solid var(--tarot-accent-color) !important;
    animation: tarotModalIn 0.3s ease !important;
}

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

.tarot-app-wrapper .tarot-modal-icon {
    font-size: 4rem !important;
    margin-bottom: 20px !important;
}

.tarot-app-wrapper .tarot-modal-title {
    font-size: 1.8rem !important;
    font-weight: bold !important;
    color: var(--tarot-accent-color) !important;
    margin: 0 0 15px 0 !important;
}

.tarot-app-wrapper .tarot-modal-message {
    font-size: 1.1rem !important;
    color: var(--tarot-text-light) !important;
    line-height: 1.6 !important;
    margin: 0 0 30px 0 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .tarot-app-wrapper .tarot-title {
        font-size: 2rem !important;
    }
    
    .tarot-app-wrapper .tarot-subtitle {
        font-size: 1.2rem !important;
    }
    
    .tarot-app-wrapper .tarot-instructions {
        font-size: 1rem !important;
    }
    
    .tarot-app-wrapper .tarot-card {
        width: 60px !important;
        height: 90px !important;
    }
    
    .tarot-app-wrapper .tarot-selected-card-slot {
        width: 80px !important;
        height: 120px !important;
    }
    
    .tarot-app-wrapper .tarot-card-image-wrapper {
        width: 110px !important;
        height: 165px !important;
    }
    
    .tarot-app-wrapper .tarot-revealed-cards {
        gap: 15px !important;
    }
    
    .tarot-app-wrapper .tarot-btn {
        padding: 12px 30px !important;
        font-size: 1rem !important;
    }
    
    /* IMPORTANTE: Forzar orden en móvil/tablet */
    .tarot-app-wrapper .tarot-cards-selection {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .tarot-app-wrapper .tarot-deck-container {
        order: 1 !important;
        margin-bottom: 30px !important;
    }
    
    .tarot-app-wrapper .tarot-selected-cards {
        order: 2 !important;
        margin-top: 0 !important;
        padding-top: 150px !important;
    }
}

@media (max-width: 480px) {
    #tarot-app-container.tarot-app-wrapper {
        padding: 15px !important;
    }
    
    .tarot-app-wrapper .tarot-title {
        font-size: 1.5rem !important;
    }
    
    .tarot-app-wrapper .tarot-card {
        width: 50px !important;
        height: 75px !important;
    }
    
    .tarot-app-wrapper .tarot-selected-card-slot {
        width: 70px !important;
        height: 105px !important;
    }
    
    .tarot-app-wrapper .tarot-card-image-wrapper {
        width: 90px !important;
        height: 135px !important;
    }
    
    .tarot-app-wrapper .tarot-interpretation {
        padding: 20px !important;
    }
}
