/* client/css/tarot.css */

:root {
    --bg-deep: #0a0e27;
    --bg-card: #1a1f3a;
    --accent-gold: #ffd700;
    --accent-glow: rgba(255, 215, 0, 0.3);
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --primary-purple: #b537f2;
    --font-serif: 'Meatbusters', 'Times New Roman', serif;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    margin: 0;
    font-family: 'Verdana', sans-serif; /* Fallback */
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Effects */
.background-effects {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    background: url('/Resources/Background/background 1.png') no-repeat center center fixed;
    background-size: cover;
    pointer-events: none;
}

/* Ensure sections are transparent so background shows through */
.tarot-container, 
.hero-section, 
.selection-section, 
.spread-card,
.footer {
    background: transparent !important;
}

/* Add slight overlay to cards for readability */
.spread-card {
    background: rgba(10, 14, 39, 0.6) !important; 
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    /* ... existing styles ... */
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s, background 0.3s;
    position: relative;
    overflow: hidden;
}

.ambient-glow {
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(181, 55, 242, 0.05) 0%, transparent 60%);
    animation: pulseGlow 15s infinite alternate;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes floatParticle {
    0% { transform: translateY(0); opacity: 0; }
    20% { opacity: 0.5; }
    80% { opacity: 0.5; }
    100% { transform: translateY(-100vh); opacity: 0; }
}

/* Typography */
.mystic-title {
    font-family: var(--font-serif);
    font-size: 3.5rem;
    color: #fff;
    text-shadow: 0 0 20px var(--primary-purple);
    margin-bottom: 1rem;
    text-align: center;
}

.mystic-subtitle {
    font-size: 1.6rem;
    color: var(--accent-gold);
    letter-spacing: 3px;
    text-align: center;
    font-family: var(--font-serif);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    margin-bottom: 2rem;
    animation: breathe 4s ease-in-out infinite;
    font-weight: 300;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); opacity: 0.9; text-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
    50% { transform: scale(1.02); opacity: 1; text-shadow: 0 0 25px rgba(255, 215, 0, 0.8); }
}

.question-container {
    margin-top: 3rem !important;
    width: 100%;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

#userQuestion {
    width: 100%;
    padding: 1.2rem 2rem;
    font-size: 1.2rem;
    border-radius: 50px;
    border: 2px solid rgba(181, 55, 242, 0.3);
    background: rgba(10, 14, 39, 0.6);
    color: #ffd700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
    text-align: center;
    font-family: var(--font-serif);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    outline: none !important;
}

#userQuestion:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 30px rgba(181, 55, 242, 0.4), inset 0 0 20px rgba(181, 55, 242, 0.1);
    background: rgba(10, 14, 39, 0.9);
    transform: translateY(-2px);
    letter-spacing: 1px;
}

#userQuestion::placeholder {
    color: rgba(224, 224, 224, 0.5);
    font-style: italic;
    font-family: 'Verdana', sans-serif;
    font-size: 1rem;
    letter-spacing: 0;
}

.input-glow {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100%; height: 100%;
    border-radius: 50px;
    box-shadow: 0 0 20px rgba(181, 55, 242, 0.2);
    z-index: -1;
    transition: all 0.5s ease;
}

#userQuestion:focus + .input-glow {
    box-shadow: 0 0 40px rgba(181, 55, 242, 0.6), 0 0 80px rgba(181, 55, 242, 0.3);
}

.back-link:hover {
    color: var(--accent-gold);
    text-shadow: 0 0 10px var(--accent-glow);
}

