/**
 * Calculateur BARF – styles frontend (maquette)
 */

.barf-calculator {
    --barf-green: #5f7a44;
    --barf-green-dark: #4a6235;
    --barf-green-soft: #e8efe0;
    --barf-bg: #f6f4ef;
    --barf-card: #ffffff;
    --barf-text: #1a1a1a;
    --barf-muted: #6b6b6b;
    --barf-border: #e5e2db;
    --barf-radius: 20px;
    --barf-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);

    max-width: 560px;
    margin: 0 auto;
    font-family: inherit;
    color: var(--barf-text);
    box-sizing: border-box;
}

.barf-calculator *,
.barf-calculator *::before,
.barf-calculator *::after {
    box-sizing: border-box;
}

.barf-calculator .barf-card {
    background: var(--barf-card);
    border-radius: var(--barf-radius);
    padding: 28px 28px 24px;
    box-shadow: var(--barf-shadow);
    border: 1px solid var(--barf-border);
}

.barf-calculator .barf-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 22px;
}

.barf-calculator .barf-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--barf-green-soft);
    color: var(--barf-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
}

.barf-calculator .barf-header h2 {
    margin: 0 0 4px;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.2;
    text-transform: uppercase;
    color: var(--barf-text);
}

.barf-calculator .barf-header h2 span {
    color: var(--barf-green);
}

.barf-calculator .barf-header p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--barf-muted);
    line-height: 1.4;
}

.barf-calculator .barf-progress {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
}

.barf-calculator .barf-progress span {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--barf-border);
    transition: background 0.25s ease;
}

.barf-calculator .barf-progress span.is-active,
.barf-calculator .barf-progress span.is-done {
    background: var(--barf-green);
}

.barf-calculator .barf-step {
    display: none;
}

.barf-calculator .barf-step.is-active {
    display: block;
    animation: barfFadeIn 0.25s ease;
}

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

.barf-calculator .barf-step-title {
    margin: 0 0 18px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--barf-text);
}

.barf-calculator .barf-field {
    margin-bottom: 16px;
}

.barf-calculator .barf-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--barf-text);
}

.barf-calculator .barf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.barf-calculator input[type="text"],
.barf-calculator input[type="search"],
.barf-calculator input[type="number"],
.barf-calculator input[type="date"],
.barf-calculator select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--barf-border);
    background: #fafaf8;
    font-size: 0.95rem;
    color: var(--barf-text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

.barf-calculator select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235f7a44' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.barf-calculator input:focus,
.barf-calculator select:focus {
    border-color: var(--barf-green);
    box-shadow: 0 0 0 3px rgba(95, 122, 68, 0.15);
    background: #fff;
}

.barf-calculator .barf-species {
    display: flex;
    gap: 8px;
    background: var(--barf-bg);
    padding: 5px;
    border-radius: 12px;
}

.barf-calculator .barf-species button {
    flex: 1;
    margin: 0;
    border: none;
    border-radius: 10px;
    padding: 10px 12px;
    background: transparent;
    color: var(--barf-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.barf-calculator .barf-species button.is-selected {
    background: var(--barf-green);
    color: #fff;
}

.barf-calculator .barf-species button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.barf-calculator .barf-weight-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.barf-calculator .barf-weight-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 6px;
    background: linear-gradient(to right, var(--barf-green) 0%, var(--barf-green) var(--barf-pct, 25%), var(--barf-border) var(--barf-pct, 25%), var(--barf-border) 100%);
    outline: none;
    margin: 0;
    padding: 0;
    border: none;
    cursor: pointer;
}

.barf-calculator .barf-weight-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--barf-green);
    border: 3px solid #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.barf-calculator .barf-weight-row input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--barf-green);
    border: 3px solid #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.barf-calculator .barf-weight-value {
    min-width: 72px;
    text-align: right;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--barf-green);
    white-space: nowrap;
}

.barf-calculator .barf-weight-value input {
    width: 56px;
    display: inline-block;
    padding: 6px 8px;
    margin: 0 4px 0 0;
    text-align: center;
    font-weight: 700;
    color: var(--barf-green);
    border-radius: 8px;
}

.barf-calculator .barf-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.barf-calculator .barf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 12px;
    padding: 14px 22px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
    text-decoration: none;
    line-height: 1.2;
}

.barf-calculator .barf-btn:active {
    transform: scale(0.98);
}

.barf-calculator .barf-btn-primary {
    flex: 1;
    background: var(--barf-green);
    color: #fff;
    min-width: 160px;
}

