/**
 * Tool: Child Height Predictor Stylesheet
 * Strictly adheres to brand design tokens, mobile-first responsiveness, and WCAG AA accessibility
 */

.chp-wrapper {
    width: 100%;
    margin: 0 auto;
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    color: var(--ink, #1e293b);
}

.chp-card {
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0, 0, 0, 0.06));
    padding: 24px;
    margin-bottom: 28px;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

@media (min-width: 768px) {
    .chp-card {
        padding: 32px;
    }
}

/* Header & Intro */
.chp-tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 12px;
    border-radius: var(--radius-full, 9999px);
    background: var(--brand-primary-soft, #fdf2f8);
    color: var(--brand-primary, #d9006b);
    margin-bottom: 12px;
}

.chp-title {
    font-size: clamp(22px, 3.2vw, 28px);
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 8px;
    color: var(--ink, #0f172a);
}

.chp-desc {
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink-soft, #475569);
    margin: 0 0 24px;
}

/* Control Row: Units & Gender */
.chp-top-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

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

.chp-control-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft, #475569);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Segmented Control Buttons */
.chp-segmented-pill {
    display: inline-flex;
    background: var(--canvas, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-full, 9999px);
    padding: 3px;
    gap: 2px;
}

.chp-segment-btn {
    border: none;
    background: transparent;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-full, 9999px);
    color: var(--ink-soft, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.chp-segment-btn:focus-visible {
    outline: 2px solid var(--brand-primary, #d9006b);
    outline-offset: 2px;
}

.chp-segment-btn.active {
    background: var(--surface, #ffffff);
    color: var(--brand-primary, #d9006b);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
    font-weight: 700;
}

/* Form Grid */
.chp-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 640px) {
    .chp-form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.chp-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chp-field.chp-field-full {
    grid-column: 1 / -1;
}

.chp-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink, #1e293b);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chp-label-hint {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-light, #94a3b8);
}

.chp-input,
.chp-select {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    font-size: 15px;
    color: var(--ink, #0f172a);
    background: var(--surface, #ffffff);
    border: 1.5px solid var(--border, #cbd5e1);
    border-radius: var(--radius-md, 10px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.chp-input:focus,
.chp-select:focus {
    border-color: var(--brand-primary, #d9006b);
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-primary-soft, rgba(217, 0, 107, 0.12));
}

/* Split Input Group (e.g. Ft + In or Years + Months) */
.chp-split-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.chp-input-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.chp-input-suffix .chp-input {
    padding-right: 48px;
}

.chp-suffix-text {
    position: absolute;
    right: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-light, #94a3b8);
    pointer-events: none;
}

/* Name Match Pill Badge */
.chp-name-badge {
    display: none;
    margin-top: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-md, 8px);
    background: var(--canvas, #f1f5f9);
    font-size: 13px;
    color: var(--ink-soft, #475569);
    align-items: center;
    gap: 8px;
}

.chp-name-badge a {
    color: var(--brand-primary, #d9006b);
    font-weight: 700;
    text-decoration: underline;
}

/* Form Action Buttons */
.chp-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border, #e2e8f0);
}

.chp-btn-calculate {
    flex: 1;
    min-width: 200px;
    min-height: 48px;
    background: var(--brand-gradient, linear-gradient(135deg, #d9006b 0%, #1a47e7 100%));
    color: #ffffff;
    border: none;
    border-radius: var(--radius-full, 9999px);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    box-shadow: 0 4px 14px rgba(217, 0, 107, 0.25);
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.chp-btn-calculate:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(217, 0, 107, 0.35);
}

.chp-btn-calculate:active {
    transform: translateY(1px);
}

.chp-btn-calculate:focus-visible {
    outline: 3px solid var(--brand-secondary, #1a47e7);
    outline-offset: 3px;
}

.chp-btn-reset {
    min-height: 48px;
    background: var(--canvas, #f8fafc);
    color: var(--ink-soft, #475569);
    border: 1.5px solid var(--border, #cbd5e1);
    border-radius: var(--radius-full, 9999px);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 12px 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.chp-btn-reset:hover {
    background: var(--surface, #ffffff);
    border-color: var(--ink-soft, #475569);
    color: var(--ink, #0f172a);
}

/* Results Display Section */
.chp-results-container {
    margin-top: 32px;
    animation: chpFadeIn 0.4s ease forwards;
}

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

.chp-results-hero {
    background: linear-gradient(135deg, rgba(217, 0, 107, 0.05) 0%, rgba(26, 71, 231, 0.06) 100%);
    border: 2px solid var(--border, #e2e8f0);
    border-radius: var(--radius-lg, 16px);
    padding: 28px 24px;
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.chp-results-eyebrow {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand-primary, #d9006b);
    margin-bottom: 8px;
}

.chp-predicted-main {
    font-size: clamp(36px, 6vw, 54px);
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--ink, #0f172a);
    line-height: 1.1;
    margin: 4px 0 10px;
}

.chp-predicted-sub {
    font-size: clamp(18px, 3vw, 22px);
    font-weight: 700;
    color: var(--brand-secondary, #1a47e7);
    margin-bottom: 16px;
}

.chp-range-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #cbd5e1);
    padding: 8px 18px;
    border-radius: var(--radius-full, 9999px);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink, #1e293b);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.05));
}

.chp-range-pill strong {
    color: var(--brand-primary, #d9006b);
}

/* Dual Method Breakdown Cards */
.chp-methods-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 640px) {
    .chp-methods-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.chp-method-card {
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-md, 12px);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chp-method-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chp-method-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink, #0f172a);
    margin: 0;
}

.chp-method-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full, 9999px);
    background: var(--canvas, #f1f5f9);
    color: var(--ink-soft, #475569);
    text-transform: uppercase;
}

.chp-method-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--ink, #0f172a);
}

.chp-method-desc {
    font-size: 13px;
    color: var(--ink-soft, #64748b);
    line-height: 1.5;
    margin: 0;
}

/* Height Comparison Benchmarks */
.chp-benchmark-card {
    background: var(--canvas, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-md, 12px);
    padding: 20px;
    margin-bottom: 24px;
}

.chp-benchmark-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink, #0f172a);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chp-bench-item {
    margin-bottom: 14px;
}

.chp-bench-item:last-child {
    margin-bottom: 0;
}

.chp-bench-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.chp-bench-bar-track {
    width: 100%;
    height: 12px;
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #cbd5e1);
    border-radius: var(--radius-full, 9999px);
    overflow: hidden;
    position: relative;
}

.chp-bench-bar-fill {
    height: 100%;
    border-radius: var(--radius-full, 9999px);
    background: var(--brand-secondary, #1a47e7);
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.chp-bench-bar-fill.fill-highlight {
    background: var(--brand-gradient, linear-gradient(90deg, #d9006b, #1a47e7));
}

/* Sharing & Action Buttons */
.chp-results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.chp-btn-share {
    flex: 1;
    min-width: 140px;
    min-height: 44px;
    border-radius: var(--radius-full, 9999px);
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.chp-btn-whatsapp {
    background: #25d366;
    color: #ffffff;
    border: none;
}

.chp-btn-whatsapp:hover {
    background: #20ba59;
    color: #ffffff;
}

.chp-btn-copy {
    background: var(--surface, #ffffff);
    color: var(--ink, #1e293b);
    border: 1.5px solid var(--border, #cbd5e1);
}

.chp-btn-copy:hover {
    border-color: var(--brand-primary, #d9006b);
    color: var(--brand-primary, #d9006b);
}

/* Growth Guide Accordion */
.chp-guide-section {
    margin-top: 36px;
    border-top: 1px solid var(--border, #e2e8f0);
    padding-top: 28px;
}

.chp-guide-heading {
    font-size: 20px;
    font-weight: 800;
    color: var(--ink, #0f172a);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chp-accordion-item {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-md, 10px);
    margin-bottom: 10px;
    background: var(--surface, #ffffff);
    overflow: hidden;
}

.chp-accordion-header {
    width: 100%;
    min-height: 50px;
    padding: 14px 18px;
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink, #0f172a);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    text-align: left;
}

.chp-accordion-header:focus-visible {
    outline: 2px solid var(--brand-primary, #d9006b);
    outline-offset: -2px;
}

.chp-accordion-icon {
    font-size: 14px;
    color: var(--ink-light, #94a3b8);
    transition: transform 0.2s ease;
}

.chp-accordion-header[aria-expanded="true"] .chp-accordion-icon {
    transform: rotate(180deg);
}

.chp-accordion-content {
    display: none;
    padding: 0 18px 18px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink-soft, #475569);
    border-top: 1px solid var(--border, #f1f5f9);
}

.chp-accordion-header[aria-expanded="true"] + .chp-accordion-content {
    display: block;
}

/* Copy Toast */
.chp-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: var(--radius-full, 9999px);
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    display: none;
    animation: chpToastIn 0.3s ease;
}

@keyframes chpToastIn {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}