/* Layout */
.tarot-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-section {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.cta-button {
    margin-top: 2rem;
    padding: 1rem 3rem;
    background: transparent;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-family: var(--font-serif);
}

.cta-button:hover {
    background: var(--accent-gold);
    color: var(--bg-deep);
    box-shadow: 0 0 30px var(--accent-glow);
}

/* Selection Grid */
.selection-section {
    padding: 0 0 2rem 0;
    min-height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.selection-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.spread-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    width: 100%;
}

/* Spread card styling updated in background-effects block above */
.spread-card {
    flex: 0 1 300px;
    max-width: 320px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(10, 14, 39, 0.6) !important; 
    /* ... existing styles ... */
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s, background 0.3s;
    position: relative;
    overflow: hidden;
}

.spread-card.recommended {
    border-color: var(--primary-purple);
    box-shadow: 0 0 15px rgba(181, 55, 242, 0.2);
}

.spread-card.locked {
    opacity: 0.7;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

.mystic-card-title {
    font-family: 'Meatbusters', 'Cinzel', serif; /* Use magical font */
    font-size: 2.4rem; /* Larger for visibility */
    margin: 0.8rem 0;
    
    /* Magical Gradient Text */
    background: linear-gradient(
        to right,
        #fff 0%,
        #e0c3fc 20%,
        #8ec5fc 40%,
        #fff 60%,
        #e0c3fc 80%,
        #8ec5fc 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    
    /* Glow Effect */
    text-shadow: 0 0 20px rgba(181, 55, 242, 0.5);
    
    letter-spacing: 1px;
    position: relative;
    z-index: 2;
    transition: all 0.4s ease;
    animation: mysticShimmer 5s linear infinite;
}

@keyframes mysticShimmer {
    to {
        background-position: 200% center;
    }
}

.spread-card:hover .mystic-card-title {
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0.8),
        0 0 20px rgba(181, 55, 242, 0.8),
        0 0 40px rgba(181, 55, 242, 0.4);
    transform: scale(1.05);
}

/* Add style for the active reading title */
.mystic-reading-title {
    font-family: 'Meatbusters', 'Cinzel', serif;
    font-size: 3.5rem; /* Massive for impact */
    text-transform: uppercase;
    text-align: center;
    margin: 0;
    line-height: 1.2;

    /* Cosmic Gradient */
    background: linear-gradient(
        45deg,
        #00f0ff,
        #b537f2,
        #ffd700,
        #00f0ff
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    
    /* Strong Glow */
    text-shadow: 0 0 30px rgba(181, 55, 242, 0.6);
    animation: flowGradient 6s ease infinite;
}

@keyframes flowGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Fallback for older browsers if needed, though most support bg-clip text */
@supports not (background-clip: text) {
    .mystic-card-title {
        background: none;
        color: #e0c3fc;
    }
}

.badge {
    display: inline-block;
    background: var(--primary-purple);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.lock-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: var(--accent-gold);
    opacity: 0;
    transition: opacity 0.3s;
}

.spread-card.locked:hover .lock-overlay {
    opacity: 1;
}

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

input#userQuestion {
    width: 100%;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--text-muted);
    color: #fff;
    border-radius: 4px;
    font-size: 1.1rem;
    text-align: center;
    transition: border-color 0.3s;
}

input#userQuestion:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 10px rgba(181, 55, 242, 0.3);
}

/* Card Reading Area */
.board-section {
    padding-top: 2rem;
    min-height: 80vh;
}

.active-spread-info {
    text-align: center;
    margin-bottom: 2rem;
}

.reset-btn {
    background: linear-gradient(135deg, rgba(181, 55, 242, 0.2), rgba(10, 14, 39, 0.8));
    border: 1px solid var(--primary-purple);
    color: #e0e0e0;
    padding: 0.8rem 2.5rem;
    cursor: pointer;
    font-family: var(--font-serif);
    transition: all 0.4s ease;
    margin-top: 1.5rem;
    font-size: 1.1rem;
    position: relative;
    overflow: hidden;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 5px rgba(181, 55, 242, 0.5);
    box-shadow: 0 0 15px rgba(181, 55, 242, 0.2), inset 0 0 10px rgba(181, 55, 242, 0.1);
    border-radius: 50px;
    backdrop-filter: blur(5px);
}

.reset-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.2), transparent);
    transition: 0.5s;
}

