/* ============================================================
   FBS Beauty — Results: summary card, score ring, metrics,
   observations, care, procedures, plan, CTA, modals,
   lighting warning, form fields
   ============================================================ */


/* ── STEP 5 — RESULTS ─────────────────────────────────────── */

#step-results {
    background: var(--c-bg);
}

.results-top {
    background: linear-gradient(160deg, var(--c-primary) 0%, #3d5a4a 100%);
    color: var(--c-white);
    padding: var(--space-xl) var(--space-md) var(--space-xxl);
    text-align: center;
}

.results-brand {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--c-sage);
    margin-bottom: var(--space-xs);
}

.results-top h1 {
    color: var(--c-white);
    margin-bottom: var(--space-xs);
}

.results-date {
    color: rgba(255, 255, 255, .5);
    font-size: 0.8rem;
}


/* Summary card (overlaps hero) */

.summary-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-lg);
    margin: calc(-1 * var(--space-xl)) var(--space-md) 0;
    position: relative;
    z-index: 1;
}

.summary-inner {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-md);
    align-items: start;
}

.score-ring {
    width: 90px;
    height: 90px;
    position: relative;
    flex-shrink: 0;
}

.score-ring svg {
    overflow: visible;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring-track {
    fill: none;
    stroke: var(--c-beige);
    stroke-width: 6;
}

.score-ring-fill {
    fill: none;
    stroke: var(--c-sage-dark);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    /* set by JS */
    transition: stroke-dashoffset 1.2s ease;
}

.score-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.score-num {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--c-primary);
    font-family: var(--font-heading);
}

.score-unit {
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

.summary-info {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
}

.skin-type-badge {
    display: inline-block;
    background: var(--c-beige);
    color: var(--c-brown);
    border-radius: var(--radius-sm);
    padding: 0.2em 0.9em;
    font-size: 0.8rem;
    font-weight: 500;
    align-self: flex-start;
}

.skin-age-label {
    font-size: 0.8rem;
    color: var(--c-text-muted);
}

.summary-text {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--c-text);
    margin-top: 0.3em;
}

.skin-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
    margin-bottom: 0.3em;
}

.aging-badge {
    background: var(--c-primary);
    color: #fff;
}

.photo-note {
    font-size: 0.8rem;
    color: var(--c-taupe);
    background: #fdf6ec;
    border: 1px solid var(--c-sand);
    border-radius: var(--radius-sm);
    padding: 0.4em 0.7em;
    margin: 0.3em 0;
}


/* Lighting warning */

.lighting-warning {
    background: rgba(210, 171, 128, 0.15);
    border-left: 3px solid var(--c-sand);
    padding: 0.75rem 1rem;
    margin: 0.75rem var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--c-brown);
}


/* Results sections */

.results-body {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-lg) var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.result-section h2 {
    margin-bottom: var(--space-md);
    padding-bottom: 0.5em;
    border-bottom: 2px solid var(--c-beige);
}


/* ── Metrics ─────────────────────────────────────────────── */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.metric-card {
    background: var(--c-surface);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    text-align: center;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4em;
}

.metric-icon {
    font-size: 1.3rem;
}

.metric-ring-wrap {
    position: relative;
    width: 64px;
    height: 64px;
}

.metric-ring-wrap svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    overflow: visible;
}

.metric-track {
    fill: none;
    stroke: var(--c-beige);
    stroke-width: 5;
}

.metric-fill {
    fill: none;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 100;
    transition: stroke-dashoffset 1s ease .3s;
}

.metric-value-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-primary);
}

.metric-label {
    font-size: 0.88rem;
    color: var(--c-text-muted);
    text-align: center;
    line-height: 1.3;
}


/* ── Observations ────────────────────────────────────────── */

.insight-chevron {
    transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.4, 1.2), opacity 0.2s;
    font-size: 20px;
    font-weight: 300;
    display: inline-block;
    transform-origin: center;
}


