/**
 * ISA 계좌 수익 계산기 (ISA Calculator)
 * Prefix: isac
 *
 * @package Zipper
 */

/* ===== Layout ===== */
.isac-main-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
}

.isac-input-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.isac-result-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    position: sticky;
    top: 20px;
    align-self: start;
}

/* ===== Section ===== */
.isac-section {
    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;
}

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

.isac-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #2d2a26;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.isac-section-title i {
    color: #d4af37;
    font-size: 15px;
}

/* ===== Hidden ===== */
.isac-hidden {
    display: none !important;
}

/* ===== Tabs (3 tabs, flex OK per Rule 25) ===== */
.isac-tabs {
    display: flex;
    gap: 4px;
    background: #f5f3f0;
    border-radius: 8px;
    padding: 4px;
}

.isac-tab {
    flex: 1;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #8c8578;
    cursor: pointer;
    transition: all 0.2s;
}

.isac-tab.active {
    background: #fff;
    color: #2c2a25;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.isac-tab:hover:not(.active) {
    color: #5c5649;
    background: rgba(255, 255, 255, 0.5);
}

/* ===== Tab Content ===== */
.isac-tab-content {
    display: none;
}

.isac-tab-content.active {
    display: block;
}

/* Tab content gap (Rule 44) */
.isac-tab-content .isac-section + .isac-section {
    margin-top: 14px;
}

.isac-tab-content .isac-btn-group {
    margin-top: 14px;
}

/* ===== Input Group ===== */
.isac-input-group {
    margin-bottom: 10px;
    max-width: 100%;
    box-sizing: border-box;
}

.isac-input-group:last-child {
    margin-bottom: 0;
}

.isac-input-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #5f5a56;
    margin-bottom: 6px;
}

.isac-label-hint {
    font-weight: 400;
    color: #9e9a96;
    margin-left: 4px;
}

.isac-amount-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 15px;
    font-weight: 600;
    text-align: right;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #faf9f7;
    color: #2d2a26;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.isac-amount-input:hover {
    border-color: #d4c67a;
}

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

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

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

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

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

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

.isac-korean-amount {
    font-size: 11px;
    color: #d4af37;
    margin-top: 4px;
    text-align: right;
    min-height: 16px;
}

.isac-hint {
    font-size: 11px;
    color: #9e9a96;
    margin-top: 6px;
}

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

/* ===== Buttons ===== */
.isac-btn-group {
    display: flex;
    gap: 8px;
}

.isac-calculate-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #d4af37 0%, #c9a22e 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.25);
    transition: box-shadow 0.2s, transform 0.1s;
}

.isac-calculate-btn:hover {
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.35);
}

.isac-calculate-btn:active {
    transform: scale(0.98);
}

.isac-reset-btn {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #5f5a56;
    background: #f5f3f0;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.isac-reset-btn:hover {
    background: #edeae6;
}

/* ===== Item List (Tab 2) ===== */
.isac-item-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.isac-item {
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    padding: 14px;
}

.isac-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.isac-item-num {
    font-size: 12px;
    font-weight: 600;
    color: #5c5649;
}

.isac-item-remove {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #b0a99c;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 14px;
}

.isac-item-remove:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.08);
}

.isac-toggle-group {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.isac-toggle-btn {
    flex: 1;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    background: #fff;
    color: #8c8578;
    cursor: pointer;
    transition: all 0.2s;
}

.isac-toggle-btn.active[data-type="gain"] {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #a5d6a7;
}

.isac-toggle-btn.active[data-type="loss"] {
    background: #fbe9e7;
    color: #d32f2f;
    border-color: #ef9a9a;
}

.isac-add-btn {
    width: 100%;
    padding: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #d4af37;
    background: #fdfbf5;
    border: 1px dashed #e8e0c8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.isac-add-btn:hover {
    background: #faf6ec;
    border-color: #d4af37;
}

/* ===== Waiting ===== */
.isac-waiting {
    text-align: center;
    padding: 60px 20px;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
}

.isac-waiting-icon {
    font-size: 48px;
    color: #d4af37;
    opacity: 0.4;
    margin-bottom: 16px;
}

.isac-waiting-title {
    font-size: 18px;
    font-weight: 700;
    color: #2d2a26;
    margin-bottom: 8px;
}

.isac-waiting-desc {
    font-size: 14px;
    color: #8c8984;
}

/* ===== Result Summary ===== */
.isac-result-summary {
    background: linear-gradient(135deg, #fdfbf5 0%, #faf6ec 100%);
    border: 1px solid #e8e0c8;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.12);
}

.isac-summary-title {
    font-size: 13px;
    font-weight: 600;
    color: #8c8578;
    margin-bottom: 4px;
}

.isac-summary-main {
    font-size: 32px;
    font-weight: 800;
    color: #d4af37;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.isac-summary-unit {
    font-size: 18px;
    font-weight: 600;
    color: #b89830;
    margin-left: 2px;
}

.isac-summary-label {
    font-size: 12px;
    color: #9e9a96;
    margin-bottom: 16px;
}

.isac-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid rgba(212, 175, 55, 0.15);
}

.isac-summary-row-label {
    font-size: 13px;
    color: #5f5a56;
}

.isac-summary-row-value {
    font-size: 14px;
    font-weight: 600;
    color: #2d2a26;
}

/* ===== Tax Colors ===== */
.isac-tax-isa {
    color: #d4af37;
}

.isac-tax-normal {
    color: #e74c3c;
}

.isac-tax-saving {
    color: #2e7d32;
    font-weight: 700;
}

.isac-gain-text {
    color: #2e7d32;
}

.isac-loss-text {
    color: #e74c3c;
}

/* ===== Detail Table ===== */
.isac-detail-table {
    display: flex;
    flex-direction: column;
}

.isac-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0ede8;
    font-size: 13px;
}

