/**
 * Tarot Rider Waite AI - 3 Cartas
 * Estilos CSS con protección total contra WordPress
 * Diseño responsive y moderno
 */

/* ============================================================
   RESET Y WRAPPER PRINCIPAL (Protección WordPress)
   ============================================================ */
#tg-app-root-wrapper {
    all: initial !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

#tg-app-root-wrapper * {
    box-sizing: border-box !important;
}

/* ============================================================
   CONTENEDOR PRINCIPAL
   ============================================================ */
.tg-container {
    display: block !important;
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 20px !important;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%) !important;
    min-height: 100vh !important;
    font-family: 'Cormorant Garamond', serif !important;
    color: #f0e6d2 !important;
    position: relative !important;
}

/* ============================================================
   PANTALLAS (Screens)
   ============================================================ */
.tg-screen {
    display: none !important;
    animation: tg-fadeIn 0.5s ease-in-out !important;
}

.tg-screen.tg-active {
    display: block !important;
}

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

/* ============================================================
   HEADER
   ============================================================ */
.tg-header {
    text-align: center !important;
    margin-bottom: 40px !important;
}

.tg-title {
    font-family: 'Cinzel', serif !important;
    font-size: clamp(2rem, 5vw, 3.5rem) !important;
    font-weight: 700 !important;
    color: #ffd700 !important;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 0 40px rgba(255, 215, 0, 0.3) !important;
    margin: 0 0 20px 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
}

.tg-title-small {
    font-family: 'Cinzel', serif !important;
    font-size: clamp(1.5rem, 4vw, 2.5rem) !important;
    font-weight: 600 !important;
    color: #ffd700 !important;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4) !important;
    margin: 0 0 15px 0 !important;
    padding: 0 !important;
    line-height: 1.3 !important;
}

.tg-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.3rem) !important;
    color: #c9b896 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-weight: 300 !important;
    font-style: italic !important;
    line-height: 1.5 !important;
}

/* ============================================================
   CAJA DE PREGUNTA
   ============================================================ */
.tg-question-box {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 2px solid rgba(255, 215, 0, 0.3) !important;
    border-radius: 15px !important;
    padding: 30px !important;
    margin: 30px 0 !important;
    backdrop-filter: blur(10px) !important;
}

.tg-label {
    display: block !important;
    font-size: clamp(1.1rem, 2vw, 1.4rem) !important;
    color: #ffd700 !important;
    margin-bottom: 15px !important;
    font-weight: 400 !important;
    text-align: left !important;
}

.tg-textarea {
    width: 100% !important;
    min-height: 120px !important;
    padding: 15px !important;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem) !important;
    font-family: 'Cormorant Garamond', serif !important;
    color: #f0e6d2 !important;
    background: rgba(0, 0, 0, 0.3) !important;
    border: 2px solid rgba(255, 215, 0, 0.2) !important;
    border-radius: 10px !important;
    resize: vertical !important;
    transition: all 0.3s ease !important;
    line-height: 1.6 !important;
}

.tg-textarea:focus {
    outline: none !important;
    border-color: #ffd700 !important;
    background: rgba(0, 0, 0, 0.4) !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2) !important;
}

.tg-textarea::placeholder {
    color: rgba(240, 230, 210, 0.4) !important;
    font-style: italic !important;
}

.tg-char-counter {
    text-align: right !important;
    font-size: 0.9rem !important;
    color: #c9b896 !important;
    margin-top: 8px !important;
}

/* ============================================================
   BOTONES
   ============================================================ */
.tg-btn {
    display: block !important;
    width: 100% !important;
    max-width: 400px !important;
    margin: 20px auto !important;
    padding: 18px 35px !important;
    font-size: clamp(1rem, 2vw, 1.2rem) !important;
    font-family: 'Cinzel', serif !important;
    font-weight: 600 !important;
    color: #0f0c29 !important;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%) !important;
    border: none !important;
    border-radius: 50px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-align: center !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3) !important;
}

