/**
 * Tarot Español AI - Estilos Principales
 * Diseño responsive y profesional
 */

/* ============================================
   VARIABLES CSS
   ============================================ */
:root {
    --bg-primary: #171E36;
    --bg-secondary: #1F2937;
    --bg-card: #2D3748;
    --text-primary: #FFFFFF;
    --text-secondary: #CBD5E0;
    --accent-gold: #FFD700;
    --accent-gold-light: #FFF4CC;
    --accent-purple: #9333EA;
    --border-color: #4A5568;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 0 20px rgba(255, 215, 0, 0.5);
    
    --font-title: 'Cinzel', serif;
    --font-body: 'Lato', sans-serif;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.tarot-container {
    width: 100%;
    max-width: 1200px;
    min-height: 600px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    padding: 2rem;
    box-sizing: border-box;
}

/* ============================================
   STEPS (Pasos de la aplicación)
   ============================================ */
.step {
    display: none;
    animation: fadeIn 0.4s ease;
}

.step.active {
    display: block;
}

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

/* ============================================
   PASO 1: PREGUNTA
   ============================================ */
.header-section {
    text-align: center;
    margin-bottom: 3rem;
}

.app-title {
    font-family: var(--font-title);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.app-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--text-secondary);
    font-weight: 300;
}

.question-container {
    max-width: 600px;
    margin: 0 auto;
}

.question-label {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.question-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-body);
    resize: vertical;
    transition: border-color var(--transition-normal);
    box-sizing: border-box;
}

.question-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

.question-input::placeholder {
    color: #718096;
}

.char-counter {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    font-size: 1.0625rem;
    font-weight: 600;
    font-family: var(--font-body);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
    text-decoration: none;
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold), #FFA500);
    color: #1A202C;
    margin-top: 1.5rem;
    width: 100%;
}

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

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

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    margin-top: 2rem;
}

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

/* ============================================
   PASO 2: SELECCIÓN DE CARTAS
   ============================================ */
.selection-header {
    text-align: center;
    margin-bottom: 2rem;
}

.selection-title {
    font-family: var(--font-title);
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 1rem;
}

.card-counter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
}

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

.counter-numbers {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-gold);
}

/* Grid de Cartas */
.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 640px) {
    .deck-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 1.25rem;
    }
}

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

/* Carta en el mazo */
.card-back {
    position: relative;
    aspect-ratio: 2/3;
    background: linear-gradient(135deg, #1E3A8A, #7C3AED);
    border: 3px solid var(--accent-gold);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-normal);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.card-back::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 70%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M50,10 L60,40 L90,40 L65,60 L75,90 L50,70 L25,90 L35,60 L10,40 L40,40 Z" fill="gold" opacity="0.3"/></svg>') center/contain no-repeat;
}

.card-back:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.card-back.selected {
    border-color: var(--accent-gold);
    box-shadow: var(--shadow-gold);
    animation: goldenPulse 1.5s infinite;
}

@keyframes goldenPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.9);
        transform: scale(1.05);
    }
}

/* ============================================
   PASO 3: LECTURA
   ============================================ */
.reading-header {
    text-align: center;
    margin-bottom: 2rem;
}

.reading-title {
    font-family: var(--font-title);
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    color: var(--accent-gold);
}

/* Cartas Seleccionadas Visibles */
.selected-cards {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.revealed-card {
    position: relative;
    width: 140px;
    animation: flipCard 0.6s ease;
}

.revealed-card img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--accent-gold);
}

.revealed-card .card-name {
    text-align: center;
    margin-top: 0.75rem;
    font-weight: 600;
    color: var(--accent-gold);
    font-size: 0.9375rem;
}

@keyframes flipCard {
    0% {
        transform: rotateY(90deg);
        opacity: 0;
    }
    100% {
        transform: rotateY(0);
        opacity: 1;
    }
}

@media (min-width: 640px) {
    .revealed-card {
        width: 180px;
    }
}

/* Loading */
.loading-container {
    text-align: center;
    padding: 3rem 1rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* Resultado */
.result-container {
    animation: fadeIn 0.5s ease;
}

.result-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.result-text {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-line;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s ease;
}

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

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-message {
    font-size: 1.0625rem;
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-buttons .btn {
    margin-top: 0;
    flex: 1;
    min-width: 120px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .tarot-container {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .deck-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.75rem;
    }
    
    .revealed-card {
        width: 120px;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

/* Prevenir selección de texto en elementos interactivos */
.card-back,
.btn {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}