/* ============================================================
   COLLAPSE FOR OBSERVATIONS, CARE & PROCEDURES
   Premium smooth expand/collapse
   ============================================================ */


/* Базовый контейнер для коллапса */

.collapse-wrapper {
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.collapse-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.2, 0.9, 0.4, 1), opacity 0.3s ease, margin 0.2s linear;
}

.collapse-content.expanded {
    opacity: 1;
    margin-top: 8px;
}


/* Кнопка-триггер — минималистичная, без лишнего визуального шума */

.collapse-trigger {
    background: none;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--c-taupe, #af9483);
    letter-spacing: 0.3px;
    transition: opacity 0.2s, color 0.2s;
    margin-top: 6px;
}

.collapse-trigger:active {
    opacity: 0.6;
}

.collapse-trigger .chevron {
    font-size: 14px;
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.2);
    display: inline-block;
}

.collapse-trigger .chevron.rotated {
    transform: rotate(180deg);
}

.collapse-trigger .trigger-text {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* Специфичные стили для разных секций */

.obs-card .collapse-trigger {
    margin-left: 0;
    margin-top: 8px;
}

.care-item .collapse-trigger {
    margin-top: 4px;
}

.proc-card .collapse-trigger {
    margin-top: 8px;
}


/* Анимация для плавного появления */

.collapse-content .care-why,
.collapse-content .obs-desc,
.collapse-content .proc-desc {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Observations — новый стиль с шевроном справа */

.obs-card {
    background: var(--c-surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-xs);
    border-left: 3px solid transparent;
}

.obs-card.severity-high {
    border-left-color: var(--c-high, #e07a5f);
}

.obs-card.severity-medium {
    border-left-color: var(--c-medium, #f4a261);
}

.obs-card.severity-low {
    border-left-color: var(--c-low, #81b29a);
}

.obs-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-sm);
    cursor: pointer;
}

.obs-info {
    flex: 1;
}

.obs-zone {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-taupe, #8b7a6b);
    margin-bottom: 0.25em;
}

.obs-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0;
    line-height: 1.35;
}

.obs-chevron-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin: -8px -8px -8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.obs-chevron {
    font-size: 20px;
    font-weight: 300;
    color: var(--c-text-muted, #8e8e93);
    transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.2);
    display: inline-block;
}

.obs-chevron.rotated {
    transform: rotate(180deg);
}

.obs-desc-wrapper {
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.2, 0.9, 0.4, 1), opacity 0.3s ease;
    max-height: 0;
    opacity: 0;
}

.obs-desc-wrapper:not(.collapsed) {
    opacity: 1;
    margin-top: 12px;
}

.obs-desc {
    font-size: 0.875rem;
    color: var(--c-text-muted, #6c6c74);
    line-height: 1.6;
    padding-top: 4px;
}


/* Шеврон для ухода - такие же стили как для наблюдений */

.care-chevron-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.care-product-with-chevron {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.care-desc-wrapper {
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.2, 0.9, 0.4, 1);
    max-height: 0;
}

.care-desc-inner {
    padding-top: 12px;
    font-size: 0.875rem;
    color: var(--c-text-muted, #6c6c74);
    line-height: 1.55;
}


/* Care product с шевроном справа */

.care-product-with-chevron {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.care-chevron-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}


/* Обёртка для описания ухода */

.care-desc-wrapper {
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.2, 0.9, 0.4, 1);
    max-height: 0;
}

.care-desc-inner {
    padding-top: 12px;
}


/* Темы */

@media (prefers-color-scheme: dark) {
    .obs-chevron {
        color: #8e8e93;
    }
}

.care-chevron-btn {
    flex-shrink: 0;
}

.care-chevron {
    transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.2);
    display: inline-block;
}

.care-chevron.rotated {
    transform: rotate(180deg);
}

.collapse-content {
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.2, 0.9, 0.4, 1);
    max-height: 0;
}

.collapse-content:not(.collapsed) {
    max-height: 200px;
    margin-top: 12px;
}


/* */

