/* style.css */

:root {
    /* --- Rich Cream Theme --- */
    --background: #f5f2e9;      /* A richer, parchment-like cream for the main background */
    --text: #2c2828;            /* A very dark, soft brown instead of pure black */
    --card: #fdfbf6;            /* A very light cream for cards, off-white */
    --border: #e8e4d9;          /* A subtle border that complements both creams */
    --primary: #4f46e5;
    --success: #16a34a;
    --primary-light: #e0e7ff;
    --subtle-bg: #eae7e1;      /* A slightly darker cream for internal elements */
}

::selection {
    background-color: var(--primary);
    color: #fff;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text);
    scroll-behavior: smooth;
}

.nav-link {
    color: #4b5563; /* gray-600 */
    transition: color 0.2s ease-in-out;
}
.nav-link:hover {
    color: var(--primary);
}

.hero-gradient-text {
    background: linear-gradient(90deg, #a78bfa, #f472b6, #fbbf24);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}


/* --- Live Demo Component --- */
#live-demo-container {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 1.5rem; /* More rounded */
    padding: 2rem;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,.04), 0 8px 10px -6px rgba(0,0,0,.04);
}
.demo-controls {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
@media (min-width: 768px) {
    .demo-controls {
        grid-template-columns: 1fr 1fr;
        align-items: flex-end;
    }
}
.control-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #4b5563; /* gray-600 */
}
/* NEW: Style for the language button in the demo */
.language-select-btn {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background-color: var(--card);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.language-select-btn:hover {
    border-color: #d1d5db;
}

.difficulty-pills { display: flex; background-color: var(--subtle-bg); border-radius: 0.5rem; padding: 0.25rem; }
.difficulty-pills button {
    flex-grow: 1;
    padding: 0.5rem 0;
    border: none;
    background: transparent;
    border-radius: 0.375rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s ease-in-out;
}
.difficulty-pills button.active {
    background-color: var(--card);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.generate-button {
    width: 100%;
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    padding: 0.875rem;
    border-radius: 0.75rem;
    border: none;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}
.generate-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.2), 0 4px 6px -2px rgba(79, 70, 229, 0.1);
}
.generate-button:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