.barf-calculator .barf-btn-primary:hover {
    background: var(--barf-green-dark);
    color: #fff;
}

.barf-calculator .barf-btn-secondary {
    background: transparent;
    color: var(--barf-muted);
    border: 1px solid var(--barf-border);
    padding: 13px 18px;
}

.barf-calculator .barf-btn-secondary:hover {
    border-color: var(--barf-green);
    color: var(--barf-green);
}

.barf-calculator .barf-btn-dark {
    flex: 1;
    background: #1a1a1a;
    color: #fff;
}

.barf-calculator .barf-btn-dark:hover {
    background: #000;
    color: #fff;
}

.barf-calculator .barf-result-box {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--barf-bg);
    border-radius: 16px;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.barf-calculator .barf-result-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.barf-calculator .barf-result-label {
    margin: 0 0 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--barf-muted);
}

.barf-calculator .barf-ration {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--barf-green);
    line-height: 1.15;
}

.barf-calculator .barf-kcal {
    margin-top: 4px;
    font-size: 0.95rem;
    color: var(--barf-text);
}

.barf-calculator .barf-result-meta {
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--barf-muted);
}

.barf-calculator .barf-result-details {
    background: #fafaf8;
    border: 1px solid var(--barf-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 0.88rem;
    color: var(--barf-muted);
}

.barf-calculator .barf-result-details ul {
    margin: 0;
    padding: 0 0 0 18px;
}

.barf-calculator .barf-result-details li {
    margin-bottom: 4px;
}

.barf-calculator .barf-disclaimer {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 0.8rem;
    color: var(--barf-muted);
    line-height: 1.4;
    margin-top: 14px;
}

.barf-calculator .barf-disclaimer .barf-info-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--barf-border);
    color: var(--barf-muted);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.barf-calculator .barf-error {
    color: #b42318;
    font-size: 0.85rem;
    margin: -6px 0 12px;
    display: none;
}

.barf-calculator .barf-error.is-visible {
    display: block;
}

.barf-calculator .barf-field.has-error input,
.barf-calculator .barf-field.has-error select {
    border-color: #f04438;
}

.barf-calculator .barf-health-note {
    font-size: 0.82rem;
    color: var(--barf-muted);
    background: #fff8e6;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: none;
}

.barf-calculator .barf-health-note.is-visible {
    display: block;
}

@media (max-width: 560px) {
    .barf-calculator .barf-card {
        padding: 22px 18px 20px;
        border-radius: 16px;
    }

    .barf-calculator .barf-grid {
        grid-template-columns: 1fr;
    }

    .barf-calculator .barf-header h2 {
        font-size: 1.3rem;
    }

    .barf-calculator .barf-ration {
        font-size: 1.45rem;
    }

    .barf-calculator .barf-actions {
        flex-direction: column-reverse;
    }

    .barf-calculator .barf-btn {
        width: 100%;
    }
}

/* ---------- Variante simple (maquette 2, 1 écran) ---------- */

.barf-calculator--simple {
    max-width: 640px;
}

.barf-calculator--simple .barf-result-panel {
    display: none;
    margin-top: 16px;
}

.barf-calculator--simple .barf-result-panel.is-visible {
    display: block;
    animation: barfFadeIn 0.25s ease;
}

.barf-calculator--simple .barf-result-box--simple {
    align-items: flex-start;
}

.barf-calculator--simple .barf-result-label {
    font-size: 1.05rem;
    line-height: 1.45;
    color: var(--barf-text);
}

.barf-calculator--simple .barf-ration {
    display: inline;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--barf-green);
    white-space: nowrap;
}

.barf-calculator--simple .barf-result-kcal-line {
    margin: 8px 0 0;
    font-size: 0.9rem;
    color: var(--barf-muted);
}

.barf-calculator--simple .barf-result-kcal-line strong {
    color: var(--barf-text);
}

.barf-calculator--simple .barf-actions--result {
    margin-top: 14px;
    flex-wrap: wrap;
}

.barf-calculator--simple .barf-actions--result .barf-btn {
    flex: 1 1 200px;
}

@media (max-width: 560px) {
    .barf-calculator--simple .barf-actions--result {
        flex-direction: column;
    }

    .barf-calculator--simple .barf-actions--result .barf-btn {
        width: 100%;
        flex: none;
    }
}

/* ---------- Variante simple : maquette « Calculateur BARF menu » ---------- */

.barf-calculator [hidden] {
    display: none !important;
}

