/* ===== Free Health Tools — Shared Styles ===== */

.tool-page {
    padding: 160px 0 100px;
    background: var(--bg-white);
}

.tool-page .container {
    max-width: 900px;
    margin: 0 auto;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.breadcrumb a {
    color: var(--primary-color);
    font-weight: 500;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span[aria-hidden] {
    color: var(--text-light);
}

/* Tool Header */
.tool-header {
    margin-bottom: 40px;
}

.tool-header h1 {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.2;
}

.tool-header p {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Calculator Card */
.tool-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 18px 60px rgba(26, 43, 37, 0.08);
    padding: clamp(24px, 4vw, 48px);
    margin-bottom: 40px;
    overflow: hidden;
    max-width: 100%;
}

/* Form Elements */
.tool-form {
    display: grid;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-primary);
    background: white;
    transition: border-color 0.2s ease;
    max-width: 100%;
    min-width: 0;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.form-group .input-with-unit {
    position: relative;
}

.form-group .input-with-unit input {
    width: 100%;
    padding-right: 54px;
}

.form-group .input-with-unit .unit-label {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
    pointer-events: none;
}

/* Unit Toggle */
.unit-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-light);
    border-radius: 10px;
    padding: 4px;
    width: fit-content;
    margin-bottom: 8px;
}

.unit-toggle button {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--text-secondary);
}

.unit-toggle button.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(7, 160, 109, 0.25);
}

/* Calculate Button */
.btn-calculate {
    padding: 14px 32px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-calculate:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(7, 160, 109, 0.3);
}

.btn-calculate:active {
    transform: translateY(0);
}

