/**
 * Percent Error Calculator Styles
 * 퍼센트 오차 계산기 전용 스타일
 *
 * @package Zipper
 */

.pec-hidden {
    display: none !important;
}

.pec-intro {
    display: grid;
    gap: 8px;
}

#pecCalculator .tool-layout-split {
    grid-template-columns: minmax(0, 350px) minmax(0, 1fr);
    gap: 18px;
}

#pecCalculator .tool-layout-input {
    max-width: 350px;
}

.pec-lead {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: #5f5a56;
}

.pec-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
    transition: box-shadow 0.2s ease;
}

.pec-section:hover {
    box-shadow: 0 2px 8px rgba(45, 42, 38, 0.1);
}

.pec-section-title,
.pec-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
}

.pec-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.pec-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.12);
    color: #8a6500;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.pec-section-title i,
.pec-subtitle i,
.pec-live-pill i {
    color: #d4af37;
}

.pec-input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.pec-input-grid-secondary {
    align-items: start;
}

.pec-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 100%;
    box-sizing: border-box;
}

.pec-input-label {
    font-size: 13px;
    font-weight: 600;
    color: #5f5a56;
}

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

.pec-select-row {
    align-items: center;
}

.pec-amount-input,
.pec-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    min-height: 44px;
    padding: 11px 13px;
    font-size: 15px;
    font-weight: 500;
    color: #2d2a26;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pec-amount-input:hover,
.pec-select:hover {
    border-color: #d4c67a;
}

.pec-amount-input:focus,
.pec-select:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.pec-amount-input::placeholder {
    font-weight: 400;
    color: #c4c0bc;
}

.pec-unit-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 11px;
    border-radius: 9px;
    border: 1px solid #e8e4dc;
    background: #faf9f7;
    color: #5f5a56;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.pec-input-hint {
    font-size: 12px;
    color: #7a756d;
    line-height: 1.45;
}

.pec-preset-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.pec-preset-btn {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e8e4dc;
    border-radius: 999px;
    background: #fff;
    color: #5f5a56;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pec-preset-btn:hover,
.pec-preset-btn.is-active {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.12);
    color: #8a6500;
}

.pec-btn-group {
    display: flex;
    gap: 8px;
}

.pec-btn-group.is-realtime {
    display: grid;
}

.pec-btn-group .tool-btn {
    flex: 1;
}

.pec-btn-group.is-realtime .tool-btn {
    width: 100%;
}

.pec-tip-section {
    gap: 12px;
}

.pec-tip-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding-left: 18px;
    color: #5f5a56;
    font-size: 14px;
    line-height: 1.6;
}

.pec-waiting {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
    padding: 18px 16px;
    border: 1px solid #f1d6bf;
    border-radius: 10px;
    background: #fff8f1;
    color: #9e6f46;
}

.pec-waiting i {
    font-size: 28px;
    color: #d4af37;
    opacity: 0.7;
}

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

.pec-result-hero {
    display: grid;
    gap: 10px;
    background: linear-gradient(135deg, #fdfbf5 0%, #faf6ec 100%);
    border: 1px solid #eadfb8;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 10px 24px rgba(212, 175, 55, 0.14);
}

.pec-result-hero.is-perfect {
    border-color: rgba(79, 183, 126, 0.35);
    box-shadow: 0 10px 24px rgba(79, 183, 126, 0.16);
}

.pec-result-hero.is-within {
    border-color: rgba(212, 175, 55, 0.32);
}

.pec-result-hero.is-over {
    border-color: rgba(220, 134, 52, 0.34);
    box-shadow: 0 10px 24px rgba(220, 134, 52, 0.16);
}

.pec-result-hero.is-high {
    border-color: rgba(204, 64, 64, 0.34);
    box-shadow: 0 10px 24px rgba(204, 64, 64, 0.16);
}

.pec-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pec-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.pec-status-badge.is-example,
.pec-status-badge.is-within {
    background: rgba(212, 175, 55, 0.14);
    color: #8a6500;
}

.pec-status-badge.is-perfect {
    background: rgba(79, 183, 126, 0.14);
    color: #2d8b42;
}

.pec-status-badge.is-over {
    background: rgba(220, 134, 52, 0.14);
    color: #b25f13;
}

.pec-status-badge.is-high,
.pec-status-badge.is-warning {
    background: rgba(204, 64, 64, 0.14);
    color: #b32626;
}

.pec-copy-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e1d2a6;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #8a6500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pec-copy-btn:hover {
    border-color: #d4af37;
    background: #fff;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.18);
}

.pec-hero-value {
    font-size: 40px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    color: #b58913;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.pec-result-hero.is-perfect .pec-hero-value {
    color: #2d8b42;
}

.pec-result-hero.is-over .pec-hero-value {
    color: #b25f13;
}