.barf-calculator--simple {
    --barf-forest: #1f4a3a;
    --barf-forest-dark: #17382c;
    --barf-soft: #eef2ea;
    max-width: 700px;
    margin: 0;
}

.barf-calculator--simple .barf-card {
    padding: 30px 32px 26px;
    border-radius: 18px;
}

.barf-calculator--simple .barf-header {
    align-items: center;
    gap: 18px;
    margin-bottom: 26px;
}

.barf-calculator--simple .barf-icon {
    width: 68px;
    height: 68px;
    background: var(--barf-soft);
    color: var(--barf-green);
}

.barf-calculator--simple .barf-header h2 {
    margin: 0 0 4px;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: var(--barf-forest);
}

.barf-calculator--simple .barf-header p {
    font-size: 1rem;
    color: var(--barf-muted);
}

.barf-calculator--simple .barf-grid {
    gap: 22px 34px;
}

.barf-calculator--simple .barf-field {
    margin-bottom: 22px;
}

.barf-calculator--simple .barf-label-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    margin-bottom: 8px;
}

.barf-calculator--simple .barf-label-row label,
.barf-calculator--simple .barf-label-row .barf-label {
    flex: 0 1 auto;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--barf-forest);
}

.barf-calculator--simple .barf-optional {
    font-weight: 400;
    color: var(--barf-muted);
}

.barf-calculator--simple .barf-num {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #cfdcc8;
    color: var(--barf-forest);
    font-size: 0.8rem;
    font-weight: 700;
}

.barf-calculator--simple input[type="text"],
.barf-calculator--simple input[type="search"],
.barf-calculator--simple input[type="number"],
.barf-calculator--simple select {
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid #dcdfd8;
    border-radius: 8px;
    background-color: #fff;
    font-size: 0.92rem;
}

.barf-calculator--simple .barf-search {
    position: relative;
}

.barf-calculator--simple .barf-search__icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--barf-muted);
    pointer-events: none;
}

.barf-calculator--simple .barf-search input[type="search"] {
    padding-left: 40px;
}

.barf-calculator--simple .barf-value-box {
    width: 68px;
    min-height: 40px;
    padding: 6px 8px;
    text-align: center;
    font-weight: 600;
}

.barf-calculator--simple .barf-range {
    display: flex;
    align-items: center;
    gap: 12px;
}

.barf-calculator--simple .barf-range input[type="range"] {
    flex: 1 1 auto;
    width: auto;
    min-height: 0;
    padding: 0;
    border: 0;
}

.barf-calculator--simple .barf-range__unit {
    flex: 0 0 auto;
    font-size: 0.8rem;
    color: var(--barf-muted);
    white-space: nowrap;
}

.barf-calculator--simple .barf-range__scale {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    padding-right: 52px;
    font-size: 0.72rem;
    color: var(--barf-muted);
}

.barf-calculator--simple .barf-radio-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.barf-calculator--simple .barf-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 11px 12px;
    border: 1px solid #dcdfd8;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 500;
    white-space: nowrap;
}

.barf-calculator--simple .barf-radio:has(input:checked) {
    border-color: var(--barf-green);
    background: #f6faf2;
}

.barf-calculator--simple .barf-radio input {
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    min-height: 0;
    border: 2px solid #b9c1b3;
    border-radius: 50%;
    background: #fff;
}

.barf-calculator--simple .barf-radio input:checked {
    border-color: var(--barf-green);
    background: var(--barf-green) radial-gradient(circle, #fff 0 32%, transparent 36%);
}

.barf-calculator--simple .barf-result-panel {
    margin-top: 6px;
}

.barf-calculator--simple .barf-result-box {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 20px 24px;
    border: 0;
    border-radius: 12px;
    background: var(--barf-soft);
}

.barf-calculator--simple .barf-result-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: #f6f8f3;
    color: var(--barf-green);
    font-size: 0;
}

.barf-calculator--simple .barf-result-label {
    margin: 0 0 2px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--barf-forest);
}

.barf-calculator--simple .barf-ration {
    display: block;
    font-size: 2.3rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--barf-forest);
}

.barf-calculator--simple .barf-result-meta {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: var(--barf-muted);
}

.barf-calculator--simple .barf-result-kcal-line {
    display: none;
}

.barf-calculator--simple .barf-actions--result {
    display: block;
    margin-top: 14px;
}

.barf-calculator--simple .barf-btn-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 20px;
    border-radius: 6px;
    background: var(--barf-forest);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
}