/* Results */
.tool-result {
    display: none;
    margin-top: 24px;
    padding: 24px;
    background: var(--bg-light);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.tool-result.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-value {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.result-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 16px;
}

.result-details {
    display: grid;
    gap: 12px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 15px;
}

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

.result-row .label {
    color: var(--text-secondary);
}

.result-row .value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Result Bar Chart */
.result-bar-chart {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.bar-item {
    display: grid;
    grid-template-columns: 120px 1fr 80px;
    align-items: center;
    gap: 12px;
}

.bar-item .bar-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.bar-track {
    height: 24px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease;
}

.bar-item .bar-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

/* Color-coded bars */
.bar-fill.protein { background: var(--primary-color); }
.bar-fill.carbs { background: var(--secondary-color); }
.bar-fill.fat { background: #0284c7; }
.bar-fill.zone1 { background: #6ee7b7; }
.bar-fill.zone2 { background: #34d399; }
.bar-fill.zone3 { background: var(--primary-color); }
.bar-fill.zone4 { background: var(--secondary-color); }
.bar-fill.zone5 { background: #dc2626; }

/* Result Categories / Zones */
.result-zones {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.zone-row {
    display: grid;
    grid-template-columns: 140px 1fr 100px;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
}

.zone-row .zone-name {
    font-weight: 600;
}

.zone-row .zone-range {
    color: var(--text-secondary);
}

.zone-row .zone-bpm {
    font-weight: 600;
    text-align: right;
}

/* Zone colors */
.zone-row.z1 { background: rgba(110, 231, 183, 0.15); color: #065f46; }
.zone-row.z2 { background: rgba(52, 211, 153, 0.15); color: #065f46; }
.zone-row.z3 { background: rgba(7, 160, 109, 0.15); color: #065f46; }
.zone-row.z4 { background: rgba(234, 96, 32, 0.15); color: #9a3412; }
.zone-row.z5 { background: rgba(220, 38, 38, 0.15); color: #991b1b; }

/* Info Section below tool */
.tool-info {
    margin-top: 48px;
}

.tool-info h2 {
    font-size: clamp(22px, 3vw, 28px);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.tool-info h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 32px;
    margin-bottom: 12px;
}

.tool-info p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.tool-info ul {
    margin: 0 0 16px 24px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.tool-info li {
    margin-bottom: 4px;
}

/* Medical Disclaimer */
.tool-disclaimer {
    margin-top: 32px;
    padding: 16px 20px;
    background: #fff4db;
    border-left: 4px solid #ff9800;
    border-radius: 8px;
    font-size: 14px;
    color: #7a5900;
    line-height: 1.6;
}

/* CTA Section */
.tool-cta {
    margin-top: 48px;
    padding: 32px;
    background: linear-gradient(135deg, #174546, #08885D);
    border-radius: 16px;
    text-align: center;
    color: white;
}

.tool-cta h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
}

.tool-cta p {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 20px;
    line-height: 1.6;
    color: white;
}

.tool-cta .app-badges {
    justify-content: center;
}

/* Conversion table */
.conversion-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.conversion-table th,
.conversion-table td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 15px;
}

.conversion-table th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-light);
    border-radius: 8px 8px 0 0;
}

.conversion-table td {
    color: var(--text-secondary);
}

.conversion-table tr:hover td {
    background: rgba(7, 160, 109, 0.03);
}

/* Search Input */
.search-input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-primary);
    background: white;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.search-wrapper .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

/* Abbreviation list */
.abbrev-list {
    display: grid;
    gap: 8px;
    max-height: 600px;
    overflow-y: auto;
}

.abbrev-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
}

.abbrev-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(7, 160, 109, 0.08);
}

.abbrev-code {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 15px;
}

.abbrev-name {
    font-size: 15px;
    color: var(--text-primary);
}

.abbrev-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Timer */
.timer-display {
    text-align: center;
    padding: 32px;
}

.timer-countdown {
    font-size: clamp(48px, 8vw, 72px);
    font-weight: 700;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

.timer-status {
    font-size: 18px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.timer-status.fasting {
    color: var(--primary-color);
    font-weight: 600;
}

.timer-status.complete {
    color: var(--primary-color);
    font-weight: 700;
}

.timer-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.btn-timer {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-timer.primary {
    background: var(--primary-color);
    color: white;
}

.btn-timer.primary:hover {
    background: var(--primary-dark);
}

.btn-timer.secondary {
    background: var(--bg-light);
    color: var(--text-primary);
}

.btn-timer.secondary:hover {
    background: var(--bg-darker);
}

/* Fasting guidelines */
.fasting-guidelines {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.guideline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.guideline-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

.guideline-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.guideline-text strong {
    color: var(--text-primary);
}

/* Checklist */
.checklist {
    display: grid;
    gap: 8px;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.5;
}

.checklist-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1px;
}

.checklist-check.checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Sleep time buttons */
.sleep-times {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.sleep-time-option {
    padding: 16px;
    border-radius: 12px;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.06);
    text-align: center;
    cursor: default;
    transition: all 0.2s ease;
}

.sleep-time-option .time {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.sleep-time-option .cycles {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.sleep-time-option .quality {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
}

.sleep-time-option .quality.good {
    background: rgba(7, 160, 109, 0.1);
    color: var(--primary-color);
}

.sleep-time-option .quality.ok {
    background: rgba(234, 96, 32, 0.1);
    color: var(--secondary-color);
}

.sleep-time-option.recommended {
    border-color: var(--primary-color);
    background: rgba(7, 160, 109, 0.03);
}

/* Test frequency table */
.frequency-table {
    width: 100%;
    border-collapse: collapse;
}

.frequency-table th,
.frequency-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 14px;
}

.frequency-table th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-light);
}

.frequency-table td {
    color: var(--text-secondary);
}

.frequency-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.frequency-badge.annual { background: rgba(7, 160, 109, 0.1); color: #065f46; }
.frequency-badge.biannual { background: rgba(2, 132, 199, 0.1); color: #0c4a6e; }
.frequency-badge.quarterly { background: rgba(234, 96, 32, 0.1); color: #9a3412; }

/* Multi-select checkboxes */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    border-color: var(--primary-color);
}

.checkbox-label input {
    accent-color: var(--primary-color);
}

/* Tab switcher (bedtime/wake mode) */
.tab-switcher {
    display: flex;
    gap: 4px;
    background: var(--bg-light);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
}

.tab-switcher button {
    flex: 1;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--text-secondary);
}

.tab-switcher button.active {
    background: white;
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

/* Responsive */
@media (max-width: 640px) {
    .tool-page {
        padding: 120px 0 60px;
    }

    .tool-card {
        padding: 20px 16px;
    }

    .tool-form {
        min-width: 0;
    }

    .form-group select {
        font-size: 14px;
        padding: 10px 12px;
    }

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

    .bar-item {
        grid-template-columns: 90px 1fr 60px;
    }

    .zone-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .zone-row .zone-bpm {
        text-align: left;
    }

    .abbrev-item {
        grid-template-columns: 80px 1fr;
    }

    .sleep-times {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .checkbox-group {
        grid-template-columns: 1fr;
    }
}