.observations-list {
    display: flex;
    flex-direction: column;
    /* gap: var(--space-sm); */
}

.obs-card {
    background: var(--c-surface);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
    box-shadow: var(--shadow-sm);
    align-items: start;
    padding-left: 15px;
    /* display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-sm); */
    /* border-left: 4px solid var(--c-border); */
}

.obs-card.severity-high {
    border-left-color: var(--c-high);
}

.obs-card.severity-medium {
    border-left-color: var(--c-medium);
}

.obs-card.severity-low {
    border-left-color: var(--c-low);
}

.obs-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.severity-high .obs-dot {
    background: var(--c-high);
}

.severity-medium .obs-dot {
    background: var(--c-medium);
}

.severity-low .obs-dot {
    background: var(--c-low);
}

.obs-zone {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-taupe);
    margin-bottom: 0.15em;
}

.obs-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2em;
}

.obs-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.proc-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    /* marhin-bottom: 5px; */
    font-size: 12px;
    background: #fdf6ec;
    border-radius: 50%;
    border: 1px #000000 solid;
    cursor: pointer;
    position: relative;
}

.proc-info-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: #1a1a1a;
    color: white;
    font-size: 12px;
    font-weight: normal;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: normal;
    width: 220px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.proc-info-icon:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    border: 6px solid transparent;
    border-top-color: #1a1a1a;
    z-index: 1000;
}


/* ── Care routine ────────────────────────────────────────── */

.care-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.care-card {
    background: var(--c-surface);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    box-shadow: var(--shadow-sm);
}

.care-card h3 {
    margin-bottom: var(--space-lg);
    margin-left: -15px;
    font-size: 1.3rem;
    text-align: center;
}

.care-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75em;
}

.care-item {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 0.6em;
    align-items: start;
}

.care-step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--c-beige);
    color: var(--c-brown);
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.care-product {
    font-size: 0.875rem;
    font-weight: 500;
}

.care-why {
    font-size: 0.88rem;
    color: var(--c-text-muted);
    margin-top: 0.1em;
    line-height: 1.4;
}


/* ── Procedures ──────────────────────────────────────────── */

.procedures-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.proc-card {
    background: var(--c-surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-sm);
    align-items: start;
}

.proc-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.3em;
}

.proc-desc {
    font-size: 0.9rem;
    color: var(--c-text-muted);
    margin-bottom: 0.4em;
}

.proc-benefit {
    font-size: 0.87rem;
    color: var(--c-taupe);
    background: #fff6eb;
    border: 1px #e3d3bc solid;
    border-radius: var(--radius-sm);
    padding: 0.25em 1em;
    display: inline-block;
}

.proc-course {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    margin-top: 0.4em;
}

.proc-badge {
    font-size: 0.77rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.3em 0.8em;
    border-radius: var(--radius-xl);
    text-transform: uppercase;
    white-space: nowrap;
}

.priority-high .proc-badge {
    background: var(--c-primary);
    color: #fff;
}

.priority-medium .proc-badge {
    background: var(--c-taupe);
    color: #fff;
}

.priority-low .proc-badge {
    background: var(--c-beige);
    color: var(--c-brown);
}


/* ── Plan card ───────────────────────────────────────────── */

.plan-card {
    background: var(--c-surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--c-sage-dark);
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--c-text);
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}


/* ── Results CTA ─────────────────────────────────────────── */

.results-cta {
    background: var(--c-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.results-cta h3 {
    color: var(--c-white);
    font-size: 1.2rem;
}

.results-cta p {
    color: rgba(255, 255, 255, .7);
    font-size: 0.9rem;
    max-width: 360px;
}

.results-cta .btn-primary {
    background: var(--c-sage);
    color: var(--c-primary);
    font-weight: 600;
    max-width: 320px;
}

.results-cta .btn-primary:hover {
    background: #c8ddc3;
}

.results-cta .btn-secondary {
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .8);
    border: 1px solid rgba(255, 255, 255, .2);
    max-width: 320px;
}

.results-cta .btn-secondary:hover {
    background: rgba(255, 255, 255, .18);
}

.results-disclaimer {
    text-align: center;
    font-size: 0.77rem;
    color: var(--c-text-muted);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}


/* Error state */

.results-error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-align: center;
    color: var(--c-high);
}


