/* ==========================================================================
   ENOV Configurateur – Frontend Styles
   Responsive, mobile-first, no external dependencies.
   ========================================================================== */

/* ── Custom Properties ───────────────────────────────────────────────────── */
.enov-configurator {
    --enov-primary:      #1e5f8e;
    --enov-primary-dark: #164d73;
    --enov-accent:       #2ecc71;
    --enov-accent-dark:  #27ae60;
    --enov-text:         #1a1a2e;
    --enov-muted:        #6b7280;
    --enov-border:       #e5e7eb;
    --enov-bg:           #f8fafc;
    --enov-card-bg:      #ffffff;
    --enov-radius:       10px;
    --enov-shadow:       0 2px 12px rgba(0,0,0,.08);
    --enov-transition:   .2s ease;

    font-family: inherit;
    color: var(--enov-text);
    position: relative;
}

/* ── Loading Spinner ─────────────────────────────────────────────────────── */
.enov-conf-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 32px 16px;
    color: var(--enov-muted);
    font-size: 15px;
}

.enov-spinner {
    display: inline-block;
    width: 24px; height: 24px;
    border: 3px solid var(--enov-border);
    border-top-color: var(--enov-primary);
    border-radius: 50%;
    animation: enov-spin .7s linear infinite;
    flex-shrink: 0;
}

@keyframes enov-spin { to { transform: rotate(360deg); } }

/* ── Layout Wrapper ──────────────────────────────────────────────────────── */
.enov-conf-inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@media (min-width: 900px) {
    .enov-conf-inner {
        flex-direction: row;
        align-items: flex-start;
    }
}

/* ── Main Column ─────────────────────────────────────────────────────────── */
.enov-conf-main {
    flex: 1 1 auto;
    min-width: 0;
}

/* ── Aside / Sidebar ─────────────────────────────────────────────────────── */
.enov-conf-aside {
    flex: 0 0 280px;
    background: var(--enov-card-bg);
    border: 1px solid var(--enov-border);
    border-radius: var(--enov-radius);
    box-shadow: var(--enov-shadow);
    overflow: hidden;
}

@media (min-width: 900px) {
    .enov-conf-aside { position: sticky; top: 24px; }
}

.enov-aside-header {
    background: var(--enov-primary);
    color: #fff;
    padding: 14px 18px;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.enov-aside-toggle {
    background: none; border: none; color: #fff;
    cursor: pointer; font-size: 18px; line-height: 1;
    padding: 2px 4px;
}

.enov-aside-body { padding: 16px 18px; }

/* Mobile: aside is collapsible */
@media (max-width: 899px) {
    .enov-conf-aside { order: -1; } /* show above wizard */
    .enov-aside-body { display: none; }
    .enov-aside-body.open { display: block; }
}

@media (min-width: 900px) {
    .enov-aside-body { display: block !important; }
    .enov-aside-toggle { display: none; }
}

/* Aside sections */
.enov-aside-section { margin-bottom: 16px; }
.enov-aside-section:last-child { margin-bottom: 0; }
.enov-aside-section h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--enov-muted);
    margin: 0 0 8px;
}

/* Recap list */
.enov-recap-list {
    list-style: none;
    margin: 0; padding: 0;
}

.enov-recap-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 0;
    border-bottom: 1px solid var(--enov-border);
    font-size: 13px;
}

.enov-recap-item:last-child { border: none; }

.enov-recap-step-name {
    color: var(--enov-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.enov-recap-opt-name { font-weight: 600; }

.enov-recap-price {
    font-size: 12px;
    color: var(--enov-accent-dark);
    font-weight: 600;
}

/* Total price */
.enov-total-price {
    background: var(--enov-primary);
    color: #fff;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 12px;
}

.enov-total-price .label { font-size: 12px; opacity: .85; }
.enov-total-price .amount { font-size: 20px; font-weight: 800; }

/* Step progress list in aside */
.enov-aside-steps { list-style: none; margin: 0; padding: 0; }
.enov-aside-step-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    color: var(--enov-muted);
}

.enov-aside-step-item.is-done   { color: var(--enov-accent-dark); }
.enov-aside-step-item.is-active { color: var(--enov-primary); font-weight: 700; }

.enov-step-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--enov-border);
    flex-shrink: 0;
}

