/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Font Face Definitions */
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-Thin.woff2') format('woff2');
    font-weight: 100;
    font-style: normal;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-ThinItalic.woff2') format('woff2');
    font-weight: 100;
    font-style: italic;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-Light.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-LightItalic.woff2') format('woff2');
    font-weight: 300;
    font-style: italic;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-MediumItalic.woff2') format('woff2');
    font-weight: 500;
    font-style: italic;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-BoldItalic.woff2') format('woff2');
    font-weight: 700;
    font-style: italic;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-ExtraBoldItalic.woff2') format('woff2');
    font-weight: 800;
    font-style: italic;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
}
@font-face {
    font-family: 'Alegreya Sans';
    src: url('components/AlegreyaSans/AlegreyaSans-BlackItalic.woff2') format('woff2');
    font-weight: 900;
    font-style: italic;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --background-color: #f5f7fa;
    --text-color: #333;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --category-C-color: #27ae60;
    --category-E-color: #e74c3c;
    --category-I-color: #3498db;
    --category-U-color: #9b59b6;
    --category-inactive-color: #444;
}

body {
    font-family: 'Alegreya Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-variant-ligatures: common-ligatures discretionary-ligatures historical-ligatures contextual;
    font-feature-settings: "liga", "clig", "dlig", "hlig", "calt";
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    max-width: calc(100% - 200px); /* Laisser de l'espace pour les boutons */
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
        max-width: none;
    }
    .subtitle {
        font-size: 0.9rem;
    }
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.tool-subtitle {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

header .back-link {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.back-link:hover {
    opacity: 1;
}

/* Language Selector */
header .container {
    position: relative;
}

.lang-selector {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 100;
}

.lang-options {
    display: flex;
    gap: 0.5rem;
}

.lang-option {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.5rem;
    line-height: 1;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.lang-option:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.lang-select {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-select:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

.lang-select:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lang-option.active {
    border-color: white;
    background: rgba(255, 255, 255, 0.4);
}

.lang-flag {
    display: block;
}

/* Main content */
main {
    padding: 3rem 0;
}

.intro {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 3rem;
    box-shadow: var(--shadow);
}

.intro h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Tools grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.tool-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.tool-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.tool-card p {
    margin-bottom: 1.5rem;
    color: #666;
    flex-grow: 1;
}

.tool-card {
    text-decoration: none;
    color: inherit;
}

/* Buttons */
.btn {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 0.8rem 2rem;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover {
    background: #2980b9;
}

.btn-secondary {
    background: var(--success-color);
}

.btn-secondary:hover {
    background: #229954;
}

/* Card */
.card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

/* Info Box */
.info-box {
    background: #e8f4f8;
    border-left: 4px solid var(--secondary-color);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

/* Tool pages */
.tool-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.tool-container h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.tool-description {
    color: #666;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Results */
.results {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
    margin-top: 2rem;
    border-left: 4px solid var(--secondary-color);
}

.results h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    margin-bottom: 1rem;
    background: white;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.result-label {
    font-weight: 600;
    color: var(--text-color);
}

.result-value {
    font-size: 1.2rem;
    color: var(--secondary-color);
    font-weight: bold;
}

.result-value.success {
    color: var(--success-color);
}

.result-value.warning {
    color: var(--accent-color);
}

/* Comparison table */
.comparison-table {
    width: 100%;
    margin-top: 2rem;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.comparison-table tr:hover {
    background: #f8f9fa;
}

/* Category sections */
.category-section {
    margin-top: 3rem;
    margin-bottom: 2rem;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--secondary-color);
}

.category-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin: 0;
}

.category-letters-nav {
    display: flex;
    gap: 0.5rem;
}

.category-letter-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--category-inactive-color);
    color: white;
    font-size: 1.4rem;
    font-weight: bold;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.category-letter-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.category-letter-link.active[data-category="C"] {
    background: var(--category-C-color);
}

.category-letter-link.active[data-category="É"] {
    background: var(--category-E-color);
}

.category-letter-link.active[data-category="I"] {
    background: var(--category-I-color);
}

.category-letter-link.active[data-category="U"] {
    background: var(--category-U-color);
}

.category-description {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1.5rem;
    margin-top: 1rem;
    font-style: italic;
}

/* Category navigation boxes */
.category-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0 3rem 0;
}

.category-nav-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border: 2px solid var(--secondary-color);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.category-nav-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.category-nav-letter {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    color: white;
    font-size: 1.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.category-nav-box:nth-child(1) .category-nav-letter {
    background: var(--category-C-color);
}

.category-nav-box:nth-child(2) .category-nav-letter {
    background: var(--category-E-color);
}

.category-nav-box:nth-child(3) .category-nav-letter {
    background: var(--category-I-color);
}

.category-nav-box:nth-child(4) .category-nav-letter {
    background: var(--category-U-color);
}

.category-nav-content h3 {
    margin: 0 0 0.3rem 0;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.category-nav-content p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}


/* Disclaimer */
.disclaimer {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.disclaimer h3 {
    color: #856404;
    margin-bottom: 0.5rem;
}

.disclaimer p {
    color: #856404;
    margin: 0;
}

/* Footer */
footer {
    background: var(--primary-color);
    color: #007FFF;
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    position: relative;
}

.footer-link {
    position: absolute;
    bottom: 1rem;
    color: #007FFF;
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.footer-link:hover {
    opacity: 1;
}

.footer-link.left {
    left: 1rem;
}

.footer-link.right {
    right: 1rem;
}

/* Chart container */
.chart-container {
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .lang-selector {
        position: static;
        transform: none;
        margin-top: 1rem;
        display: flex;
        justify-content: center;
    }

    .lang-option {
        font-size: 1.3rem;
        padding: 0.3rem 0.5rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .comparison-table {
        font-size: 0.9rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 0.5rem;
    }

    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .category-letters-nav {
        align-self: flex-end;
    }

    .category-title {
        font-size: 1.5rem;
    }

    .category-letter-link {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
}

/* Large screens adaption */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
}

@media (min-width: 1800px) {
    .container {
        max-width: 1750px;
    }
}

/* --- THEMES --- */

/* Theme: Light Grey */
body.theme-light-grey {
    --primary-color: #4a4a4a;
    --secondary-color: #7a7a7a;
    --accent-color: #666666;
    --success-color: #666666;
    --background-color: #f0f0f0;
    --text-color: #333;
    --category-C-color: #777;
    --category-E-color: #777;
    --category-I-color: #777;
    --category-U-color: #777;
    --category-inactive-color: #aaa;
}

body.theme-light-grey header {
    background: linear-gradient(135deg, #999 0%, #bbb 100%);
    color: #333;
}

body.theme-light-grey header .subtitle,
body.theme-light-grey header .back-link,
body.theme-light-grey header h1 {
    color: #333;
}

body.theme-light-grey .tool-icon {
    display: none;
}

body.theme-light-grey footer {
    background: #ccc;
    color: #444;
}

body.theme-light-grey .footer-link {
    color: #444;
}

/* Theme: Dark Grey */
body.theme-dark-grey {
    --primary-color: #e0e0e0;
    --secondary-color: #a0a0a0;
    --accent-color: #ccc;
    --success-color: #ccc;
    --background-color: #121212;
    --text-color: #e0e0e0;
    --border-color: #444;
    --category-C-color: #555;
    --category-E-color: #555;
    --category-I-color: #555;
    --category-U-color: #555;
    --category-inactive-color: #333;
    --shadow: 0 2px 10px rgba(0,0,0,0.5);
}

body.theme-dark-grey header {
    background: linear-gradient(135deg, #333 0%, #111 100%);
}

body.theme-dark-grey .intro,
body.theme-dark-grey .tool-card,
body.theme-dark-grey .tool-container,
body.theme-dark-grey .results,
body.theme-dark-grey .result-item,
body.theme-dark-grey .comparison-table,
body.theme-dark-grey .chart-container,
body.theme-dark-grey .category-nav-box,
body.theme-dark-grey .category-letter-link {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

body.theme-dark-grey .tool-card p,
body.theme-dark-grey .category-description,
body.theme-dark-grey .category-nav-content p,
body.theme-dark-grey .subtitle,
body.theme-dark-grey .tool-description {
    color: #b0b0b0;
}

body.theme-dark-grey .tool-icon {
    display: none;
}

body.theme-dark-grey footer {
    background: #000;
}

body.theme-dark-grey input,
body.theme-dark-grey select {
    background-color: #2d2d2d;
    color: #fff;
    border-color: #555;
}

body.theme-dark-grey .result-item {
    background-color: #252525;
}

body.theme-dark-grey .category-nav-box:hover {
     border-color: #888;
}

/* Theme Selector Styles */
.theme-selector {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.3rem;
    border-radius: 20px;
    z-index: 101;
}

.theme-selector label {
    cursor: pointer;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    transition: transform 0.2s;
    position: relative;
}

.theme-selector label:hover {
    transform: scale(1.1);
}

.theme-selector input[type="radio"] {
    display: none;
}

.theme-selector input[type="radio"]:checked + label {
    transform: scale(1.2);
    box-shadow: 0 0 5px white;
}

/* Colors for the selector dots */
.theme-option-rainbow {
    background: linear-gradient(135deg, #3498db, #e74c3c);
}
.theme-option-light {
    background: #ddd;
}
.theme-option-dark {
    background: #333;
}

/* Adjust header layout to accommodate theme selector */
@media (max-width: 768px) {
    .theme-selector {
        position: static;
        justify-content: center;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
}
