/**
 * Coefficient of Variation Calculator Styles
 * Locale compact calculator styles
 *
 * @package Zipper
 */

.cvc-hidden,
.cvc-waiting[hidden] {
    display: none !important;
}

.cvc-tool {
    --bg: #faf9f7;
    --surface: #ffffff;
    --border: #e8e4dc;
    --text: #2d2a26;
    --muted: #5f5a56;
    --accent: #b8860b;
    --accent-light: #fbf7eb;
    --accent-mid: #eadfb8;
    --success: #8a6500;
    --success-light: #fdf8e8;
    --danger: #b14622;
    --danger-light: #fff4f0;
    --mono: 'Courier New', Courier, monospace;
    --sans: Helvetica, Arial, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
    --radius: 10px;
    --shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
    margin-bottom: 28px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
}

.cvc-tool *,
.cvc-tool *::before,
.cvc-tool *::after {
    box-sizing: border-box;
}

.cvc-tool-wrap {
    display: grid;
    gap: 10px;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
}

.cvc-tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.cvc-tool-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.cvc-tool-title i {
    color: var(--accent);
}

.cvc-tool-lead {
    display: none;
    max-width: 640px;
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.45;
}

.cvc-live-pill,
.cvc-status-badge,
.cvc-unit-chip,
.cvc-option-chip,
.cvc-preset-btn,
.cvc-utility-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.cvc-live-pill {
    min-height: 30px;
    padding: 6px 10px;
    border: 1px solid var(--accent-mid);
    border-radius: 999px;
    background: var(--accent-light);
    color: var(--success);
    font-size: 13px;
    font-weight: 800;
}

.cvc-compact-grid {
    display: grid;
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
}

.cvc-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.cvc-input-panel,
.cvc-result-panel {
    min-width: 0;
}

.cvc-panel-head {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cvc-input-body,
.cvc-result-body,
.cvc-entry-block,
.cvc-option-group,
.cvc-example-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.cvc-input-body {
    gap: 8px;
    padding: 10px;
}

.cvc-result-body {
    position: relative;
    gap: 8px;
    padding: 10px;
}

.cvc-mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.cvc-mode-tab,
.cvc-option-chip,
.cvc-preset-btn,
.cvc-utility-btn {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--muted);
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cvc-mode-tab {
    min-height: 36px;
    padding: 8px 10px;
}

.cvc-mode-tab:hover,
.cvc-mode-tab:focus,
.cvc-option-chip:hover,
.cvc-option-chip:focus,
.cvc-preset-btn:hover,
.cvc-preset-btn:focus,
.cvc-utility-btn:hover,
.cvc-utility-btn:focus {
    outline: none;
    border-color: var(--accent-mid);
    background: var(--accent-light);
    color: var(--accent);
}

.cvc-mode-tab.is-active,
.cvc-option-chip.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 5px rgba(184, 134, 11, 0.18);
}

.cvc-mode-help,
.cvc-input-note,
.cvc-hero-summary,
.cvc-band-note,
.cvc-step-list,
.cvc-note-card p,
.cvc-disclaimer {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.cvc-hero-summary,
.cvc-band-note {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
}

.cvc-hero-summary {
    -webkit-line-clamp: 2;
}

.cvc-band-note {
    -webkit-line-clamp: 3;
}

.cvc-entry-block {
    gap: 6px;
}

.cvc-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.cvc-label-row label {
    margin: 0;
    color: var(--muted);
    font: inherit;
}

.cvc-label-row span {
    color: #8f8982;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.cvc-textarea-wrap,
.cvc-input-box {
    min-width: 0;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cvc-textarea-wrap:focus-within,
.cvc-input-box:focus-within {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.08);
}

.cvc-textarea,
.cvc-input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-family: var(--mono);
    font-size: 16px;
    font-weight: 700;
}

.cvc-textarea {
    min-height: 84px;
    max-height: 118px;
    padding: 10px 12px;
    line-height: 1.45;
    resize: vertical;
}

.cvc-input {
    height: 38px;
    padding: 0 10px;
}

.cvc-textarea::placeholder,
.cvc-input::placeholder {
    color: #b9b3ad;
    font-weight: 600;
}

.cvc-summary-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.cvc-field {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.cvc-field label {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.cvc-input-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0;
    align-items: center;
    overflow: hidden;
}

.cvc-unit-chip {
    align-self: stretch;
    min-width: 54px;
    padding: 0 9px;
    border-left: 1px solid var(--border);
    background: var(--accent-light);
    color: var(--success);
    font-size: 12px;
    font-weight: 800;
}

.cvc-options-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 8px;
}

.cvc-option-group {
    gap: 6px;
}

.cvc-chip-row,
.cvc-preset-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.cvc-option-chip {
    min-height: 30px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 13px;
}

.cvc-formula-strip {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--accent-mid);
    border-radius: 8px;
    background: var(--accent-light);
}

