/* maker.css — page-specific styles for codebook generator */
/* Extends zenburn-theme.css; uses the same color palette */

/* Widen container for this tool — needs room for toolbar controls */
.container {
    max-width: 960px;
}

/* ── Config panels ── */
.config-panel {
    margin: 1em 0;
    padding: 1em;
    background-color: #383838;
    border-radius: 6px;
}

.config-panel + .config-panel {
    margin-top: 0.5em;
}

.config-panel h3 {
    font-size: 0.95em;
    color: #F0E68C;
    margin-bottom: 0.8em;
}

/* ── Form fields ── */
.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2em;
    align-items: flex-end;
    margin-bottom: 0.8em;
}

.field-row:last-child {
    margin-bottom: 0;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.3em;
}

.field label {
    display: block;
    color: #F0E68C;
    font-weight: bold;
    font-size: 0.85em;
}

.field input[type="text"] {
    width: 200px;
    padding: 0.5em;
    background-color: #2B2B2B;
    color: #DCDCCC;
    border: 1px solid #5F5F5F;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 1em;
    box-sizing: border-box;
}

.field input[type="text"]:focus {
    border-color: #8CD0D3;
    outline: none;
}

.field select {
    padding: 0.5em;
    background-color: #2B2B2B;
    color: #DCDCCC;
    border: 1px solid #5F5F5F;
    border-radius: 4px;
    font-size: 1em;
}

.field select:focus {
    border-color: #8CD0D3;
    outline: none;
}

/* ── Checkboxes and radios ── */
.checkbox-group,
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8em;
    align-items: center;
    padding: 0.2em 0;
}

.checkbox-group label,
.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.35em;
    font-weight: normal;
    font-size: 0.95em;
    color: #DCDCCC;
    cursor: pointer;
}

.checkbox-group label.disabled,
.radio-group label.disabled {
    color: #5F5F5F;
    cursor: not-allowed;
}

.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
    accent-color: #7F9F7F;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-group label.disabled input,
.radio-group label.disabled input {
    cursor: not-allowed;
}

/* ── Sliders ── */
.slider-wrap {
    display: flex;
    align-items: center;
    gap: 0.6em;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: #5F5F5F;
    height: 6px;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    width: 140px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #7F9F7F;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: #7F9F7F;
    cursor: pointer;
}

.slider-val {
    font-size: 1em;
    color: #8CD0D3;
    min-width: 2.5em;
    text-align: center;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

/* ── File input ── */
.file-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.8em;
}

input[type="file"] {
    font-size: 0.9em;
    color: #DCDCCC;
}

