/* -----------------------------------------
   Variables
----------------------------------------- */
:root {
    --primary: #007a7b;
    --primary-light: #007b7b9f;
    --secondary: #ee9111;
    --success: #4caf50;
    --error: #f44336;
    --light: #f5f5f5;
    --dark: #333;
    --white: #ffffff;
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 15px;
    --border-radius-circle: 50%;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.2);
    --transition-default: 0.2s;
}

/* -----------------------------------------
   Reset & Base
----------------------------------------- */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .score-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .score-value {
        margin-top: 5px;
    }
}

/* -----------------------------------------
   Typography
----------------------------------------- */
h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    color: var(--primary);
    margin-bottom: 0.5rem;
    text-align: center;
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--secondary);
    margin-top: 0;
    text-align: center;
}

.completion-text {
    font-size: 1.3rem;
    margin: 25px 0;
}

.progress-indicator {
    text-align: center;
    color: var(--primary);
    font-weight: bold;
    margin-bottom: 15px;
    padding: 5px;
    background-color: var(--light);
    border-radius: var(--border-radius-sm);
}

/* -----------------------------------------
   Layout
----------------------------------------- */
.container {
    background-color: var(--white);
    padding: 20px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.home-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control {
    display: flex;
    justify-content: space-between;
}

.control-btn {
    text-align: right;
}

.help {
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: var(--border-radius-md);
}

.text-container {
    margin: 20px 0;
    line-height: 2;
    font-size: 1.1rem;
}

.word-display {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.correction-input-container {
    margin: 20px 0;
}

.phrase-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 5px;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.continue-button-container {
    margin-top: 20px;
}

.add-phrase-container {
    margin: 20px 0;
    text-align: center;
}

.exercise-title-container {
    margin: 20px 0;
}

#share-link-container {
    margin-top: 20px;
    padding: 10px;
    background-color: var(--light);
    border-radius: var(--border-radius-sm);
}

#score {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 10px;
    margin: 10px auto;
    max-width: 500px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.score-label {
    font-weight: bold;
}

.score-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-value .emoji {
    font-size: 1.2em;
}


/* -----------------------------------------
   Theme Tiles
----------------------------------------- */
.theme-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.theme-tile {
    background-color: var(--white);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-default);
}

.theme-tile:hover {
    background-color: var(--secondary);
    color: var(--white);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.theme-tile h4 {
    color: var(--primary);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 5rem;
}

.theme-tile:hover h4 {
    color: var(--white);
}

.theme-tile p {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* -----------------------------------------
   Links & Buttons
----------------------------------------- */
.lien {
    text-decoration: none;
    color: inherit;
}

button {
    background-color: var(--primary);
    color: var(--white);
    border: none;
    padding: 10px 15px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: background-color var(--transition-default);
}

button:hover {
    background-color: var(--secondary);
}

.info-btn {
    width: 3rem;
    height: 3rem;
    border-radius: var(--border-radius-circle);
    background: var(--white);
    border: none;
    color: var(--primary);
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.info-btn:hover {
    color: var(--white);
    background-color: var(--secondary);
}

.logo {
    padding: 0.3rem;
    width: 3rem;
    height: 3rem;
    border-radius: var(--border-radius-circle);
    background: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.logo:hover {
    background-color: #ffe5be;
}

.file-label {
    display: inline-block;
    background-color: var(--primary);
    color: var(--white);
    padding: 10px 15px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    margin-top: 10px;
}

/* Specific buttons */
#continue-button {
    background-color: var(--secondary);
}

#add-phrase {
    background-color: var(--white);
    color: var(--dark);
    border: 1px solid #ccc;
}

#add-phrase:hover {
    background-color: var(--secondary);
}

#export-custom {
    background-color: var(--success);
}

#export-custom:hover {
    background-color: var(--secondary);
}

#copy-link {
    background-color: var(--secondary);
}

#load-custom {
    background-color: var(--primary-light);
}

#load-custom:hover {
    background-color: var(--secondary);
}

#next-phrase-button {
    background-color: #FF9800;
    font-weight: bold;
}

#next-phrase-button:hover {
    background-color: var(--secondary);
}

.remove-phrase {
    background-color: var(--error);
    font-size: 0.8rem;
    padding: 5px 10px;
}

.primary-action {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
    animation: pulse 1.5s infinite;
}

/* -----------------------------------------
   Forms & Input
----------------------------------------- */
.file-input {
    display: none;
}

textarea {
    width: 100%;
    height: 150px;
    padding: 10px;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
}

#correction-input {
    width: 80%;
    padding: 12px;
    font-size: 1.2rem;
    border: 2px solid var(--primary);
    border-radius: var(--border-radius-sm);
    text-align: center;
}

#exercise-title {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius-sm);
}

#share-link {
    width: 80%;
    padding: 10px;
    margin-right: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius-sm);
}

/* -----------------------------------------
   Word Component
----------------------------------------- */
.word {
    display: inline-block;
    cursor: pointer;
    margin: 0 2px;
    padding: 2px 4px;
    border-radius: var(--border-radius-sm);
}

.word:hover {
    background-color: rgba(74, 111, 165, 0.1);
}

.word.correct {
    border: 1px solid var(--success);
    background-color: rgba(76, 175, 80, 0.1);
}

.word.correct .original-word {
    font-size: smaller;
    text-decoration: line-through;
    text-decoration-thickness: 3px;
    color: rgba(76, 175, 79, 0.5);
}

.word.correct .corrected-word {
    font-weight: bold;
    color: var(--success-dark);
}

.word.incorrect {
    border: 1px solid var(--error);
    background-color: rgba(244, 67, 54, 0.1);
}

.word.incorrect .original-word {
    font-size: smaller;
    text-decoration: line-through;
    text-decoration-thickness: 3px;
    color: rgba(244, 67, 54, 0.5);
}

.word.incorrect .corrected-word {
    font-weight: bold;
    color: var(--success-dark);
}

.word.untouched {
    border: 1px solid transparent;
}

/* -----------------------------------------
   Phrase Component
----------------------------------------- */
.phrase-item {
    margin-bottom: 15px;
    position: relative;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: var(--border-radius-sm);
    background-color: #f9f9f9;
}

/* -----------------------------------------
   Feedback Component
----------------------------------------- */
.feedback {
    margin-top: 10px;
    padding: 10px;
    border-radius: var(--border-radius-sm);
}

.feedback.success {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--success);
}

.feedback.error {
    background-color: rgba(244, 67, 54, 0.1);
    color: var(--error);
}

/* -----------------------------------------
   Modals
----------------------------------------- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    max-width: 500px;
    width: min(90%, 500px);
    text-align: center;
}

.modal-title {
    color: var(--primary);
    margin-bottom: 20px;
}

#completion-modal .modal-title {
    font-size: 1.4rem;
    color: var(--primary);
}

.correction-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.exercise-title-display {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: fadeInOut 2s;
}

/* -----------------------------------------
   Utilities
----------------------------------------- */
.hidden {
    display: none;
}

/* -----------------------------------------
   Animations
----------------------------------------- */
@keyframes fadeInOut {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1.1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1.1);
    }
}