/* --- THEME CUSTOMIZATION VARIABLES --- */
:root {
    --rbmi-v4-primary-color: #0073aa; /* Matches WordPress Admin Blue */
    --rbmi-v4-secondary-color: #389e3c; /* A vibrant, healthy green */
    --rbmi-v4-tertiary-color: #ffb900; /* A warning yellow/orange */
    --rbmi-v4-text-color: #1e1e1e; /* Standard dark text for readability */
    --rbmi-v4-light-text-color: #50575e;
    --rbmi-v4-border-color: #ccd0d4;
    --rbmi-v4-light-border-color: #e2e4e7;
    --rbmi-v4-input-bg: #fff;
    --rbmi-v4-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --rbmi-v4-border-radius: 8px;
}

/* --- Main Layout & Grid --- */
.rev-bmi-v4-container {
    font-family: var(--rbmi-v4-font-family);
    color: var(--rbmi-v4-text-color);
    margin: 2rem 0;
}
.rev-bmi-v4-grid {
    display: grid;
    /* THIS IS THE KEY CHANGE: From two columns to one */
    grid-template-columns: 1fr;
    gap: 2rem; /* This creates the space between the calculator and results */
}

/* --- Input Elements --- */
.rev-bmi-v4-input-group { margin-bottom: 2rem; }
.rev-bmi-v4-label {
    display: block; font-size: 0.9rem; font-weight: 600;
    color: var(--rbmi-v4-light-text-color); margin-bottom: 0.75rem;
}
.rev-bmi-v4-label-row {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 0.75rem;
}
#rbmi-v4-value-display { font-size: 1.1rem; font-weight: 700; color: var(--rbmi-v4-primary-color); }

/* Segmented Control */
.rev-bmi-v4-segmented-control {
    display: flex; width: 100%; border: 1px solid var(--rbmi-v4-border-color);
    border-radius: var(--rbmi-v4-border-radius); overflow: hidden;
}
.rev-bmi-v4-segmented-control input[type="radio"] { display: none; }
.rev-bmi-v4-segmented-control label {
    flex: 1; text-align: center; padding: 0.8rem 0.5rem;
    font-size: 0.95rem; font-weight: 500;
    background-color: var(--rbmi-v4-input-bg);
    cursor: pointer; transition: all 0.2s ease-in-out;
}
.rev-bmi-v4-segmented-control label:not(:last-child) { border-right: 1px solid var(--rbmi-v4-border-color); }
.rev-bmi-v4-segmented-control input[type="radio"]:checked + label {
    background-color: var(--rbmi-v4-primary-color); color: white;
}

/* Input Fields with Icons */
.rev-bmi-v4-height-inputs { display: flex; gap: 1rem; }
.rev-bmi-v4-input-wrapper { position: relative; flex: 1; }
.rev-bmi-v4-input-wrapper.icon-height::before,
.rev-bmi-v4-input-wrapper.icon-weight::before {
    content: ''; position: absolute; left: 1rem; top: 50%;
    transform: translateY(-50%); width: 16px; height: 16px;
    opacity: 0.4; background-size: contain; background-repeat: no-repeat;
}
.rev-bmi-v4-input-wrapper.icon-height::before { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M6 2h12v2H6V2zm1 4h10v11h-4v3H9v-3H5V6zm2 2v7h6V8H8z"></path></svg>'); }
.rev-bmi-v4-input-wrapper.icon-weight::before { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 1.01 5.01 1a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h13.98a2 2 0 0 0 2-2V3a2 2 0 0 0-2-1.99zM12 18c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zM12 8c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"></path></svg>'); }
.rev-bmi-v4-input-wrapper input[type="number"] {
    width: 100%; padding: 0.9rem 1rem 0.9rem 2.8rem;
    border: 1px solid var(--rbmi-v4-border-color);
    border-radius: var(--rbmi-v4-border-radius); font-size: 1rem; box-sizing: border-box;
}
.rev-bmi-v4-input-wrapper input[type="number"]:focus {
    outline: none; border-color: var(--rbmi-v4-primary-color);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}
#rbmi-v4-current-weight-unit {
    position: absolute; right: 1rem; top: 50%;
    transform: translateY(-50%); color: var(--rbmi-v4-light-text-color);
}

/* BMI Slider */
input[type="range"]#rbmi-v4-slider {
    -webkit-appearance: none; width: 100%; height: 6px;
    background: linear-gradient(90deg, var(--rbmi-v4-tertiary-color) 0%, var(--rbmi-v4-secondary-color) 40%, var(--rbmi-v4-tertiary-color) 80%);
    border-radius: 5px; outline: none;
}
input[type="range"]#rbmi-v4-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 20px; height: 20px;
    background: white; border: 3px solid var(--rbmi-v4-primary-color);
    border-radius: 50%; cursor: pointer; margin-top: -7px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.rev-bmi-v4-range-labels {
    display: flex; justify-content: space-between;
    font-size: 0.8rem; color: var(--rbmi-v4-light-text-color); margin-top: 0.5rem;
}