.cvc-formula-strip span {
    color: var(--success);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cvc-formula-strip strong {
    min-width: 0;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.35;
    word-break: keep-all;
}

.cvc-example-area {
    gap: 6px;
}

.cvc-preset-btn {
    min-height: 30px;
    padding: 6px 9px;
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
}

.cvc-actions-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.cvc-utility-btn {
    min-height: 32px;
    padding: 7px 10px;
    background: #fff;
}

.cvc-result-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.75fr) minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
    padding: 11px;
    border: 1px solid var(--accent-mid);
    border-radius: 12px;
    background: linear-gradient(135deg, #fffaf0 0%, #f7edcf 100%);
    box-shadow: 0 8px 20px rgba(184, 134, 11, 0.12);
}

.cvc-hero-main,
.cvc-hero-side {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.cvc-hero-main {
    gap: 5px;
    justify-content: center;
}

.cvc-hero-side {
    position: relative;
    gap: 6px;
    justify-content: center;
    padding-right: 42px;
}

.cvc-status-badge {
    width: fit-content;
    max-width: 100%;
    min-height: 25px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cvc-status-badge.is-example {
    background: rgba(95, 90, 86, 0.10);
    color: var(--muted);
}

.cvc-status-badge.is-valid {
    background: rgba(184, 134, 11, 0.15);
    color: var(--accent);
}

.cvc-status-badge.is-warning {
    background: var(--danger-light);
    color: var(--danger);
}

.cvc-hero-value {
    color: var(--accent);
    font-family: var(--mono);
    font-size: clamp(33px, 4.6vw, 45px);
    font-weight: 800;
    letter-spacing: -0.06em;
    line-height: 0.98;
}

.cvc-hero-label {
    color: var(--success);
    font-size: 14px;
    font-weight: 800;
}

.cvc-copy-btn {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cvc-copy-btn:hover,
.cvc-copy-btn:focus {
    outline: none;
    border-color: var(--accent-mid);
    background: var(--accent-light);
    color: var(--accent);
}

.cvc-formula-box {
    padding: 6px 8px;
    border: 1px dashed #d9c98b;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.25;
}

.cvc-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}

.cvc-kpi-card,
.cvc-band-card,
.cvc-table-card,
.cvc-reading-card,
.cvc-disclaimer,
.cvc-waiting {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.cvc-kpi-card {
    display: grid;
    gap: 3px;
    padding: 7px 8px;
}

.cvc-kpi-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cvc-kpi-value {
    min-width: 0;
    color: var(--text);
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.cvc-result-lower {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 6px;
    align-items: stretch;
}

.cvc-band-card,
.cvc-table-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
}

.cvc-reading-card {
    display: block;
    grid-column: 1 / -1;
    padding: 0;
}

.cvc-reading-card[open] {
    padding: 10px;
}

.cvc-reading-card > summary {
    padding: 8px;
    cursor: pointer;
    list-style: none;
}

.cvc-reading-card > summary::-webkit-details-marker {
    display: none;
}

.cvc-reading-card[open] > summary {
    padding: 0 0 8px;
}

.cvc-mini-title {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
}

.cvc-mini-title i {
    color: var(--accent);
}

.cvc-band-track {
    position: relative;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(184, 134, 11, 0.08), rgba(184, 134, 11, 0.24));
}

.cvc-band-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #eadfb8 0%, var(--accent) 100%);
    transition: width 0.24s ease;
}

.cvc-band-marker {
    position: absolute;
    top: 50%;
    left: 0;
    width: 14px;
    height: 14px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 2px 8px rgba(45, 42, 38, 0.16);
    transform: translate(-50%, -50%);
    transition: left 0.24s ease;
}

.cvc-band-scale {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 800;
}

.cvc-table-wrap {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
}

.cvc-summary-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
}