.pec-result-hero.is-high .pec-hero-value {
    color: #b32626;
}

.pec-hero-value .unit {
    margin-left: 4px;
    font-size: 20px;
    font-weight: 600;
    color: #5f5a56;
}

.pec-hero-label {
    font-size: 14px;
    font-weight: 600;
    color: #5f5a56;
}

.pec-hero-summary {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: #4a4640;
}

.pec-formula-box {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(212, 175, 55, 0.18);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: #5f5a56;
    word-break: break-word;
}

.pec-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.pec-kpi-card,
.pec-threshold-card {
    display: grid;
    gap: 4px;
    padding: 14px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e8e4dc;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.04);
}

.pec-kpi-label,
.pec-threshold-card-label {
    font-size: 12px;
    font-weight: 600;
    color: #7a756d;
}

.pec-kpi-value,
.pec-threshold-card strong {
    font-size: 19px;
    font-weight: 700;
    color: #2d2a26;
    line-height: 1.3;
    word-break: break-word;
}

.pec-compare-list,
.pec-threshold-grid {
    display: grid;
    gap: 10px;
}

.pec-compare-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pec-compare-item {
    display: grid;
    gap: 7px;
}

.pec-compare-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    font-size: 14px;
    color: #5f5a56;
}

.pec-compare-head strong {
    color: #2d2a26;
}

.pec-compare-track,
.pec-threshold-track {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    border-radius: 999px;
    background: #eee7dc;
}

.pec-compare-track {
    height: 14px;
}

.pec-compare-bar,
.pec-threshold-fill {
    height: 100%;
    border-radius: inherit;
    transition: width 0.35s ease;
}

.pec-compare-bar.reference {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
}

.pec-compare-bar.measured {
    background: linear-gradient(135deg, #8a6ad8 0%, #5b44b1 100%);
}

.pec-compare-note {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #7a756d;
}

.pec-threshold-track-wrap {
    display: grid;
    gap: 8px;
}

.pec-threshold-track {
    height: 18px;
}

.pec-threshold-fill {
    background: linear-gradient(135deg, #f1c76a 0%, #d4af37 100%);
}

.pec-threshold-marker {
    position: absolute;
    top: 50%;
    width: 2px;
    height: 26px;
    transform: translate(-1px, -50%);
    background: #5b44b1;
    border-radius: 2px;
}

.pec-threshold-labels {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: #7a756d;
}

.pec-threshold-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pec-threshold-card-wide {
    grid-column: span 3;
}

.pec-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.pec-summary-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 320px;
}

.pec-summary-table th,
.pec-summary-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #efe7da;
    text-align: left;
    font-size: 13px;
    line-height: 1.5;
}

.pec-summary-table th {
    width: 38%;
    color: #5f5a56;
    font-weight: 600;
    background: #faf9f7;
}

.pec-summary-table td {
    color: #2d2a26;
    font-weight: 500;
}

.pec-disclaimer {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 10px;
    background: #faf9f7;
    border: 1px solid #ece6dc;
    color: #6a645d;
    font-size: 13px;
    line-height: 1.5;
}

.pec-disclaimer i {
    margin-top: 2px;
    color: #d4af37;
}

@media (max-width: 1200px) {
    .pec-kpi-grid,
    .pec-threshold-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pec-threshold-card-wide {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    #pecCalculator .tool-layout-split {
        grid-template-columns: 1fr;
    }

    #pecCalculator .tool-layout-input {
        max-width: 100%;
    }

    .pec-input-grid,
    .pec-threshold-grid,
    .pec-kpi-grid {
        grid-template-columns: 1fr;
    }

    .pec-compare-list {
        grid-template-columns: 1fr;
    }

    .tool-layout-input {
        max-width: 100%;
        overflow: hidden;
    }

    .pec-input-group input:not([type="radio"]):not([type="checkbox"]),
    .pec-input-group select {
        width: 100% !important;
        max-width: 100% !important;
    }
}

@media (max-width: 768px) {
    .pec-btn-group {
        flex-direction: column;
    }

    .pec-section,
    .pec-result-hero {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .tool-section,
    .tool-layout-split,
    .tool-layout-input,
    .tool-layout-result {
        max-width: 100%;
        overflow-x: hidden;
    }

    .pec-amount-row {
        grid-template-columns: 1fr;
    }

    .pec-unit-chip {
        width: 100%;
    }

    .pec-preset-list {
        grid-template-columns: 1fr;
    }

    .pec-hero-value {
        font-size: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pec-section,
    .pec-amount-input,
    .pec-select,
    .pec-copy-btn,
    .pec-compare-bar,
    .pec-threshold-fill,
    .pec-preset-btn {
        transition: none !important;
    }

    .pec-section:hover,
    .pec-copy-btn:hover {
        transform: none !important;
    }
}
