/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Intro Overlay */
#intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    z-index: 1000;
    transition: opacity 0.5s ease-out;
}

/* Language Selector */
#language-selector {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 50px; /* Pill shape */
    z-index: 1001; /* Ensure it's above other intro content */
}

.lang-btn {
    background-color: transparent;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 50px; /* Pill shape for each button */
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s;
}

.lang-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.lang-btn.active {
    background-color: #fff;
    color: #6a11cb; /* Use the main theme color for text */
    font-weight: 700;
}

#intro-mascot {
    width: 150px;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

#intro-content h1 {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#begin-btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    background-color: #6a11cb;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#start-chat-button:hover {
    background-color: #2575fc;
}

/* Chat Container */
.chat-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#chat-header {
    padding: 1rem;
    background-color: #6a11cb;
    color: #fff;
    text-align: center;
    border-bottom: 1px solid #5a0fb1;
}

#chat-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}



#message-list {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    max-width: 70%;
    line-height: 1.5;
}

.message.user {
    background-color: #0084ff;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.tarot {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background-color: transparent;
    padding: 0;
    align-self: flex-start;
}

.message.card-message {
    width: 90%;
    max-width: 700px;
    display: flex;
}

.message.card-message .tarot-bubble {
    flex-grow: 1;
}

.tarot-mascot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-bottom: 4px;
}

.tarot-bubble {
    background-color: #e4e6eb;
    color: #050505;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 100%;
}

.tarot-bubble.card-bubble {
    padding: 0;
    background-color: transparent;
    overflow: hidden; /* Ensure inner radius is respected */
}

.shuffle-animation-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    min-height: 280px;
    position: relative;
    width: 100%;
    background-color: #f9f9f9;
    border-radius: 18px;
    transition: all 0.3s ease-in-out;
}

.shuffling-card {
    width: 80px;
    height: 140px;
    background-image: url('../images/card_back.jpg');
    background-size: cover;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    position: absolute;
    animation: shuffle 0.6s ease-in-out 2;
}

@keyframes shuffle {
    0% { transform: translate(0, 0) rotate(0); }
    20% { transform: translate(-60px, -25px) rotate(-10deg); }
    40% { transform: translate(60px, 25px) rotate(10deg); }
    60% { transform: translate(-40px, 35px) rotate(-5deg); }
    80% { transform: translate(40px, -35px) rotate(5deg); }
    100% { transform: translate(0, 0) rotate(0); }
}

@keyframes deal-past {
    from { transform: translate(0, 0) rotate(0); }
    to { transform: translate(-120px, 0) rotate(-5deg); }
}

@keyframes deal-present {
    from { transform: translate(0, 0) rotate(0); }
    to { transform: translate(0, 0) rotate(0); }
}

@keyframes deal-future {
    from { transform: translate(0, 0) rotate(0); }
    to { transform: translate(120px, 0) rotate(5deg); }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0px);
    }
}

.card-display-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    width: 100%;
    padding: 1rem;
    gap: 0.5rem;
}

.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 32%;
    max-width: 100px;
}

.card img {
    width: 100%;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease;
}

.card img.reversed {
    transform: rotate(180deg);
}

.card p {
    font-weight: bold;
    font-size: 0.9rem;
    color: #c4b5fd;
    margin: 0.2rem 0 0.1rem 0;
}

.card span {
    font-size: 0.75rem;
    color: #a78bfa;
    font-style: italic;
}

#chat-input-area {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #ddd;
    background-color: #fff;
}

#mode-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 0.75rem 1rem 0;
}

.mode-btn {
    background-color: #e4e6eb;
    color: #050505;
    border: none;
    padding: 8px 16px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s;
}

.mode-btn:hover {
    background-color: #d1d3d8;
}

.mode-btn.active {
    background-color: #6a11cb;
    color: #fff;
    font-weight: 700;
}

#chat-form {
    display: flex;
    padding: 1rem;
    /* border-top and background-color moved to #chat-input-area */
}

#message-input {
    flex-grow: 1;
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 18px;
    font-size: 1rem;
}

#chat-form button {
    background-color: #6a11cb;
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 18px;
    margin-left: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

#chat-header-mascot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 0.75rem;
    border: 2px solid #fff;
}

#chat-form button:hover {
    background-color: #2575fc;
}

.tarot-bubble strong {
    font-weight: 600;
    color: #9B59B6; /* A nice mystical purple */
}

.tarot-bubble em {
    color: #d1c4e9;
    font-style: italic;
}

.typing-cursor {
    display: inline-block;
    width: 8px;
    height: 1.2em;
    background-color: #fff;
    animation: blink 1s infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Interactive Card Flip Styles */
.card-container {
    perspective: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 32%;
    max-width: 120px;
}

.card-flipper {
    position: relative;
    width: 100%;
    padding-top: 175%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    cursor: pointer;
}

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

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.card-front {
    transform: rotateY(180deg);
    background-color: #fff;
}

.card-back {
    background-color: #6a11cb;
}

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

.card-face img.reversed {
    transform: rotate(180deg);
}

.card-container p {
    font-weight: bold;
    font-size: 0.9rem;
    color: #333;
    margin: 0.5rem 0 0.1rem 0;
}

.card-container span {
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
    visibility: hidden; /* Hide name until flipped */
}

.card-flipper.flipped + p + span {
    visibility: visible; /* Show name when flipped */
}

/* Reveal Reading Button */
#reveal-reading-btn {
    display: block;
    margin: 1.5rem auto 0.5rem;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    background-color: #2575fc;
    color: #fff;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 4px 15px rgba(37, 117, 252, 0.4);
}

#reveal-reading-btn:hover {
    background-color: #6a11cb;
    transform: translateY(-2px);
}