.isac-detail-row:last-child {
    border-bottom: none;
}

.isac-detail-header {
    font-weight: 600;
    color: #5c5649;
    border-bottom: 2px solid #e8e4dc;
}

.isac-detail-total {
    font-weight: 700;
    color: #2d2a26;
    background: #faf9f7;
    padding: 10px 18px;
    margin: 0 -18px;
    border-radius: 0 0 12px 12px;
}

.isac-detail-row-label {
    color: #5f5a56;
}

.isac-detail-row-value {
    font-weight: 600;
    color: #2d2a26;
}

/* ===== Netting Results (Tab 2) ===== */
.isac-netting-items {
    display: flex;
    flex-direction: column;
}

.isac-netting-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f0ede8;
    font-size: 13px;
}

.isac-netting-row:last-child {
    border-bottom: none;
}

.isac-netting-header {
    font-weight: 600;
    color: #5c5649;
    border-bottom: 2px solid #e8e4dc;
}

.isac-netting-total {
    font-weight: 700;
    color: #2d2a26;
    background: #faf9f7;
    padding: 8px;
    margin: 0 -18px;
    padding-left: 18px;
    padding-right: 18px;
}

/* ===== Compare Cards (Tab 3) ===== */
.isac-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.isac-compare-card {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 10px;
    padding: 16px;
    transition: box-shadow 0.2s;
}

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

.isac-compare-card.isac-compare-best {
    border-color: #d4af37;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.15);
}

.isac-compare-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #2d2a26;
    margin-bottom: 4px;
}

.isac-compare-card-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    margin-bottom: 12px;
    margin-right: 4px;
}

.isac-badge-general {
    background: #f0ede8;
    color: #5c5649;
}

.isac-badge-underprivileged {
    background: #e8f5e9;
    color: #2e7d32;
}

.isac-badge-domestic {
    background: #e3f2fd;
    color: #1565c0;
}

.isac-badge-best {
    background: #fff8e1;
    color: #f57f17;
}

.isac-compare-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid #f5f3f0;
}

.isac-compare-item:last-child {
    border-bottom: none;
}

.isac-compare-item-label {
    color: #8c8578;
}

.isac-compare-item-value {
    font-weight: 600;
    color: #2d2a26;
}

.isac-compare-saving {
    color: #2e7d32;
    font-weight: 700;
}

/* ===== Chart ===== */
.isac-donut-wrap {
    position: relative;
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
}

.isac-chart-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.isac-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #5f5a56;
}

.isac-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.isac-dot-exempt {
    background: #66bb6a;
}

.isac-dot-taxed {
    background: #42a5f5;
}

.isac-dot-tax {
    background: #ef5350;
}

/* ===== Disclaimer ===== */
.isac-disclaimer {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    font-size: 11px;
    color: #9e9a96;
    line-height: 1.5;
}

.isac-disclaimer i {
    color: #d4af37;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .isac-main-layout {
        grid-template-columns: 1fr;
    }

    .isac-result-col {
        position: static;
    }

    .isac-input-col {
        width: 100%;
    }

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

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

@media (max-width: 480px) {
    .isac-main-layout,
    .isac-input-col,
    .isac-result-col {
        max-width: 100%;
        overflow-x: hidden;
    }

    .isac-input-row {
        grid-template-columns: 1fr;
    }

    .isac-summary-main {
        font-size: 26px;
    }

    .isac-netting-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    .isac-section,
    .isac-amount-input,
    .isac-calculate-btn,
    .isac-tab,
    .isac-compare-card {
        transition: none !important;
    }

    .isac-section:hover,
    .isac-calculate-btn:hover,
    .isac-compare-card:hover {
        transform: none !important;
    }
}
