/**
 * Wordle-style Exercise Styles
 * 
 * Provides the visual styling for the daily vocabulary exercise game,
 * including the game grid, keyboard, and educational content sections.
 */

/* Variables - Virtuální jazykovka brand colors */
:root {
    --exercise-bg: #F7F6F4;
    --exercise-primary: #2165B2;
    --exercise-primary-dark: #0d33cc;
    --exercise-success: #24CF9A;
    --exercise-warning: #FFCF4D;
    --exercise-error: #f44336;

    /* Wordle colors */
    --cell-correct: #24CF9A;
    --cell-present: #FFCF4D;
    --cell-absent: #787c7e;
    --cell-empty: #d3d6da;
    --cell-border: #878a8c;

    /* Keyboard colors */
    --key-bg: #d3d6da;
    --key-text: #1a1a1b;

    /* Spacing */
    --grid-gap: 5px;
    --cell-size: 62px;
    --cell-size-mobile: 50px;
}

/* Main Container */
.exercise-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    font-family: 'Poppins', sans-serif;
}

/* Header */
.exercise-header {
    text-align: center;
    margin-bottom: 24px;
}

.title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.exercise-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--exercise-primary-dark);
    margin-bottom: 0;
}

.exercise-title i {
    color: var(--exercise-primary);
    margin-right: 8px;
}

.exercise-date {
    font-size: 1rem;
    color: #787c7e;
}

/* No Exercise Message */
.no-exercise-message {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.no-exercise-message .message-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.no-exercise-message h2 {
    font-size: 1.4rem;
    color: var(--exercise-primary-dark);
    margin-bottom: 12px;
}

.no-exercise-message p {
    color: #787c7e;
}

/* Hint */
.exercise-hint {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border-left: 4px solid var(--exercise-warning);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.exercise-hint i {
    color: var(--exercise-warning);
    font-size: 1.2rem;
}

.exercise-hint span {
    color: #856404;
    font-size: 0.95rem;
}

/* Game Grid */
.game-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--grid-gap);
    margin-bottom: 20px;
}

.grid-row {
    display: flex;
    gap: var(--grid-gap);
}

.grid-cell {
    width: var(--cell-size);
    height: var(--cell-size);
    border: 2px solid var(--cell-empty);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #fff;
    transition: transform 0.1s ease, border-color 0.2s ease;
    user-select: none;
}

.grid-cell.filled {
    border-color: var(--cell-border);
    animation: pop 0.1s ease;
}

.grid-cell.evaluated {
    color: #fff;
    border-color: transparent;
}

.grid-cell.correct {
    background: var(--cell-correct);
}

.grid-cell.present {
    background: var(--cell-present);
}

.grid-cell.absent {
    background: var(--cell-absent);
}

.grid-cell.reveal {
    animation: flipIn 0.5s ease forwards;
}