.cvc-summary-table tr.cvc-optional-row {
    display: none;
}

.cvc-summary-table tr + tr {
    border-top: 1px solid #f0ece5;
}

.cvc-summary-table th,
.cvc-summary-table td {
    padding: 3px 2px !important;
    text-align: left;
    vertical-align: top;
    line-height: 1.15 !important;
}

.cvc-summary-table th {
    width: 42%;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.cvc-summary-table td {
    color: var(--text);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.cvc-step-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-left: 16px;
}

.cvc-note-card {
    display: grid;
    gap: 4px;
    margin-top: auto;
    padding: 8px;
    border: 1px solid var(--accent-mid);
    border-radius: 8px;
    background: var(--accent-light);
}

.cvc-note-card strong {
    color: var(--accent);
    font-size: 13px;
}

.cvc-note-card p {
    color: var(--muted);
}

.cvc-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 7px 9px;
    box-shadow: none;
}

.cvc-disclaimer i {
    color: var(--accent);
    line-height: 1.35;
}

.cvc-waiting {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border-color: var(--accent-mid);
    background: var(--accent-light);
    color: var(--muted);
    box-shadow: none;
}

.cvc-waiting p {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
}

.cvc-waiting i {
    color: var(--accent);
}

.cvc-waiting.is-error {
    border-color: rgba(177, 70, 34, 0.26);
    background: var(--danger-light);
}

.cvc-waiting.is-error i {
    color: var(--danger);
}

@media (max-width: 760px) {
    .cvc-compact-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .cvc-result-lower {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .cvc-tool-header,
    .cvc-result-hero,
    .cvc-actions-row {
        grid-template-columns: 1fr;
    }

    .cvc-tool-header {
        display: grid;
        gap: 10px;
    }

    .cvc-live-pill {
        width: fit-content;
    }

    .cvc-result-hero {
        display: grid;
        gap: 10px;
    }

    .cvc-hero-side {
        padding-right: 0;
    }

    .cvc-copy-btn {
        position: static;
        width: 100%;
        height: 34px;
    }

    .cvc-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cvc-kpi-wide {
        grid-column: 1 / -1;
    }

    .cvc-result-lower {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .cvc-tool {
        padding: 12px;
    }

    .cvc-tool-title {
        font-size: 20px;
    }

    .cvc-tool-lead {
        font-size: 14px;
    }

    .cvc-summary-inputs,
    .cvc-options-grid,
    .cvc-mode-tabs,
    .cvc-kpi-grid {
        grid-template-columns: 1fr;
    }

    .cvc-label-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .cvc-formula-strip {
        grid-template-columns: 1fr;
    }

    .cvc-hero-value {
        font-size: 37px;
    }

    .cvc-summary-table th,
    .cvc-summary-table td {
        display: block;
        width: 100%;
        padding: 4px 0;
    }

    .cvc-summary-table td {
        padding-top: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cvc-mode-tab,
    .cvc-option-chip,
    .cvc-preset-btn,
    .cvc-utility-btn,
    .cvc-copy-btn,
    .cvc-band-fill,
    .cvc-band-marker,
    .cvc-textarea-wrap,
    .cvc-input-box {
        transition: none !important;
    }
}
