/**
 * Fraction Calculator Styles
 * Localized styles for the English fraction calculator
 *
 * @package Zipper
 */

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

.fracc-intro {
    display: grid;
    gap: 10px;
}

.fracc-lead {
    margin: 0 0 4px;
    font-size: 15px;
    line-height: 1.6;
    color: #5f5a56;
}

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

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

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

.fracc-section-title-inline {
    font-size: 14px;
}

.fracc-section-title i,
.fracc-subtitle i {
    color: #d4af37;
}

.fracc-fraction-card,
.fracc-operation-panel {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid #ece7de;
    border-radius: 12px;
    background: #faf9f7;
}

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

.fracc-card-label {
    font-size: 14px;
    font-weight: 700;
    color: #2d2a26;
}

.fracc-card-note {
    font-size: 12px;
    color: #7a756d;
}

.fracc-fraction-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 10px;
    align-items: end;
}

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

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

.fracc-input,
.fracc-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 12px 14px;
    font-size: 16px;
    font-weight: 500;
    color: #2d2a26;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

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

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

.fracc-divider {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 44px;
    font-size: 28px;
    font-weight: 700;
    color: #8a6500;
}

.fracc-operation-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fracc-operation-btn,
.fracc-preset-btn {
    padding: 9px 14px;
    border: 1px solid #e8e4dc;
    border-radius: 999px;
    background: #fff;
    color: #5f5a56;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

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

.fracc-input-hint {
    font-size: 13px;
    line-height: 1.5;
    color: #7a756d;
}

.fracc-preset-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

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

.fracc-btn-group .tool-btn {
    flex: 1 1 0;
}

.fracc-tip-section {
    background: #fffdf9;
}

.fracc-tip-list,
.fracc-step-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
    color: #5f5a56;
    font-size: 14px;
    line-height: 1.6;
}

.fracc-waiting {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #eadfb8;
    background: #fffaf0;
    color: #7a5d18;
}

.fracc-waiting i {
    color: #d4af37;
    font-size: 18px;
    margin-top: 2px;
}

.fracc-waiting p {
    margin: 0;
    line-height: 1.6;
}

.fracc-result-hero {
    display: grid;
    gap: 12px;
    justify-items: center;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #eadfb8;
    background: linear-gradient(135deg, #fdfbf5 0%, #faf6ec 100%);
    box-shadow: 0 10px 24px rgba(212, 175, 55, 0.14);
    text-align: center;
}

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

.fracc-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.fracc-status-badge.is-valid {
    background: rgba(70, 180, 80, 0.12);
    color: #267237;
}

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

.fracc-status-badge.is-warning {
    background: rgba(255, 185, 0, 0.16);
    color: #8a6500;
}

.fracc-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    color: #5f5a56;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fracc-copy-btn:hover {
    border-color: #d4af37;
    color: #8a6500;
}

.fracc-hero-expression {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #7a756d;
}

.fracc-hero-value {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(32px, 6vw, 44px);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: #2d2a26;
    word-break: break-word;
}

.fracc-hero-label {
    font-size: 13px;
    color: #7a756d;
    width: 100%;
    text-align: center;
}

.fracc-hero-summary,
.fracc-formula-box {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: #5f5a56;
}

.fracc-formula-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px dashed rgba(212, 175, 55, 0.55);
    background: rgba(255, 255, 255, 0.65);
}

.fracc-hero-summary {
    max-width: 30rem;
}

.fracc-fraction-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}

.fracc-fraction-stack {
    display: inline-grid;
    grid-template-rows: auto auto auto;
    justify-items: center;
    min-width: 1.4em;
    line-height: 1;
}

.fracc-fraction-top,
.fracc-fraction-bottom {
    display: block;
    padding: 0 0.18em;
    white-space: nowrap;
}

.fracc-fraction-bar {
    width: 100%;
    min-width: 1.35em;
    height: 0;
    border-top: 2px solid currentColor;
    margin: 0.12em 0;
}

.fracc-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.fracc-kpi-card {
    display: grid;
    gap: 6px;
    justify-items: center;
    min-width: 0;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #e8e4dc;
    background: #fff;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.05);
    text-align: center;
}

.fracc-kpi-label {
    font-size: 12px;
    color: #7a756d;
}

.fracc-kpi-value {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 18px;
    font-weight: 700;
    color: #2d2a26;
    word-break: break-word;
}

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

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

.fracc-table th,
.fracc-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #ece7de;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
    line-height: 1.6;
    color: #2d2a26;
}

.fracc-table td .fracc-fraction-bar,
.fracc-step-list .fracc-fraction-bar {
    border-top-width: 1.5px;
}

.fracc-hero-value .fracc-fraction-stack {
    min-width: 1.7em;
}

.fracc-hero-value .fracc-fraction-top,
.fracc-hero-value .fracc-fraction-bottom {
    padding: 0 0.22em;
}

.fracc-hero-value .fracc-fraction-bar {
    min-width: 1.7em;
    border-top-width: 3px;
    margin: 0.16em 0;
}

.fracc-table th {
    width: 160px;
    color: #5f5a56;
    font-weight: 600;
}

@media (max-width: 900px) {
    .fracc-input,
    .fracc-select {
        width: 100% !important;
        max-width: 100% !important;
    }
}

@media (max-width: 768px) {
    .fracc-kpi-grid {
        grid-template-columns: 1fr;
    }

    .fracc-btn-group,
    .fracc-fraction-grid {
        grid-template-columns: 1fr;
    }

    .fracc-btn-group {
        display: grid;
    }

    .fracc-divider {
        min-height: auto;
        justify-self: center;
    }

    .fracc-card-head {
        align-items: flex-start;
    }
}

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

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

    .fracc-operation-group,
    .fracc-preset-list {
        gap: 6px;
    }

    .fracc-operation-btn,
    .fracc-preset-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fracc-section,
    .fracc-input,
    .fracc-select,
    .fracc-operation-btn,
    .fracc-preset-btn,
    .fracc-copy-btn {
        transition: none !important;
    }
}