.reset-btn:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 0 25px rgba(181, 55, 242, 0.5), 0 0 10px var(--accent-gold);
    background: rgba(181, 55, 242, 0.3);
    transform: translateY(-3px);
    text-shadow: 0 0 8px var(--accent-gold);
}

.reset-btn:hover::before {
    left: 100%;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    font-family: var(--font-serif);
    transition: all 0.3s;
    margin-top: 10px;
}

.action-btn:hover {
    border-color: #fff;
    color: #fff;
}

.action-btn {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    margin-top: 2rem;
}

.action-btn:hover {
    background: var(--accent-gold);
    color: var(--bg-deep);
}

.cards-layout {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin: 3rem 0;
    perspective: 1000px;
}

/* The Card Itself */
.tarot-card {
    width: 200px;
    height: 340px;
    position: relative;
    transform-style: preserve-3d;
    cursor: pointer;
    opacity: 1; /* Default visible */
    pointer-events: none; /* Prevent interaction during deal */
}

/* Transition enabled only after dealing animation */
.tarot-card.interactive {
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
    pointer-events: auto; /* Enable interaction */
}

/* Initial state for dealing animation */
.hidden-card {
    opacity: 0;
    transform: translateY(50px) scale(0.9);
    pointer-events: none; /* Prevent clicking while invisible */
}

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

.card-face {
    position: absolute;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    overflow: hidden;
    /* Box shadow removed from container face to allow image shape */
}

/* Add shadow specifically to card contents */
.card-back, .card-front img {
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.card-back {
    background: url('/Resources/Tarot/major_23_back.jpeg') no-repeat center center;
    background-size: cover;
    border: 2px solid var(--accent-gold);
}

.card-front {
    background: transparent;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
}

.card-front img {
    /* ... existing styles ... */
    width: 100%;
    height: 100%; /* Ensure full height usage */
    flex: 1; 
    object-fit: contain; 
    border-radius: 8px; /* Smooth corners */
    min-height: 0; 
    background: transparent;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.5)); /* Better shadow for non-rectangular images if any */
}

.card-info {
    padding: 0.5rem;
    text-align: center;
    background: transparent;
    color: var(--accent-gold);
    flex-shrink: 0; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-top: none;
    min-height: 40px; 
}

/* Remove name styling as element is gone */
.card-info small {
    font-family: var(--font-serif);
    font-size: 1rem; /* Slightly larger since it's the only text */
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8); /* readable on dark bg */
}

.card-info small {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Interpretation Panel */
.interpretation-panel {
    background: rgba(0,0,0,0.4);
    border-left: 3px solid var(--primary-purple);
    padding: 2rem;
    margin-top: 4rem;
    margin-bottom: 4rem;
    animation: fadeIn 1s ease;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.interpretation-panel h3 {
    font-family: var(--font-serif);
    color: var(--primary-purple);
    margin-top: 0;
}

.ai-content p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.hidden {
    display: none !important;
}

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

/* Skeleton Loading */
.skeleton-loader {
    height: 20px;
    width: 100%;
    background: linear-gradient(90deg, #1a1f3a 25%, #2a3055 50%, #1a1f3a 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 10px;
}

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

/* Cost Modal */
.cost-modal-overlay {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

.cost-modal {
    background-color: var(--bg-card);
    border: 2px solid var(--primary-purple);
    padding: 3rem;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 0 50px rgba(181, 55, 242, 0.3);
    position: relative;
    overflow: hidden;
}

.cost-modal::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(181, 55, 242, 0.1) 0%, transparent 60%);
    animation: pulseGlow 8s infinite alternate;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .cards-layout {
        flex-direction: column;
        align-items: center;
    }
    
    .mystic-title {
        font-size: 2.5rem;
    }
    
    .hero-section {
        min-height: 60vh;
    }
}
.btn-icon { margin-right: 8px; font-size: 1.2em; vertical-align: middle; }