/* --- Results Section --- */
.rev-bmi-v4-results {
    /* NEW: Adds the visual separator line */
    border-top: 1px solid var(--rbmi-v4-light-border-color);
    padding-top: 2rem;
}
.rev-bmi-v4-prompt-message {
    display: flex; align-items: center; justify-content: center; height: 100%; text-align: center;
    color: var(--rbmi-v4-light-text-color); font-size: 1.1rem;
    border: 2px dashed var(--rbmi-v4-light-border-color);
    border-radius: var(--rbmi-v4-border-radius); padding: 2rem;
}
.rev-bmi-v4-hidden { display: none !important; }

/* Hero Result */
.rev-bmi-v4-hero-result {
    text-align: center; margin-bottom: 2rem; padding: 1.5rem;
    background-color: #f8f9fa; border: 1px solid var(--rbmi-v4-light-border-color);
    border-radius: var(--rbmi-v4-border-radius);
}
.rev-bmi-v4-hero-label {
    display: block; font-size: 1rem; color: var(--rbmi-v4-light-text-color); margin-bottom: 0.5rem;
}
.rev-bmi-v4-hero-value {
    display: block; font-size: 2.8rem; font-weight: 700;
    color: var(--rbmi-v4-primary-color); line-height: 1.2;
}

/* Analysis Section & Summary */
.rev-bmi-v4-analysis-section { margin-bottom: 2rem; }
.rev-bmi-v4-summary { font-size: 1.1rem; text-align: center; }
.rev-bmi-v4-summary strong { color: var(--rbmi-v4-primary-color); }

/* BMI Weight Chart */
.rev-bmi-v4-chart-container { margin-bottom: 2rem; }
.rev-bmi-v4-chart-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.rev-bmi-v4-chart-table th, .rev-bmi-v4-chart-table td {
    text-align: left; padding: 0.8rem; border-bottom: 1px solid var(--rbmi-v4-light-border-color);
}
.rev-bmi-v4-chart-table th {
    font-weight: 600; color: var(--rbmi-v4-light-text-color); background-color: #f8f9fa;
}
.rev-bmi-v4-chart-table tbody tr:nth-child(even) { background-color: #fdfdfd; }
.rev-bmi-v4-chart-table .highlight-row { background-color: #eaf3ff !important; font-weight: 700; }
.rev-bmi-v4-chart-table .highlight-row td:first-child { color: var(--rbmi-v4-primary-color); }

/* Tooltip for Ideal Weight Info */
.rev-bmi-v4-tooltip {
    display: inline-block; margin-left: 4px; font-weight: 700;
    color: var(--rbmi-v4-light-text-color); cursor: help;
    border: 1px solid #ccc; border-radius: 50%;
    width: 16px; height: 16px; line-height: 16px; text-align: center; font-style: normal;
}

/* Detailed Results Grid */
.rev-bmi-v4-details-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.rev-bmi-v4-detail-card {
    border: 1px solid var(--rbmi-v4-light-border-color);
    border-radius: var(--rbmi-v4-border-radius);
    padding: 1.25rem; display: flex; flex-direction: column;
}
.rev-bmi-v4-detail-label { font-size: 0.9rem; color: var(--rbmi-v4-light-text-color); margin-bottom: 0.5rem; }
.rev-bmi-v4-detail-value { font-size: 1.5rem; font-weight: 700; color: var(--rbmi-v4-text-color); }

/* --- Buttons & Utility --- */
.rev-bmi-v4-actions { display: flex; gap: 1rem; margin-top: 2rem; }
.rev-bmi-v4-button {
    flex: 1; padding: 0.9rem 1rem; font-size: 1rem; font-weight: 600;
    border-radius: var(--rbmi-v4-border-radius); border: 1px solid transparent;
    cursor: pointer; transition: all 0.2s ease;
    background-color: var(--rbmi-v4-primary-color); color: white;
}
.rev-bmi-v4-button:hover { opacity: 0.85; }
.rev-bmi-v4-button-secondary {
    background-color: #fff; color: var(--rbmi-v4-light-text-color);
    border-color: var(--rbmi-v4-border-color);
}
.rev-bmi-v4-button-secondary:hover { background-color: #f6f7f7; border-color: #949a9f; }

/* --- Responsive & Print --- */
@media (max-width: 600px) {
    .rev-bmi-v4-details-grid { grid-template-columns: 1fr; }
    .rev-bmi-v4-hero-value { font-size: 2.2rem; }
    .rev-bmi-v4-detail-value { font-size: 1.3rem; }
}
@media (max-width: 480px) {
    .rev-bmi-v4-actions { flex-direction: column; }
}

@media print {
    body > *:not(.rev-bmi-v4-print-area) { display: none; }
    .rev-bmi-v4-print-area { display: block !important; }
    .rev-bmi-v4-container { margin: 0; }
    .rev-bmi-v4-grid { grid-template-columns: 1fr; }
    .rev-bmi-v4-inputs { display: none; }
    .rev-bmi-v4-results { padding: 0 !important; border-top: none; }
}