.demo-output-container {
    margin-top: 1.5rem;
    background-color: var(--subtle-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.loader-container { text-align: center; }
.loader {
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.error-container {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    padding: 1rem;
    width: 100%;
}

#results-container { width: 100%; }
.result-item { padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.result-item.border-none { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.result-heading {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.play-button {
    background-color: var(--primary-light);
    color: var(--primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
}
.play-button:hover { background-color: #c7d2fe; }
.play-button.playing { background-color: var(--primary); color: white; }

.sentence-text { font-size: 1.25rem; font-weight: 500; line-height: 1.6; }
.sentence-text span {
    cursor: pointer;
    border-bottom: 2px dotted transparent;
    transition: background-color 0.2s, border-color 0.2s;
    padding: 2px 0;
    margin: -2px 0;
}
.sentence-text span:hover {
    background-color: var(--primary-light);
}
.translation-text { color: #4b5563; font-style: italic; }
.explanation-text { line-height: 1.7; }
.model-info-text { font-size: 0.8rem; color: #9ca3af; text-align: right; }

.word-tooltip {
    position: absolute;
    background-color: #111827;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.feature-card-recreation { background-color: var(--card); border-radius: 1rem; box-shadow: 0 4px 12px -1px rgba(0,0,0,.04), 0 2px 8px -2px rgba(0,0,0,.03); border: 1px solid var(--border); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.feature-card-recreation:hover { transform: translateY(-5px); box-shadow: 0 10px 25px -5px rgba(0,0,0,.06), 0 8px 10px -6px rgba(0,0,0,.04); }
.feature-icon-wrapper { flex-shrink: 0; height: 3rem; width: 3rem; border-radius: 0.75rem; background-color: var(--primary-light); display: flex; align-items: center; justify-content: center; }
.fade-in-up { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.fade-in-up.is-visible { opacity: 1; transform: translateY(0); }
#xp-bar { transition: width 1.5s cubic-bezier(0.25, 1, 0.5, 1); }
.flippable-card-container { perspective: 1000px; }
.flippable-card { position: relative; width: 100%; transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1); min-height: 90px; }
.flippable-card-container:hover .flippable-card { transform: rotateY(180deg); }
.card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 0.75rem; padding: 1rem; display: flex; align-items: center; justify-content: center; background-color: var(--card); border: 1px solid var(--border); }
.card-front { justify-content: flex-start; }
.card-back { transform: rotateY(180deg); flex-direction: column; text-align: center; }
.how-it-works-step { background-color: var(--card); border: 2px solid var(--primary-light); border-radius: 9999px; width: 6rem; height: 6rem; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; font-size: 1.875rem; font-weight: 700; color: var(--primary); box-shadow: 0 4px 12px -1px rgba(0,0,0,.07); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.how-it-works-step:hover { transform: scale(1.1); box-shadow: 0 10px 25px -5px rgba(0,0,0,.1); }
#how-it-works-path { stroke-dashoffset: 1000; stroke-dasharray: 1000; transition: stroke-dashoffset 3s ease-in-out; }
#how-it-works.is-visible #how-it-works-path { stroke-dashoffset: 0; }
.cta-section { background-image: linear-gradient(45deg, #4f46e5 0%, #a259ff 100%); }
.store-button-cta { display: inline-flex; align-items: center; justify-content: center; background-color: #fff; color: #4f46e5; border-radius: 0.5rem; padding: 1rem 1.5rem; transition: all 0.3s ease; box-shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1); }
.store-button-cta:hover { background-color: #f3f4f6; transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1); }
#gamification, footer { background-color: transparent; }
section#gamification .border { border-color: var(--border); }
header.sticky { 
    background-color: var(--card); 
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 12px -1px rgba(0,0,0,.04);
}
.language-header-btn { display: inline-flex; align-items: center; background-color: transparent; color: #4b5563; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; }
.language-header-btn:hover { color: var(--primary); background-color: var(--primary-light); }
#language-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.3); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 5000; display: flex; align-items: center; justify-content: center; padding: 1rem; transition: opacity 0.3s ease; }
#language-modal-overlay.hidden { opacity: 0; pointer-events: none; }
#language-modal-panel { background-color: var(--background); border-radius: 1rem; width: 100%; max-width: 48rem; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04); border: 1px solid var(--border); transition: transform 0.3s ease; }
#language-modal-overlay.hidden #language-modal-panel { transform: scale(0.95); }
#language-modal-panel .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
[dir="rtl"] #language-modal-panel .modal-header { flex-direction: row-reverse; }
#language-modal-panel .modal-title { font-size: 1.125rem; font-weight: 600; }
#language-modal-panel .modal-close-btn { font-size: 2rem; font-weight: 300; line-height: 1; color: #9ca3af; background: none; border: none; cursor: pointer; transition: color 0.2s; }
#language-modal-panel .modal-close-btn:hover { color: var(--text); }
#language-modal-panel .modal-search-container { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
#language-modal-panel .modal-search-input { width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: 0.5rem; background-color: var(--card); }
#language-modal-panel .modal-search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
#language-list-container { overflow-y: auto; padding: 1rem 1.5rem; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
#language-list-container .modal-lang-btn { text-align: left; width: 100%; padding: 0.75rem 1rem; border: none; background-color: var(--card); border: 1px solid var(--border); border-radius: 0.5rem; cursor: pointer; font-weight: 500; transition: all 0.2s ease; }
[dir="rtl"] #language-list-container .modal-lang-btn { text-align: right; }
#language-list-container .modal-lang-btn:hover { background-color: var(--primary-light); border-color: var(--primary); color: var(--primary); }

#game-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.3); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 5000; display: flex; align-items: center; justify-content: center; padding: 1rem; transition: opacity 0.3s ease; }
#game-modal-overlay.hidden { opacity: 0; pointer-events: none; }
#game-modal-panel { background-color: var(--background); border-radius: 1rem; width: 100%; max-width: 48rem; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04); border: 1px solid var(--border); transition: transform 0.3s ease; }
#game-modal-overlay.hidden #game-modal-panel { transform: scale(0.95); }
#game-modal-panel .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
[dir="rtl"] #game-modal-panel .modal-header { flex-direction: row-reverse; }
#game-modal-panel .modal-title { font-size: 1.125rem; font-weight: 600; }
#game-modal-panel .modal-close-btn { font-size: 2rem; font-weight: 300; line-height: 1; color: #9ca3af; background: none; border: none; cursor: pointer; transition: color 0.2s; }
#game-modal-panel .modal-close-btn:hover { color: var(--text); }
#game-modal-panel .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
[dir="rtl"] #game-modal-panel .modal-header { flex-direction: row-reverse; }
#game-modal-panel .modal-title { font-size: 1.125rem; font-weight: 600; }
#game-modal-panel .modal-close-btn { font-size: 2rem; font-weight: 300; line-height: 1; color: #9ca3af; background: none; border: none; cursor: pointer; transition: color 0.2s; }
#game-modal-panel .modal-close-btn:hover { color: var(--text); }

/* NEW: Styles for dividers to respect theme colors */
header .border-l {
    border-color: var(--border);
}
#mobile-menu {
    background-color: var(--card);
    padding-bottom: 1rem;
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,.04), 0 8px 10px -6px rgba(0,0,0,.04);
    border: 1px solid var(--border);
    border-top: none;
}
#mobile-menu .border-t {
    border-color: var(--border);
}

.tts-button {
    background-color: transparent;
    color: #6b7280; /* gray-500 */
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.tts-button:hover:not(:disabled) {
    background-color: var(--primary-light);
    color: var(--primary);
}

.tts-button:disabled {
    color: #9ca3af; /* gray-400 */
    cursor: not-allowed;
}

.tts-button i {
    font-size: 1rem;
    line-height: 1;
}

/* Game specific styles */
.game-content-wrapper {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-grow: 1;
    overflow-y: auto;
}

.prompt-translation {
    font-size: 1.125rem;
    font-style: italic;
    color: #4b5563; /* gray-600 */
    text-align: center;
    margin-bottom: 1rem;
}

.user-sentence-container,
.word-bank-container {
    border: 1px dashed var(--border);
    border-radius: 0.5rem;
    min-height: 60px;
    padding: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

.word-button {
    background-color: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s;
}

.word-button:hover {
    background-color: #3730a3; /* A darker shade of primary */
    transform: translateY(-1px);
}

.word-button.disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

.check-button,
.next-button {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    margin-top: 1rem;
}

.check-button {
    background-color: var(--primary);
    color: white;
}

.check-button:hover {
    background-color: #3730a3;
    transform: translateY(-1px);
}

.check-button.correct {
    background-color: var(--success);
}

.check-button.incorrect {
    color: #dc2626;
}

.next-button {
    background-color: #10b981; /* Green-500 */
    color: white;
}

.next-button:hover {
    background-color: #059669; /* Green-600 */
    transform: translateY(-1px);
}

.feedback-message {
    text-align: center;
    font-weight: 600;
    margin-top: 0.5rem;
}

.feedback-message.correct {
    color: var(--success);
}

.feedback-message.incorrect {
    color: #dc2626;
}