/* Colorization PLAI — OnlyOffice Plugin Styles */

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

body {
    font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    color: #333;
    background: #fff;
    overflow-x: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 8px;
}

/* Header */
.plugin-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 8px;
    border-bottom: 2px solid #0a9370;
    margin-bottom: 8px;
}

.plugin-logo {
    height: 20px;
    width: auto;
    flex-shrink: 0;
}

.plugin-header h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 16px;
    font-weight: 400;
    color: #333;
}

.plugin-header .accent {
    color: #0a9370;
}

.plugin-header .version {
    font-size: 10px;
    color: #999;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.tab {
    padding: 6px 12px;
    border: none;
    background: #f0f0f0;
    color: #666;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px 4px 0 0;
    transition: all 0.15s;
}

.tab:hover { background: #e0e0e0; color: #333; }
.tab.active { background: #0a9370; color: #fff; }

/* Tab Content */
.tab-content { display: none; flex: 1; overflow-y: auto; }
.tab-content.active { display: block; }

/* Sections */
.section {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.section h3 {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.help-text {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
    font-style: italic;
}

/* Sound Grid */
.sound-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 4px;
    margin: 8px 0;
}

.sound-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 4px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.15s;
}

.sound-item:hover { border-color: #0a9370; background: #e1f5ee; }
.sound-item.enabled { border-color: #0a9370; background: #d5efe6; }
.sound-item.disabled { opacity: 0.5; }

.sound-item input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

.sound-item .sound-label {
    font-size: 11px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sound-item input[type="color"] {
    width: 20px;
    height: 20px;
    border: 1px solid #ccc;
    border-radius: 2px;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

/* Sound wrapper (contains sound-item + optional grapheme panel) */
.sound-wrapper {
    display: contents;
}

/* Avertissement de contraste WCAG (couleur trop claire sur fond blanc) */
.contrast-warning {
    color: #b45309;
    font-size: 13px;
    flex-shrink: 0;
    cursor: help;
}

/* Grapheme toggle arrow */
.grapheme-toggle {
    font-size: 10px;
    color: #999;
    cursor: pointer;
    padding: 0 2px;
    flex-shrink: 0;
    user-select: none;
    transition: color 0.15s;
}
.grapheme-toggle:hover { color: #0a9370; }

/* Grapheme panel (expandable under a sound item) */
.grapheme-panel {
    grid-column: 1 / -1;
    background: #f8f9fc;
    border: 1px solid #d8dde8;
    border-radius: 4px;
    padding: 4px 8px;
    margin: 0 0 4px;
}

.grapheme-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    cursor: pointer;
    font-size: 11px;
}
.grapheme-row:hover { background: #eef2fa; border-radius: 3px; }

.grapheme-row input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

.grapheme-label {
    font-weight: 600;
    color: #333;
    min-width: 70px;
}

.grapheme-example {
    color: #999;
    font-style: italic;
    font-size: 10px;
}

/* Global bar (always visible) */
.global-bar {
    background: #f5f6fa;
    border-bottom: 1px solid #dde0ea;
    padding: 5px 10px;
}
.global-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.global-bar-sep {
    color: #ccc;
    font-size: 14px;
}
.btn-sm {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 3px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    white-space: nowrap;
}
.btn-sm:hover { background: #e8eaf0; }
.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: #888;
}
.btn-ghost:hover { background: #ffe0e0; color: #c00; }

.global-bar input[type="color"] {
    width: 24px;
    height: 24px;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0;
    cursor: pointer;
}

.global-bar-note {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    margin-top: 4px;
    padding: 4px 6px;
    background: #fff8e1;
    border-radius: 3px;
    font-size: 10px;
    line-height: 1.4;
    color: #7a6520;
}
.global-bar-note .note-icon {
    font-size: 12px;
    flex-shrink: 0;
}

/* Scope indicator */
.scope-indicator {
    background: #f0f4ff;
    border: 1px solid #d0d8f0;
    border-radius: 4px;
    padding: 6px 10px;
    margin: 8px 0;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.scope-indicator.has-selection {
    background: #e8f5e9;
    border-color: #a5d6a7;
}
.scope-icon { font-size: 14px; }
.scope-text { color: #444; }
.scope-hint { color: #999; font-size: 10px; width: 100%; }

/* Control Rows */
.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}

.control-row label {
    font-size: 11px;
    cursor: pointer;
}

.control-row select {
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 11px;
    background: #fff;
}

/* Preset bar */
.preset-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.preset-bar label {
    font-size: 11px;
    font-weight: 600;
}

.preset-bar select {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 11px;
}

/* Syllable Colors */
.syl-colors { margin: 8px 0; }

.syl-color-row {
    display: flex;
    gap: 6px;
    margin: 6px 0;
}

.syl-color {
    width: 32px;
    height: 28px;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0;
    cursor: pointer;
}

/* Lettres à discriminer (liste éditable) */
.lettres-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 8px 0;
}

.lettre-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    padding: 4px 6px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fafafa;
}

.lettre-letter {
    font-size: 28px;
    font-weight: 700;
    font-family: 'Georgia', serif;
}

.lettre-item input[type="color"] {
    width: 36px;
    height: 24px;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0;
    cursor: pointer;
}

.lettre-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    line-height: 14px;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 50%;
    background: #fff;
    color: #888;
    font-size: 11px;
    cursor: pointer;
}
.lettre-remove:hover { background: #ffe0e0; color: #c00; border-color: #e0a0a0; }

.add-lettre-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
}

.add-lettre-input {
    width: 48px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    text-align: center;
    text-transform: lowercase;
}

.add-lettre-row input[type="color"] {
    width: 28px;
    height: 26px;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0;
    cursor: pointer;
}

/* Voyelles/Consonnes */
.voycons-row {
    display: flex;
    gap: 16px;
    margin: 8px 0;
}

.voycons-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.voycons-item label { font-size: 11px; }

.voycons-item input[type="color"] {
    width: 28px;
    height: 22px;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0;
    cursor: pointer;
}

/* Action Bars */
.action-bar {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: #0a9370;
    color: #fff;
}
.btn-primary:hover { background: #087a5e; }
.btn-primary:active { background: #066347; }

.btn-secondary {
    background: #e8e8e8;
    color: #555;
}
.btn-secondary:hover { background: #d8d8d8; }

/* Preview */
.preview-section {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #ddd;
}

.preview-label {
    font-size: 10px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.preview-box {
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fafafa;
    font-size: 14px;
    line-height: 1.6;
    min-height: 40px;
}

/* Credits */
.credits {
    padding: 8px 0;
    border-bottom: none;
}

.credits p {
    font-size: 10px;
    color: #999;
    line-height: 1.5;
}

.credits a {
    color: #0a9370;
    text-decoration: none;
}

.credits a:hover { text-decoration: underline; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