.barf-calculator--simple .barf-btn-cta:hover {
    background: var(--barf-forest-dark);
    color: #fff;
}

.barf-calculator--simple .barf-actions--result .barf-btn-primary {
    width: 100%;
    margin-top: 8px;
}

.barf-calculator--simple .barf-disclaimer {
    margin: 14px 0 0;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--barf-muted);
}

@media (max-width: 620px) {
    .barf-calculator--simple .barf-card {
        padding: 22px 18px;
    }

    .barf-calculator--simple .barf-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .barf-calculator--simple .barf-header h2 {
        font-size: 1.3rem;
    }

    .barf-calculator--simple .barf-radio {
        white-space: normal;
    }
}

/* Corrections de rendu (thèmes qui surchargent les champs) */
.barf-calculator--simple .barf-label-row {
    flex-wrap: nowrap;
}

.barf-calculator--simple .barf-label-row label,
.barf-calculator--simple .barf-label-row .barf-label {
    white-space: nowrap;
}

.barf-calculator--simple .barf-label-row .barf-value-box {
    margin-left: auto;
}

.barf-calculator--simple .barf-search input[type="search"] {
    padding-left: 40px !important;
}

.barf-calculator--simple input[type="text"],
.barf-calculator--simple input[type="search"],
.barf-calculator--simple input[type="number"],
.barf-calculator--simple select {
    background-color: #fff !important;
    color: var(--barf-text);
}

.barf-calculator--simple .barf-radio {
    padding: 10px;
    font-size: 0.8rem;
    white-space: normal;
}

.barf-calculator--simple .barf-label-row .barf-value-box {
    flex: 0 0 68px;
}

/* Valeurs affichées en texte, interligne réduit */
.barf-calculator--simple,
.barf-calculator--simple label,
.barf-calculator--simple .barf-label,
.barf-calculator--simple select,
.barf-calculator--simple input {
    line-height: 1.25;
}

.barf-calculator--simple .barf-value-text {
    font-weight: 500;
    color: var(--barf-muted);
}

.barf-calculator--simple .barf-range__scale {
    padding-right: 0;
}

.barf-calculator--simple .barf-radio {
    line-height: 1.2;
}

.barf-calculator--simple .barf-radio span {
    line-height: 1.2;
}

.barf-calculator--simple .barf-label-row {
    min-height: 0;
}

.barf-calculator--simple .barf-header h2,
.barf-calculator--simple .barf-header p {
    line-height: 1.25;
}

.barf-calculator--simple .barf-result-label,
.barf-calculator--simple .barf-ration,
.barf-calculator--simple .barf-result-meta,
.barf-calculator--simple .barf-disclaimer {
    line-height: 1.3;
}

.barf-calculator--simple .barf-label-row label,
.barf-calculator--simple .barf-label-row .barf-label {
    white-space: normal;
    min-width: 0;
}

.barf-calculator--simple .barf-grid > .barf-field {
    min-width: 0;
}

/* Facteur physiologique : cases cliquables sans pastille radio */
.barf-calculator--simple .barf-radio input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.barf-calculator--simple .barf-radio {
    position: relative;
    justify-content: center;
    text-align: center;
}

.barf-calculator--simple .barf-radio:has(input:checked) {
    border-color: var(--barf-green);
    background: var(--barf-green);
    color: #fff;
}

.barf-calculator--simple .barf-radio:has(input:focus-visible) {
    outline: 2px solid var(--barf-green);
    outline-offset: 2px;
}

/* Case sélectionnée : fond vert clair, texte foncé lisible */
.barf-calculator--simple .barf-radio:has(input:checked) {
    border-color: var(--barf-green) !important;
    background: #e4eedb !important;
    color: var(--barf-forest) !important;
    font-weight: 700;
}

.barf-calculator--simple .barf-radio:has(input:checked) span {
    color: var(--barf-forest) !important;
}

/* Facteur physiologique sur une ligne */
.barf-calculator--simple .barf-field--full .barf-radio-group {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 620px) {
    .barf-calculator--simple .barf-field--full .barf-radio-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Encart résultat : informations manquantes */
.barf-calculator--simple .barf-result-text {
    min-width: 0;
}

.barf-calculator--simple .barf-missing {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--barf-muted);
}

.barf-calculator--simple .barf-missing li {
    position: relative;
    margin: 0 0 2px;
    padding-left: 16px;
}

.barf-calculator--simple .barf-missing li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--barf-green);
}
