:root {
    /* Palette de couleurs "Premium Dark" */
    --bg-color: #0f172a;
    /* Dark Blue/Slate content */
    --card-bg: #1e293b;
    /* Lighter slate */
    --text-main: #f8fafc;
    /* White-ish */
    --text-muted: #94a3b8;
    /* Gray */
    --primary: #3b82f6;
    /* Bright Blue */
    --primary-glow: rgba(59, 130, 246, 0.5);
    --accent: #10b981;
    /* Emerald Green for results */
    --accent-red: #ef4444;
    /* Red for decreases */

    /* Spacing & Borders */
    --radius: 16px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
.main-header {
    text-align: center;
    padding: 5rem 1rem;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.8) 0%, transparent 100%);
}

.main-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.highlight {
    color: var(--primary);
}

.subtitle {
    color: var(--text-muted);
    font-weight: 300;
    font-size: 1.1rem;
}

/* --- Container & Grid --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.grid-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding-bottom: 4rem;
}

/* --- Calculator Cards --- */
.calculator-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.calculator-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(59, 130, 246, 0.3);
}

.calculator-card h2 {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.desc strong {
    color: var(--text-main);
}

/* --- Forms & Inputs --- */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 600;
    transition: var(--transition);
    /* Hide spin button for Firefox */
    -moz-appearance: textfield;
}

/* Hide spin button for Chrome, Safari, Edge, Opera */
.input-wrapper input::-webkit-outer-spin-button,
.input-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
}

.input-wrapper .unit {
    position: absolute;
    right: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    pointer-events: none;
}

/* --- Results --- */
.result-area {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: right;
}

.result-label {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.result-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.result-detail {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* --- Footer --- */
.main-footer {
    margin-top: auto;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- Educational Section (Story 4) --- */
.educational-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edu-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 0.85rem;
}

.edu-label {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    margin-right: 1rem;
}

.edu-content {
    color: var(--text-main);
    opacity: 0.8;
}

.code-snippet {
    font-family: 'Consolas', 'Monaco', monospace;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- SEO Content Section --- */
.seo-section {
    padding-bottom: 4rem;
    color: var(--text-muted);
}

.content-block {
    width: 100%;
    margin: 0 auto 3rem auto;
    background: rgba(30, 41, 59, 0.4);
    /* Subtle background */
    padding: 2.5rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.seo-section h2,
.seo-section h3 {
    color: var(--text-main);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.seo-section h2 {
    font-size: 1.8rem;
    color: var(--primary);
    margin-top: 0;
}

.seo-section p {
    margin-bottom: 1rem;
}

.formula-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    color: var(--text-main);
}

.formula-box code {
    display: block;
    margin-top: 0.5rem;
    font-family: 'Consolas', monospace;
    font-size: 1.1rem;
    color: var(--accent);
}

.check-list,
ol {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.check-list li,
ol li {
    margin-bottom: 0.5rem;
}

/* --- Examples Grid --- */
.separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 3rem 0;
}

.subtitle-section {
    text-align: center;
    margin-bottom: 2rem;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.example-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
}

.example-card h4 {
    color: var(--text-main);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.example-card .context {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.calc-details {
    margin-top: auto;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.calc-details p {
    margin-bottom: 0.25rem;
}

.calc-details .res {
    color: var(--accent);
    font-weight: 700;
}

.calc-details .expl {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .main-header h1 {
        font-size: 2rem;
    }

    .grid-wrapper {
        grid-template-columns: 1fr;
    }
}