.tg-btn:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 12px 35px rgba(255, 215, 0, 0.5) !important;
    background: linear-gradient(135deg, #ffed4e 0%, #ffd700 100%) !important;
}

.tg-btn:active {
    transform: translateY(-1px) !important;
}

.tg-btn-secondary {
    background: linear-gradient(135deg, #6a5acd 0%, #9370db 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 25px rgba(106, 90, 205, 0.3) !important;
}

.tg-btn-secondary:hover {
    background: linear-gradient(135deg, #9370db 0%, #6a5acd 100%) !important;
    box-shadow: 0 12px 35px rgba(106, 90, 205, 0.5) !important;
}

.tg-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* ============================================================
   CONTADOR DE CARTAS
   ============================================================ */
.tg-counter {
    background: rgba(255, 215, 0, 0.1) !important;
    border: 2px solid rgba(255, 215, 0, 0.3) !important;
    border-radius: 50px !important;
    padding: 12px 25px !important;
    margin: 20px auto !important;
    display: inline-block !important;
    font-size: clamp(1rem, 2vw, 1.2rem) !important;
    font-weight: 600 !important;
    color: #ffd700 !important;
    text-align: center !important;
}

/* ============================================================
   GRID DE CARTAS
   ============================================================ */
.tg-cards-grid {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 15px !important;
    margin: 30px 0 !important;
    padding: 0 !important;
}

@media (max-width: 1024px) {
    .tg-cards-grid {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 12px !important;
    }
}

@media (max-width: 768px) {
    .tg-cards-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 10px !important;
    }
}

@media (max-width: 480px) {
    .tg-cards-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
}

/* ============================================================
   CARTA INDIVIDUAL
   ============================================================ */
.tg-card {
    aspect-ratio: 2/3 !important;
    position: relative !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    transform-style: preserve-3d !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.tg-card:hover {
    transform: translateY(-8px) scale(1.05) !important;
    z-index: 10 !important;
}

.tg-card-inner {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    transition: transform 0.6s !important;
    transform-style: preserve-3d !important;
}

.tg-card.tg-flipped .tg-card-inner {
    transform: rotateY(180deg) !important;
}

.tg-card-front,
.tg-card-back {
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    backface-visibility: hidden !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.tg-card-front {
    background: #2a2438 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid rgba(255, 215, 0, 0.3) !important;
}

.tg-card-back {
    transform: rotateY(180deg) !important;
    background: #1a1a2e !important;
}

.tg-card-back img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

/* Estado seleccionado */
.tg-card.tg-selected .tg-card-front {
    border-color: #ffd700 !important;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 
                inset 0 0 30px rgba(255, 215, 0, 0.2) !important;
    animation: tg-pulse 1.5s infinite !important;
}

@keyframes tg-pulse {
    0%, 100% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 
                    inset 0 0 30px rgba(255, 215, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 50px rgba(255, 215, 0, 1), 
                    inset 0 0 50px rgba(255, 215, 0, 0.4);
    }
}

.tg-card.tg-disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* ============================================================
   CARTAS SELECCIONADAS (Resultado)
   ============================================================ */
.tg-selected-cards {
    display: flex !important;
    justify-content: center !important;
    gap: 20px !important;
    margin: 30px 0 !important;
    flex-wrap: wrap !important;
}

.tg-selected-card {
    width: 200px !important;
    max-width: 30% !important;
    aspect-ratio: 2/3 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    border: 3px solid rgba(255, 215, 0, 0.5) !important;
    position: relative !important;
}

.tg-selected-card img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.tg-selected-card::after {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 215, 0, 0.1) 100%) !important;
    pointer-events: none !important;
}

@media (max-width: 768px) {
    .tg-selected-card {
        width: 150px !important;
        max-width: 28% !important;
    }
}

@media (max-width: 480px) {
    .tg-selected-cards {
        gap: 10px !important;
    }
    .tg-selected-card {
        width: 100px !important;
        max-width: 30% !important;
    }
}

/* ============================================================
   RESULTADO DE LECTURA
   ============================================================ */
.tg-reading-result {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 2px solid rgba(255, 215, 0, 0.3) !important;
    border-radius: 15px !important;
    padding: 30px !important;
    margin: 30px 0 !important;
    backdrop-filter: blur(10px) !important;
    min-height: 200px !important;
}

.tg-reading-text {
    font-size: clamp(1rem, 2vw, 1.2rem) !important;
    line-height: 1.8 !important;
    color: #f0e6d2 !important;
    text-align: justify !important;
    white-space: pre-wrap !important;
}

.tg-reading-text p {
    margin: 0 0 15px 0 !important;
    padding: 0 !important;
}

/* ============================================================
   LOADING
   ============================================================ */
.tg-loading {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 40px !important;
    gap: 20px !important;
}

.tg-spinner {
    width: 60px !important;
    height: 60px !important;
    border: 4px solid rgba(255, 215, 0, 0.2) !important;
    border-top-color: #ffd700 !important;
    border-radius: 50% !important;
    animation: tg-spin 1s linear infinite !important;
}

@keyframes tg-spin {
    to {
        transform: rotate(360deg);
    }
}

.tg-loading p {
    font-size: clamp(1rem, 2vw, 1.2rem) !important;
    color: #ffd700 !important;
    margin: 0 !important;
    font-style: italic !important;
}

/* ============================================================
   MODALES
   ============================================================ */
.tg-modal {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.85) !important;
    z-index: 10000 !important;
    align-items: center !important;
    justify-content: center !important;
    backdrop-filter: blur(5px) !important;
    padding: 20px !important;
}

