/**
 * Crypto Tools - 投资收益计算器样式
 *
 * @package CryptoTools
 */

.container--profit {
    max-width: 40rem;
}

.profit-header {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.profit-header__title {
    margin: 0 0 var(--space-sm);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--color-text);
}

.profit-header__subtitle {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--color-text-muted);
}

/* 模式切换 */
.profit-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    padding: var(--space-xs);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.profit-tab {
    flex: 1;
    min-width: 6rem;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.profit-tab:hover,
.profit-tab:focus-visible {
    color: var(--color-text);
    background: rgba(59, 130, 246, 0.08);
}

.profit-tab.is-active {
    background: rgba(59, 130, 246, 0.18);
    color: var(--color-primary-light);
}

/* 面板 */
.profit-panel {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.profit-panel[hidden] {
    display: none;
}

/* 表单 */
.profit-form {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--color-border);
}

.profit-field {
    margin-bottom: var(--space-md);
}

.profit-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.profit-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.profit-input {
    width: 100%;
    padding: var(--space-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text);
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: border-color var(--transition-fast);
}

.profit-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.profit-select {
    cursor: pointer;
    font-weight: 500;
}

/* 结果摘要：纵向排列，每项横排 label + 数值，避免溢出 */
.profit-summary__hero {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

.profit-summary__item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    min-width: 0;
}

.profit-summary__label {
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.profit-summary__value {
    flex: 1;
    min-width: 0;
    text-align: right;
    font-size: clamp(0.875rem, 2.5vw, 1.125rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
}

.profit-summary__value--profit.is-profit,
.profit-summary__value--rate.is-profit {
    color: #4ade80;
}

.profit-summary__value--profit.is-loss,
.profit-summary__value--rate.is-loss {
    color: #f87171;
}

/* 明细列表 */
.profit-details {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.profit-detail {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.profit-detail__label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.profit-detail__value {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary-light);
    text-align: right;
    white-space: nowrap;
}

.profit-footer-note {
    margin: 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* 移动端 */
@media (max-width: 640px) {
    .profit-panel {
        padding: var(--space-lg);
    }

    .profit-field-row {
        grid-template-columns: 1fr;
    }

    .profit-tabs {
        flex-direction: column;
    }

    .profit-tab {
        min-width: 100%;
    }

    .profit-detail__value {
        font-size: 0.9375rem;
    }
}