.is-done  .enov-step-dot { background: var(--enov-accent); }
.is-active .enov-step-dot { background: var(--enov-primary); }

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.enov-progress-bar-wrap {
    margin-bottom: 28px;
}

.enov-progress-steps {
    display: flex;
    gap: 0;
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.enov-progress-step {
    flex: 1 1 0;
    min-width: 60px;
    text-align: center;
    position: relative;
    cursor: default;
}

/* Connector line between steps */
.enov-progress-step:not(:first-child)::before {
    content: '';
    position: absolute;
    top: 13px; left: -50%;
    width: 100%; height: 2px;
    background: var(--enov-border);
    z-index: 0;
}

.enov-progress-step.done:not(:first-child)::before,
.enov-progress-step.active:not(:first-child)::before {
    background: var(--enov-primary);
}

.enov-progress-circle {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--enov-border);
    color: var(--enov-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    margin: 0 auto 6px;
    position: relative; z-index: 1;
    transition: background var(--enov-transition), color var(--enov-transition);
}

.enov-progress-step.done  .enov-progress-circle { background: var(--enov-primary); color: #fff; }
.enov-progress-step.done  .enov-progress-circle::after { content: '✓'; }
.enov-progress-step.active .enov-progress-circle { background: var(--enov-primary); color: #fff; box-shadow: 0 0 0 4px rgba(30,95,142,.15); }

.enov-progress-label {
    font-size: 11px;
    color: var(--enov-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
    margin: 0 auto;
}

.enov-progress-step.active .enov-progress-label { color: var(--enov-primary); font-weight: 700; }
.enov-progress-step.done   .enov-progress-label { color: var(--enov-primary); }

/* Thin progress bar below steps */
.enov-progress-track {
    height: 4px;
    background: var(--enov-border);
    border-radius: 2px;
    overflow: hidden;
}

.enov-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--enov-primary), var(--enov-accent));
    border-radius: 2px;
    transition: width .4s cubic-bezier(.4,0,.2,1);
}

/* ── Step Panel ──────────────────────────────────────────────────────────── */
.enov-step-panel { animation: enov-fadein .25s ease; }
@keyframes enov-fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.enov-step-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 6px;
    color: var(--enov-text);
}

.enov-step-desc {
    color: var(--enov-muted);
    font-size: 14px;
    margin: 0 0 24px;
    line-height: 1.6;
}

.enov-step-desc p  { margin: 0 0 8px; }
.enov-step-desc ul { padding-left: 18px; }

/* ── Option Cards ────────────────────────────────────────────────────────── */
.enov-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.enov-option-card {
    border: 2px solid var(--enov-border);
    border-radius: var(--enov-radius);
    background: var(--enov-card-bg);
    cursor: pointer;
    transition: border-color var(--enov-transition), box-shadow var(--enov-transition), transform var(--enov-transition);
    overflow: hidden;
    position: relative;
    outline: none;
    user-select: none;
}

.enov-option-card:hover,
.enov-option-card:focus-visible {
    border-color: var(--enov-primary);
    box-shadow: 0 4px 16px rgba(30,95,142,.12);
    transform: translateY(-2px);
}

.enov-option-card.selected {
    border-color: var(--enov-primary);
    box-shadow: 0 0 0 3px rgba(30,95,142,.15), 0 4px 16px rgba(30,95,142,.1);
}

/* Checkmark badge */
.enov-option-card::after {
    content: '✓';
    position: absolute;
    top: 10px; right: 10px;
    width: 22px; height: 22px;
    background: var(--enov-primary);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 900;
    opacity: 0;
    transform: scale(.5);
    transition: opacity var(--enov-transition), transform var(--enov-transition);
}