@keyframes pop {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes flipIn {
    0% {
        transform: rotateX(0);
    }

    50% {
        transform: rotateX(90deg);
    }

    100% {
        transform: rotateX(0);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

.grid-row.shake {
    animation: shake 0.4s ease;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.grid-cell.bounce {
    animation: bounce 0.5s ease;
}

/* Game Status */
.game-status {
    min-height: 30px;
    text-align: center;
}

.status-message {
    font-size: 1rem;
    color: #787c7e;
    padding: 8px 16px;
    border-radius: 6px;
    display: inline-block;
}

.status-message.error {
    background: #ffebee;
    color: var(--exercise-error);
}

.status-message.success {
    background: #e8f5e9;
    color: var(--exercise-success);
}

/* Keyboard */
.keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 30px;
}

.keyboard-row {
    display: flex;
    gap: 6px;
}

.spacer {
    flex: 0.5;
}

.spacer.half {
    flex: 0.5;
}

.key {
    min-width: 43px;
    height: 58px;
    border-radius: 4px;
    border: none;
    background: var(--key-bg);
    color: var(--key-text);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s ease, transform 0.05s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.key:hover {
    opacity: 0.9;
}

.key:active {
    transform: scale(0.95);
}

.key.key-wide {
    min-width: 65px;
    font-size: 0.85rem;
}

.key.key-enter {
    background: var(--exercise-success);
    color: #fff;
}

.key.key-enter:hover {
    background: #1db885;
}

.key.key-backspace {
    background: var(--exercise-error);
    color: #fff;
}

.key.key-backspace:hover {
    background: #d32f2f;
}

.key.correct {
    background: var(--cell-correct);
    color: #fff;
}

.key.present {
    background: var(--cell-present);
    color: #fff;
}

.key.absent {
    background: var(--cell-absent);
    color: #fff;
}

/* Results Section */
.results-section {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.result-header {
    text-align: center;
    margin-bottom: 24px;
}

.result-header .result-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.result-header.success .result-icon {
    color: var(--exercise-success);
}

.result-header.failure .result-icon {
    color: var(--exercise-error);
}

.result-header h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.result-header .result-word {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--exercise-primary);
    letter-spacing: 3px;
}

/* Share Section */
.share-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.share-section h3 {
    font-size: 1rem;
    color: #1a1a1b;
    margin-bottom: 16px;
}

.share-section h3 i {
    margin-right: 8px;
    color: var(--exercise-primary);
}

.share-preview {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
    font-family: monospace;
    font-size: 0.9rem;
    white-space: pre-line;
    margin-bottom: 16px;
    line-height: 1.6;
}

.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.share-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s ease;
}

.share-btn:hover {
    opacity: 0.9;
}

.share-copy {
    background: #6c757d;
    color: #fff;
}

.share-twitter {
    background: #1da1f2;
    color: #fff;
}

.share-facebook {
    background: #4267b2;
    color: #fff;
}

.share-native {
    background: var(--exercise-primary);
    color: #fff;
}

/* Educational Content */
.educational-content {
    margin-top: 30px;
}

.educational-content>h2 {
    font-size: 1.3rem;
    color: #1a1a1b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.educational-content>h2 i {
    color: var(--exercise-primary);
}

.educational-block {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.block-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.word-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--exercise-primary);
    margin: 0;
}

.pronunciation {
    color: #787c7e;
    font-style: italic;
}

.word-type {
    background: #e8f5e9;
    color: var(--exercise-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.example-section {
    margin-bottom: 16px;
}

.example-sentence {
    font-size: 1.1rem;
    font-style: italic;
    color: #1a1a1b;
    margin-bottom: 6px;
}

.example-sentence i {
    color: #c9b458;
    margin-right: 6px;
    font-size: 0.9rem;
}

.example-translation {
    color: #787c7e;
    font-size: 0.95rem;
    margin-left: 18px;
}

.explanation-section,
.mistake-section,
.collocations-section,
.memory-section {
    margin-top: 16px;
}

.educational-block h4 {
    font-size: 0.95rem;
    color: #1a1a1b;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.explanation-section h4 i {
    color: #2196F3;
}

.mistake-section h4 i {
    color: #ff9800;
}

.collocations-section h4 i {
    color: #9c27b0;
}

.memory-section h4 i {
    color: #e91e63;
}

.rich-text {
    color: #4a4a4a;
    line-height: 1.6;
}

.rich-text p {
    margin-bottom: 8px;
}

.rich-text ul,
.rich-text ol {
    margin-left: 20px;
    margin-bottom: 8px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1a1a1b;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: toastIn 0.3s ease;
}

.toast.error {
    background: var(--exercise-error);
}

.toast.success {
    background: var(--exercise-success);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 500px) {
    .exercise-container {
        padding: 15px 10px;
    }

    .grid-cell {
        width: var(--cell-size-mobile);
        height: var(--cell-size-mobile);
        font-size: 1.6rem;
    }

    .key {
        min-width: 32px;
        height: 52px;
        font-size: 0.9rem;
    }

    .key.key-wide {
        min-width: 50px;
        font-size: 0.75rem;
    }

    .share-buttons {
        flex-direction: column;
    }

    .share-btn {
        min-width: 100%;
    }
}

/* Very small screens */
@media (max-width: 350px) {
    .grid-cell {
        width: 42px;
        height: 42px;
        font-size: 1.4rem;
    }

    .key {
        min-width: 26px;
        height: 48px;
        font-size: 0.8rem;
    }

    .key.key-wide {
        min-width: 42px;
    }

    .keyboard-row {
        gap: 4px;
    }
}

/* Animation for winning */
@keyframes dance {

    0%,
    100% {
        transform: translateY(0);
    }

    25% {
        transform: translateY(-10px) rotate(-5deg);
    }

    75% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.grid-cell.dance {
    animation: dance 0.5s ease;
}

/* CTA Section - Find a Teacher */
.cta-section {
    background: linear-gradient(135deg, #1E3D6B 0%, #2165B2 100%);
    border-radius: 12px;
    padding: 24px 20px;
    margin-top: 30px;
    text-align: center;
    color: #fff;
    box-shadow: 0 4px 15px rgba(30, 61, 107, 0.3);
}

.cta-section .cta-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.cta-section h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
}

.cta-section p {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-bottom: 16px;
    line-height: 1.5;
}

.cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: var(--exercise-primary-dark);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    color: var(--exercise-primary);
    text-decoration: none;
}

.cta-btn i {
    font-size: 1.1rem;
}

/* CTA in no-exercise state */
.no-exercise-message .cta-section {
    margin-top: 30px;
}

/* Brand badge */
.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 16px;
}

.brand-badge img {
    height: 20px;
    width: auto;
}

/* Exercise intro */
.exercise-intro {
    text-align: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.exercise-intro p {
    color: #ffffff;
    font-size: 0.95rem;
    line-height: 1.5;
}

@media (max-width: 500px) {
    .cta-section {
        padding: 20px 16px;
    }

    .cta-section h3 {
        font-size: 1.1rem;
    }

    .cta-btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
}

/* Help Link */
.help-link {

    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.help-link:hover {
    color: var(--exercise-primary);
    text-decoration: underline;
}

.help-link i {
    margin-right: 4px;
}

/* Help Modal */
.help-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.help-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.help-modal {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    max-width: 400px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.help-modal-overlay.active .help-modal {
    transform: scale(1);
}

.help-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #787c7e;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s ease;
}

.help-modal-close:hover {
    color: #1a1a1b;
}

.help-modal h2 {
    font-size: 1.4rem;
    color: var(--exercise-primary-dark);
    margin-bottom: 16px;
    padding-right: 30px;
}

.help-modal h2 i {
    color: var(--exercise-warning);
    margin-right: 8px;
}

.help-modal>p {
    color: #4a4a4a;
    line-height: 1.6;
    margin-bottom: 20px;
}

.help-example {
    margin-bottom: 16px;
}

.help-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.help-cell {
    width: 40px;
    height: 40px;
    border: 2px solid var(--cell-empty);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #fff;
    border-radius: 4px;
}

.help-cell.correct {
    background: var(--cell-correct);
    border-color: var(--cell-correct);
    color: #fff;
}

.help-cell.present {
    background: var(--cell-present);
    border-color: var(--cell-present);
    color: #fff;
}

.help-cell.absent {
    background: var(--cell-absent);
    border-color: var(--cell-absent);
    color: #fff;
}

.help-desc {
    font-size: 0.9rem;
    color: #4a4a4a;
    margin: 0;
}

.help-tip {
    background: #e8f4fd;
    border-left: 4px solid var(--exercise-primary);
    padding: 12px 14px;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
    color: #1a1a1b;
    margin-top: 20px;
}

.help-tip i {
    color: var(--exercise-primary);
    margin-right: 6px;
}

@media (max-width: 400px) {
    .help-modal {
        padding: 20px;
    }

    .help-cell {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }
}