/* ── Modals ──────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 62, 80, .7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    padding: 0;
}

@media (min-width: 600px) {
    .modal-overlay {
        align-items: center;
        padding: var(--space-md);
    }
}

.modal {
    background: var(--c-surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--space-md) var(--space-lg) max(var(--space-lg), env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 480px;
    position: relative;
    animation: slideUp .3s ease;
    will-change: transform;
}

@media (min-width: 600px) {
    .modal {
        border-radius: var(--radius-lg);
    }
}

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

.modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: var(--c-beige);
    border: none;
    border-radius: 50%;
    width: 37px;
    height: 37px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-brown);
    transition: background .2s;
}

.modal-close:hover {
    background: var(--c-sand);
}

.modal h2 {
    padding-top: 6px;
    margin-bottom: 1.3em;
    font-size: 1.3rem;
}

.modal>p {
    color: var(--c-text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
}


/* ── Form fields ─────────────────────────────────────────── */

.modal-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.3em;
}

.form-field label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--c-text);
}

.form-field input {
    padding: 0.9em 1em;
    min-height: 44px;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--c-text);
    background: var(--c-bg);
    transition: border-color .2s;
    outline: none;
}

.form-field input:focus {
    border-color: var(--c-sage-dark);
}

.modal-footer {
    text-align: left;
    color: #ffffff;
    margin-top: var(--space-sm);
}

.modal-footer a {
    color: var(--c-taupe);
    text-decoration: underline;
}

.modal-success {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
}

.success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--c-sage);
    color: var(--c-primary);
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
}

.modal-success h2 {
    margin-bottom: 0.4em;
}

.modal-success p {
    color: var(--c-text-muted);
    margin-bottom: var(--space-lg);
}

.Hydration .metric-track {
    stroke: #4b81ff0a;
}

.Hydration .metric-fill {
    stroke: #7194e8;
}

.Elasticity .metric-track {
    stroke: #66a09d14;
}

.Elasticity .metric-fill {
    stroke: #3bc3bd;
}

.Evenness .metric-track {
    stroke: #ed7d910f;
}

.Evenness .metric-fill {
    stroke: #fe7590;
}

.Clarity .metric-track {
    stroke: #d1d1d142;
}

.Clarity .metric-fill {
    stroke: #696c73;
}


/* ── Desktop adjustments — results ──────────────────────── */

@media (min-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .care-grid {
        grid-template-columns: 1fr 1fr;
    }
    .summary-card {
        margin: calc(-1 * var(--space-xl)) auto 0;
        max-width: calc(var(--content-max) - 2 * var(--space-md));
    }
    .results-top {
        padding: var(--space-xxl) var(--space-md) calc(var(--space-xxl) + 20px);
    }
}

@media (max-width: 480px) {
    .care-grid {
        grid-template-columns: 1fr;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .summary-inner {
        grid-template-columns: 1fr;
    }
    .score-ring {
        margin: 0 auto;
    }
    /* Results top — reduce excessive bottom padding */
    .results-top {
        padding: var(--space-xl) var(--space-md) var(--space-xl);
    }
    /* Results body — tighter gap */
    .results-body {
        gap: var(--space-lg);
        padding: var(--space-md) var(--space-sm);
    }
    /* Proc card — stack vertically so badge doesn't crush text */
    .proc-card {
        grid-template-columns: 1fr;
    }
    .proc-badge {
        align-self: flex-start;
        margin-top: 0.3em;
        width: fit-content;
    }
}


/* Tablets 481-767px — metrics 2 columns */

@media (min-width: 481px) and (max-width: 767px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .lighting-warning {
        margin: 10px auto 0;
        max-width: calc(var(--content-max) - 2 * var(--space-md));
    }
}