input[type="file"]::file-selector-button {
    padding: 0.4em 0.8em;
    background-color: #5F7F5F;
    color: #DCDCCC;
    border: 1px solid #7F9F7F;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

input[type="file"]::file-selector-button:hover {
    background-color: #7F9F7F;
    color: #2B2B2B;
}

/* ── Buttons ── */
button {
    padding: 0.5em 1.2em;
    margin: 0.3em 0.3em 0.3em 0;
    background-color: #5F7F5F;
    color: #DCDCCC;
    border: 1px solid #7F9F7F;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

button:hover {
    background-color: #7F9F7F;
    color: #2B2B2B;
}

button.primary {
    background-color: #5F7F5F;
    color: #DCDCCC;
    border: 2px solid #7F9F7F;
    font-weight: bold;
    font-size: 1.1em;
    padding: 0.6em 2em;
}

button.primary:hover {
    background-color: #7F9F7F;
    color: #2B2B2B;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

button:disabled:hover {
    background-color: #5F7F5F;
    color: #DCDCCC;
}

/* ── Capacity bar ── */
.capacity-bar {
    padding: 0.8em 1em;
    margin: 0.5em 0;
    background-color: #383838;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 1em;
    font-size: 0.9em;
}

.cap-label {
    color: #F0E68C;
    font-weight: bold;
    font-size: 0.9em;
    white-space: nowrap;
}

.capacity-meter {
    flex: 1;
    height: 8px;
    background: #2B2B2B;
    border-radius: 4px;
    overflow: hidden;
    min-width: 80px;
    border: 1px solid #5F5F5F;
}

.capacity-fill {
    height: 100%;
    border-radius: 4px;
    background: #7F9F7F;
    transition: width 0.3s, background 0.3s;
}

.capacity-fill.warn {
    background: #F0DFAF;
}

.capacity-fill.err {
    background: #CC9393;
}

.cap-numbers {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.cap-ok { color: #7F9F7F; }
.cap-warn { color: #F0DFAF; }
.cap-err { color: #CC9393; }

/* ── Generate row ── */
.generate-row {
    display: flex;
    align-items: center;
    gap: 1em;
    margin: 0.5em 0;
}

/* ── Status message ── */
.status-strip {
    padding: 0.4em 0;
    font-size: 0.9em;
    min-height: 1.6em;
}

.status-strip.ok {
    color: #7F9F7F;
}

.status-strip.err {
    color: #CC9393;
}

.status-strip.warn {
    color: #F0DFAF;
}

/* ── Stats strip ── */
.stats-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background-color: #383838;
    border-radius: 6px;
    font-size: 0.9em;
    margin: 0.5em 0;
}

.stat-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5em 1em;
    gap: 0.15em;
    border-right: 1px solid #5F5F5F;
}

.stat-cell:last-child {
    border-right: none;
}

.stat-cell .sv {
    color: #8CD0D3;
    font-size: 1.1em;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.stat-cell .sl {
    font-size: 0.75em;
    color: #DCDCCC;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Codebook viewer ── */
details {
    margin: 0.5em 0;
    background-color: #383838;
    border: 1px solid #5F5F5F;
    border-radius: 6px;
}

summary {
    padding: 0.6em 1em;
    font-size: 0.95em;
    color: #F0E68C;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.6em;
    font-weight: bold;
}

summary::-webkit-details-marker {
    display: none;
}

summary::before {
    content: '\25B6';
    font-size: 0.7em;
    color: #7F9F7F;
    transition: transform 0.18s;
}

details[open] summary::before {
    transform: rotate(90deg);
}

.summary-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5em;
}

.cb-filter {
    padding: 0.4em 0.6em;
    background-color: #2B2B2B;
    color: #DCDCCC;
    border: 1px solid #5F5F5F;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    width: 200px;
}

.cb-filter:focus {
    border-color: #8CD0D3;
    outline: none;
}

.dict-tabs {
    display: flex;
    border-bottom: 1px solid #5F5F5F;
    padding: 0 0.5em;
}

.dict-tab {
    padding: 0.5em 1em;
    font-size: 0.85em;
    cursor: pointer;
    color: #DCDCCC;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.14s;
}

.dict-tab.active {
    color: #8CD0D3;
    border-bottom-color: #8CD0D3;
}

.dict-tab:hover:not(.active) {
    color: #F0E68C;
}

.dict-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0;
    max-height: 360px;
    overflow-y: auto;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}

.dict-entry {
    display: flex;
    justify-content: space-between;
    gap: 0.5em;
    padding: 0.25em 0.8em;
    border-bottom: 1px solid #333;
}

.dict-entry:nth-child(even) {
    background: rgba(0, 0, 0, 0.15);
}

.de-code {
    color: #8CD0D3;
    font-weight: bold;
}

.de-word {
    color: #DCDCCC;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.de-type {
    color: #7F9F7F;
    font-size: 0.8em;
    margin-left: 0.3em;
}

/* ── Help text ── */
.help-text {
    font-size: 0.85em;
    color: #7F9F7F;
    line-height: 1.6;
    font-style: italic;
}

/* ── Security guidance ── */
.security-hint {
    font-size: 0.85em;
    color: #DCDCCC;
    line-height: 1.6;
    margin-top: 0.6em;
    padding: 0.6em 0.8em;
    background-color: #2B2B2B;
    border-radius: 4px;
    border-left: 3px solid #8CD0D3;
}

.security-hint strong {
    color: #F0E68C;
}

.security-panel {
    margin: 1em 0;
    padding: 1em;
    background-color: #383838;
    border-radius: 6px;
    border-left: 3px solid #8CD0D3;
}

.security-panel h3 {
    font-size: 1em;
    color: #8CD0D3;
    margin: 0 0 0.6em 0;
}

.security-intro {
    font-size: 0.9em;
    color: #DCDCCC;
    line-height: 1.6;
    margin: 0 0 0.8em 0;
}

.security-intro a {
    color: #8CD0D3;
}

.security-note {
    font-size: 0.85em;
    color: #DCDCCC;
    line-height: 1.6;
    margin: 0.8em 0 0 0;
}

.security-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    margin: 0.5em 0;
}

.security-table th {
    background-color: #2B2B2B;
    color: #F0E68C;
    padding: 0.5em 0.8em;
    text-align: left;
    border-bottom: 2px solid #5F5F5F;
    font-size: 0.9em;
}

.security-table td {
    padding: 0.4em 0.8em;
    border-bottom: 1px solid #333;
    color: #DCDCCC;
}

.security-table tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.12);
}

.sec-vulnerable {
    color: #CC9393;
    font-weight: bold;
}

.sec-defeated {
    color: #7F9F7F;
    font-weight: bold;
}

.sec-caution {
    color: #F0DFAF;
    font-weight: bold;
}

.sec-ok {
    color: #5F5F5F;
    font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .field-row {
        gap: 0.8em;
    }

    .stats-strip {
        flex-wrap: wrap;
    }

    .stat-cell {
        flex: 1;
        min-width: 5em;
    }

    .capacity-bar {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 1em;
        max-width: 100%;
    }

    .field-row {
        flex-direction: column;
        gap: 0.6em;
    }

    .field input[type="text"] {
        width: 100%;
    }

    .dict-grid {
        grid-template-columns: 1fr;
    }
}

/* Cross-page navigation strip (added when codebook tools moved into codebooks/ dir) */
nav.section-nav {
    text-align: center;
    font-size: 0.9em;
    margin: 0.5em auto 1.5em auto;
    padding-bottom: 0.5em;
    border-bottom: 1px dotted #5F5F5F;
    color: #8FB28F;
}
nav.section-nav a {
    color: #DCDCCC;
    text-decoration: none;
}
nav.section-nav a:hover {
    color: #F0DFAF;
    text-decoration: underline;
}
nav.section-nav strong {
    color: #F0DFAF;
}
