:root {
    --primary-color: #A12336;
    /* CHI Mexican Red */
    --accent-color: #2ecc71;
    /* Success Green */
    --bg-gradient: linear-gradient(135deg, #A12336 0%, #7a0f1e 100%);
    --card-bg: #ffffff;
    /* Pure White Background */
    --text-dark: #2c3e50;
    /* Dark Grey for Text */
    --text-light: #ffffff;
    --text-muted: #7f8c8d;
    --border-color: #e0e0e0;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    /* Generic shadow, not red */
    --radius: 12px;
}

.chi-calc-container-v3 {
    font-family: 'Outfit', 'Inter', sans-serif;
    color: var(--text-dark);
    max-width: 800px;
    margin: 40px auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.chi-calc-header {
    background: var(--bg-gradient);
    color: white;
    padding: 30px;
    text-align: center;
}

.chi-calc-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff !important;
}

.chi-calc-header p {
    margin: 5px 0 0;
    opacity: 0.8;
}

/* Tabs */
.chi-calc-product-tabs {
    display: flex;
    overflow-x: auto;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
}

.product-tab {
    flex: 1;
    border: none;
    padding: 15px 20px;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s ease;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}

.product-tab:hover {
    color: var(--primary-color);
    background: rgba(161, 35, 54, 0.05);
}

.product-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: white;
}

.product-tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f1f1f1 !important;
    color: #999 !important;
}

.product-tab.disabled:hover {
    background: #f1f1f1 !important;
    color: #999 !important;
}

/* Form Layout */
.chi-calc-main {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row.single-col {
    grid-template-columns: 1fr;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

input[type="number"],
input[type="text"],
input[type="date"],
select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(161, 35, 54, 0.1);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f1f2f6;
    padding: 15px;
    border-radius: 8px;
}

.checkbox-label {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* Frequency Note */
.freq-note {
    background: #fff5f6;
    /* Very light red tint */
    border-left: 3px solid var(--primary-color);
    padding: 10px 15px;
    font-size: 0.85rem;
    color: var(--text-dark);
    margin: 10px 0 20px;
    border-radius: 4px;
}

/* Buttons */
.btn-primary {
    width: auto;
    min-width: 200px;
    display: block;
    margin: 20px auto 0;
    background: #A12336 !important;
    color: white;
    border: none;
    padding: 10px 30px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
    box-shadow: 0 4px 15px rgba(161, 35, 54, 0.3);
}

.btn-primary:hover {
    background: #8e1f2f !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(161, 35, 54, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid #dcdde1;
    /* Grey border for secondary, not red dashed */
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    background: #fff5f6;
}

/* Results Section */
.hidden {
    display: none !important;
}

#results-display {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.results-card {
    background: #1a1a1a;
    color: white;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: 16px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.4s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.results-card header {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#results-content {
    padding: 25px;
    overflow-y: auto;
}

.btn-icon {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

/* Comparison Table Styling */
.chi-v3-comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chi-v3-comparison-table th {
    padding: 12px;
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.chi-v3-comparison-table td {
    padding: 15px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chi-v3-comparison-table .freq-name {
    font-weight: bold;
    color: var(--text-light);
}

.chi-v3-comparison-table .premium-value {
    text-align: right;
    font-size: 1.1rem;
    color: var(--accent-color);
    font-weight: bold;
}

.chi-v3-comparison-table tr:hover {
    background: rgba(46, 204, 113, 0.05);
}

/* Info Table Styling */
.chi-v3-info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    overflow: hidden;
}

.chi-v3-info-table tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chi-v3-info-table td {
    padding: 12px 15px;
}

.chi-v3-info-table td.label {
    color: var(--text-muted);
}

.chi-v3-info-table td.value {
    text-align: right;
    font-weight: 500;
}

/* Results Components */
.results-subtitle {
    margin: 20px 0 10px;
    color: var(--accent-color);
    font-size: 1.2rem;
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    border-radius: 8px;
}

.breakdown-row {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.breakdown-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 2px 0;
}

.breakdown-label {
    color: var(--text-muted);
    font-weight: bold;
}

.breakdown-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.breakdown-item strong {
    color: var(--accent-color);
}

.results-note {
    margin-top: 20px;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
}

.results-actions {
    text-align: center;
    margin-top: 25px;
}

.text-right {
    text-align: right;
}

.results-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-outline {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
}

/* Life Entry */
.life-entry {
    background: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin: 10px 0;
    border-radius: 0 8px 8px 0;
    position: relative;
    color: var(--text-dark);
}

.remove-life {
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: bold;
}

/* Media Queries */
@media (max-width: 768px) {
    .chi-calc-container-v3 {
        margin: 20px 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .chi-calc-header h1 {
        font-size: 1.5rem;
    }

    .chi-calc-main {
        padding: 20px;
    }

    .results-card {
        width: 100%;
        height: auto;
        max-height: 85vh;
        border-radius: 12px;
    }

    .chi-v3-comparison-table {
        font-size: 0.9rem;
    }

    .chi-v3-comparison-table th,
    .chi-v3-comparison-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .product-tab {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .chi-calc-header {
        padding: 20px;
    }

    .btn-primary {
        padding: 12px;
        font-size: 1rem;
    }
}