/* Variables & Reset */
:root {
    --bg-color: #fdfbf7;
    --text-color: #2c3e50;
    --primary-color: #2c3e50;
    --accent-green: #27ae60;
    --accent-purple: #8e44ad;
    --accent-red: #c0392b;
    --border-color: #e0e0e0;
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Lato', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-serif);
    color: var(--primary-color);
}

.text-green { color: var(--accent-green); }
.text-purple { color: var(--accent-purple); }
.text-muted { color: #7f8c8d; }

/* Header */
.site-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    border-bottom: 4px solid var(--accent-green);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: #ecf0f1;
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent-green);
    border-bottom-color: var(--accent-green);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 3rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.page {
    display: none;
    width: 100%;
    max-width: 1000px;
    animation: fadeIn 0.5s ease;
}

.page.active {
    display: block;
}

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

/* Home Page */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
}

.main-title {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.main-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background-color: var(--accent-red);
    margin: 10px auto 0;
}

.subtitle {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.5rem;
    color: var(--accent-purple);
}

.welcome-card {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    text-align: center;
    border: 1px solid var(--border-color);
}

.card-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.card-text {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.reward-preview {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 2px dashed var(--accent-green);
}

.icon-large {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}

/* Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 4px;
    font-family: var(--font-sans);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background-color: #34495e;
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-danger {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.btn-danger:hover {
    background-color: var(--accent-red);
    color: white;
}

.full-width {
    width: 100%;
}

/* Exercice Page */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    max-width: 500px;
    margin: 0 auto;
}

.card-header-strip {
    height: 6px;
    background: linear-gradient(to right, var(--accent-green), var(--accent-purple));
}

.card-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #95a5a6;
    width: 18px;
    height: 18px;
}

input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 1rem;
    font-family: var(--font-sans);
}

.input-wrapper input {
    padding-left: 40px;
}

input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.1);
}

/* Game Layout */
.game-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 768px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
}

.question-panel {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.progress-bar-container {
    height: 8px;
    background: #ecf0f1;
    border-radius: 4px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-green);
    width: 0%;
    transition: width 0.5s ease;
}

.verb-display {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #7f8c8d;
}

.verb-text {
    font-weight: bold;
    color: var(--primary-color);
}

.pronoun-display {
    font-size: 2.5rem;
    font-family: var(--font-serif);
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.answer-input {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--accent-purple);
    font-weight: bold;
}

.feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
}

.feedback.success {
    background-color: #d4edda;
    color: #155724;
}

.feedback.error {
    background-color: #f8d7da;
    color: #721c24;
}

.hidden {
    display: none !important;
}

/* Puzzle Panel */
.puzzle-panel {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
}

.puzzle-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.puzzle-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.puzzle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    transition: clip-path 0.5s ease;
    /* Initial state: fully covered */
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.puzzle-caption {
    font-style: italic;
    color: #7f8c8d;
}

/* Certificate */
.certificate-container {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.success-header {
    margin-bottom: 2rem;
}

.icon-trophy {
    width: 64px;
    height: 64px;
    color: #f1c40f;
    margin-bottom: 1rem;
}

.certificate-capture-wrapper {
    padding: 40px;
    background: transparent;
}

.certificate-card {
    background: white;
    border: 1px solid #bdc3c7;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
}

.certificate-strip {
    height: 8px;
    background: linear-gradient(to right, var(--accent-green), var(--accent-purple), var(--accent-red));
}

.certificate-content {
    padding: 3rem;
}

.certificate-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    text-align: left;
}

.cert-title-group h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.cert-subtitle {
    font-size: 1.2rem;
    color: var(--accent-purple);
    font-weight: bold;
}

.cert-user-info {
    text-align: right;
}

.cert-user-info .label {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.value-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-green);
}

.value-class {
    font-size: 1.1rem;
    color: #7f8c8d;
}

.cert-image-container {
    margin: 2rem 0;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #ecf0f1;
}

.cert-image-container img {
    width: 100%;
    display: block;
}

.cert-footer {
    font-family: var(--font-serif);
    font-style: italic;
    color: #95a5a6;
    margin-top: 2rem;
}

.certificate-actions {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.btn-large {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.warning-text {
    color: var(--accent-red);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Theory Page */
.theory-container {
    max-width: 1000px;
    width: 100%;
}

.theory-header {
    text-align: center;
    margin-bottom: 3rem;
}

.theory-header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.theory-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    border-left: 4px solid var(--accent-purple);
}

.theory-card.intro-card {
    border-left-color: var(--accent-green);
    background: linear-gradient(to right, #f0fff4, white);
}

.theory-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.theory-card p {
    margin-bottom: 0.8rem;
}

.highlight {
    background: #f3e5f5;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    color: var(--accent-purple);
}

.terminaisons-box {
    background: #f3e5f5;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.terminaisons-box h3 {
    margin-bottom: 1rem;
    color: var(--accent-purple);
}

.terminaisons-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
}

.terminaisons-list li {
    padding: 0.3rem 0;
}

.theory-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .theory-grid {
        grid-template-columns: 1fr;
    }
    
    .main-title {
        font-size: 2.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

.radical-info {
    background: #e8f5e9;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.grammar-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.grammar-table th, .grammar-table td {
    padding: 0.8rem;
    border-bottom: 1px solid #ecf0f1;
    text-align: left;
}

.grammar-table th {
    color: var(--accent-purple);
}

.grammar-table strong {
    color: var(--accent-purple);
}

.highlight-card {
    border-left-color: var(--accent-red);
}

.exceptions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.exception-item {
    background: #fff5f5;
    padding: 0.8rem;
    border-radius: 4px;
    border: 1px solid #ffebee;
}

.exception-item span {
    font-weight: bold;
    color: var(--primary-color);
}

.exception-item strong {
    color: var(--accent-red);
}

.remarks-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.remark-item h4 {
    color: var(--accent-purple);
    margin-bottom: 0.5rem;
}

.remark-item .example {
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-style: italic;
    margin-top: 0.5rem;
}

.quote-section {
    text-align: center;
    margin-top: 3rem;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.5rem;
    color: var(--accent-purple);
}

/* Footer */
.site-footer {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-line {
    width: 50px;
    height: 2px;
    background-color: #7f8c8d;
}