.enov-option-card.selected::after { opacity: 1; transform: scale(1); }

/* Card image */
.enov-option-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    background: var(--enov-bg);
}

.enov-option-img-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #e8f0f8, #d1e3f0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}

/* Card body */
.enov-option-body {
    padding: 14px 16px;
}

.enov-option-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--enov-text);
    padding-right: 28px; /* space for checkmark badge */
}

.enov-option-desc {
    font-size: 13px;
    color: var(--enov-muted);
    margin: 0 0 10px;
    line-height: 1.5;
}

.enov-option-desc p  { margin: 0 0 4px; }
.enov-option-desc ul { padding-left: 16px; margin: 0; }
.enov-option-desc li { margin-bottom: 2px; }

.enov-option-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--enov-primary);
}

.enov-option-price.free { color: var(--enov-accent-dark); }

/* Hidden native input */
.enov-option-card input[type="radio"],
.enov-option-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* ── Navigation Buttons ──────────────────────────────────────────────────── */
.enov-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.enov-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 28px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--enov-transition), transform var(--enov-transition), opacity var(--enov-transition);
    border: none;
    outline: none;
    text-decoration: none;
}

.enov-btn:focus-visible { box-shadow: 0 0 0 3px rgba(30,95,142,.3); }

.enov-btn-primary {
    background: var(--enov-primary);
    color: #fff;
}

.enov-btn-primary:hover:not(:disabled) { background: var(--enov-primary-dark); transform: translateY(-1px); }
.enov-btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.enov-btn-secondary {
    background: transparent;
    color: var(--enov-primary);
    border: 2px solid var(--enov-primary);
}

.enov-btn-secondary:hover { background: rgba(30,95,142,.06); }

.enov-btn-accent {
    background: var(--enov-accent);
    color: #fff;
}

.enov-btn-accent:hover { background: var(--enov-accent-dark); }

/* ── Summary / Devis Page ───────────────────────────────────────────────── */
.enov-summary { animation: enov-fadein .3s ease; }

.enov-summary-header {
    text-align: center;
    margin-bottom: 32px;
}

.enov-summary-title {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--enov-primary);
}

.enov-summary-subtitle {
    color: var(--enov-muted);
    font-size: 15px;
}

/* Summary table */
.enov-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    background: var(--enov-card-bg);
    border-radius: var(--enov-radius);
    overflow: hidden;
    box-shadow: var(--enov-shadow);
}

.enov-summary-table th {
    background: var(--enov-primary);
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.enov-summary-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--enov-border);
    font-size: 14px;
    vertical-align: middle;
}

.enov-summary-table tr:last-child td { border: none; }
.enov-summary-table tr:nth-child(even) td { background: var(--enov-bg); }

.enov-summary-table .step-col { color: var(--enov-muted); font-size: 12px; }
.enov-summary-table .price-col { text-align: right; font-weight: 700; white-space: nowrap; }
.enov-summary-table .total-row td { background: var(--enov-primary) !important; color: #fff; font-size: 16px; font-weight: 800; }
.enov-summary-table .opt-img { max-width: 60px; max-height: 44px; border-radius: 4px; margin-right: 10px; vertical-align: middle; }

/* Summary actions */
.enov-summary-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 24px;
}

/* ── Error state ─────────────────────────────────────────────────────────── */
.enov-conf-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 14px 18px;
    color: #991b1b;
    font-size: 14px;
}

/* ── Responsive tweaks ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .enov-options-grid { grid-template-columns: 1fr; }
    .enov-step-title   { font-size: 18px; }
    .enov-btn          { padding: 10px 20px; font-size: 14px; }
    .enov-summary-table th,
    .enov-summary-table td { padding: 8px 10px; font-size: 13px; }
}

@media (max-width: 440px) {
    .enov-progress-label { display: none; }
}

/* ── Print styles ────────────────────────────────────────────────────────── */
@media print {
    .enov-nav, .enov-conf-aside, .enov-summary-actions .no-print { display: none; }
}
