:root {
    --bg: #0a0a0c;
    --card: #121316;
    --text: #f3f4f6;
    --muted: #71717a;
    --primary: #e05660;
    --primary-hover: #cc4952;
    --border: #27272a;
    --textarea: #070709;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

body.light-theme {
    --bg: #f4f4f5;
    --card: #ffffff;
    --text: #18181b;
    --muted: #71717a;
    --primary: #e05660;
    --primary-hover: #cc4952;
    --border: #e4e4e7;
    --textarea: #fafafa;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
}

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

body, .editor-pane, .controls, .nav-btn, button, textarea, .dropdown-content {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.top-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1rem;
    max-width: 950px;
    width: 100%;
    margin: 0 auto;
}

.top-nav-menus { display: flex; gap: 0.75rem; position: relative; }

.nav-btn, button {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    height: 38px;
    padding: 0 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.nav-btn:hover, button:hover { 
    border-color: var(--primary); 
    color: var(--primary);
}

.theme-toggle-btn {
    min-width: 85px;
    text-align: center;
}

.dropdown { position: relative; }
.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    width: 280px;
    z-index: 50;
    box-shadow: var(--shadow);
}
.dropdown-content.dropdown-content-wide { width: 340px; }
.dropdown.active .dropdown-content,
.dropdown:hover .dropdown-content { display: block; }

.dropdown-header-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; }
.dropdown-subtitle-custom { font-size: 0.85rem; font-weight: 600; margin-top: 0.85rem; margin-bottom: 0.25rem; color: var(--primary); }
.dropdown-content p { font-size: 0.825rem; margin-bottom: 0.4rem; color: var(--muted); }

.advanced-modes-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.container { max-width: 950px; margin: 0 auto; padding: 0 1rem; flex: 1; width: 100%; }
.hero { text-align: center; margin: 1.5rem 0 2rem; }
.hero h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 0.3rem; }
.subtitle { color: var(--muted); font-size: 0.95rem; }

.controls {
    display: flex;
    justify-content: space-between;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: var(--shadow);
}
.mode-selector, .action-selector { display: flex; gap: 1.1rem; cursor: pointer; flex-wrap: wrap; align-items: center; font-size: 0.9rem; font-weight: 500; }
.mode-selector label, .action-selector label { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; }

.editor-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.25rem;
    align-items: start;
}

.editor-pane {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.editor-pane label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

/* Textarea avec une taille confortable mais totalement libre au redimensionnement manuel */
textarea {
    width: 100%;
    height: 240px;
    min-height: 120px;
    background: var(--textarea);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.9rem;
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    resize: vertical;
    margin-bottom: 0.75rem;
}
textarea:focus { outline: none; border-color: var(--primary); }

.editor-footer-info { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-size: 0.8rem; 
    color: var(--muted); 
}

.output-actions { display: flex; gap: 0.5rem; align-items: center; }

.swap-container { display: flex; justify-content: center; align-items: center; padding-top: 2rem; }
.swap-btn { width: 40px; height: 40px; border-radius: 50%; font-size: 1.2rem; box-shadow: var(--shadow); padding: 0; }

.btn-primary { background: var(--primary); color: white; border: none; font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); color: white; }
.btn-secondary { background: var(--card); }
.btn-text { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; font-size: 0.8rem; font-weight: 600; height: auto; box-shadow: none; }
.btn-text:hover { text-decoration: underline; color: var(--primary); }

.hidden { display: none !important; }
.color-picker-container, .color-preview-container { display: none; flex-direction: column; gap: 0.6rem; margin-bottom: 0.75rem; font-size: 0.85rem; color: var(--muted); }
.color-picker-container.active, .color-preview-container.active { display: flex; }
.color-box { width: 100%; height: 240px; border-radius: 8px; border: 1px solid var(--border); background: var(--primary); }
input[type="color"] { border: 1px solid var(--border); width: 100%; height: 40px; cursor: pointer; background: var(--textarea); border-radius: 6px; padding: 2px; }

.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; }
.history-subtitle { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.6rem; }
.history-empty { font-style: italic; color: var(--muted); text-align: center; font-size: 0.85rem; padding: 1rem 0; }
.history-list { max-height: 220px; overflow-y: auto; }
.history-item { padding: 0.5rem 0; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 0.8rem; font-family: monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item:hover { color: var(--primary); }

.site-footer { text-align: center; padding: 3rem 1rem 1.5rem; font-size: 0.8rem; color: var(--muted); }
.site-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }
.site-footer a:hover { text-decoration: underline; }
.footer-divider-long { border: none; border-top: 1px solid var(--border); margin-bottom: 1.25rem; }
.footer-badge { display: flex; justify-content: center; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.inline-icon { width: 18px; height: 18px; }
.footer-divider { border: none; border-top: 1px solid var(--border); width: 60px; margin: 0.75rem auto; }

@media(max-width: 768px) {
    .editor-grid { grid-template-columns: 1fr; }
    .swap-container { padding: 0.5rem 0; }
}