.tg-modal.tg-active {
    display: flex !important;
    animation: tg-fadeIn 0.3s ease-in-out !important;
}

.tg-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #2a2438 100%) !important;
    border: 3px solid rgba(255, 215, 0, 0.5) !important;
    border-radius: 20px !important;
    padding: 40px !important;
    max-width: 500px !important;
    width: 100% !important;
    text-align: center !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8) !important;
}

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

.tg-modal-title {
    font-family: 'Cinzel', serif !important;
    font-size: clamp(1.5rem, 3vw, 2rem) !important;
    color: #ffd700 !important;
    margin: 0 0 15px 0 !important;
    padding: 0 !important;
}

.tg-modal-message {
    font-size: clamp(1rem, 2vw, 1.2rem) !important;
    color: #f0e6d2 !important;
    line-height: 1.6 !important;
    margin: 0 0 20px 0 !important;
    padding: 0 !important;
}

.tg-modal-stats {
    background: rgba(255, 215, 0, 0.1) !important;
    border: 1px solid rgba(255, 215, 0, 0.3) !important;
    border-radius: 10px !important;
    padding: 15px !important;
    margin: 20px 0 !important;
}

.tg-modal-stats p {
    font-size: 1.1rem !important;
    color: #ffd700 !important;
    margin: 0 !important;
    font-weight: 600 !important;
}

/* ============================================================
   RESPONSIVE ADICIONAL
   ============================================================ */
@media (max-width: 768px) {
    .tg-container {
        padding: 15px !important;
    }
    
    .tg-question-box {
        padding: 20px !important;
    }
    
    .tg-modal-content {
        padding: 30px 20px !important;
    }
}

@media (max-width: 480px) {
    .tg-container {
        padding: 10px !important;
        min-height: auto !important;
    }
    
    .tg-header {
        margin-bottom: 25px !important;
    }
    
    .tg-question-box {
        padding: 15px !important;
        margin: 20px 0 !important;
    }
    
    .tg-reading-result {
        padding: 20px !important;
    }
}

/* ============================================================
   SVG REVERSO DE CARTA
   ============================================================ */
.tg-card-back-svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.tg-hidden {
    display: none !important;
}

.tg-text-center {
    text-align: center !important;
}

.tg-mt-20 {
    margin-top: 20px !important;
}

.tg-mb-20 {
    margin-bottom: 20px !important;
}
