/**
 * Configurator — Canon Design System
 * Matches MS_CODE_CANON.html styling.
 * Requires tokens.css loaded first (canonical token system).
 */

/* Layout */
.config-layout {
    max-width: 1200px; margin: 0 auto; padding: 88px 2rem 2rem;
    display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start;
}

/* Product Hero */
.product-card {
    background: var(--color-surface-1); border: 1px solid var(--color-border-light);
    border-top: 3px solid var(--mfr-accent); border-radius: var(--radius-sm); margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.03); overflow: hidden;
}
.product-card__header { padding: 20px 24px 16px; border-bottom: 1px solid var(--color-border-light); }
.product-card__mfr {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--mfr-accent); margin-bottom: 6px;
}
.product-card__name {
    font-family: var(--font-display); font-size: 20px; font-weight: 700;
    color: var(--e57-blue-dark); line-height: 1.25; margin-bottom: 4px;
}
.product-card__desc { font-size: 13px; color: var(--color-text-muted); line-height: 1.55; }
.product-card__body { padding: 16px 24px; background: var(--color-surface-2); }
.product-card__specs { display: flex; gap: 20px; flex-wrap: wrap; }
.product-card__spec { display: flex; flex-direction: column; gap: 2px; }
.product-card__spec-label {
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--color-text-dim);
}
.product-card__spec-value { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--color-text); }

/* Option Sections (accordion) */
.option-section {
    background: var(--color-surface-1); border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm); margin-bottom: 4px; overflow: hidden;
    transition: border-color 0.25s, box-shadow 0.25s;
}
.option-section.is-open { border-color: var(--color-border); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.option-section.has-selection { border-left: 3px solid var(--mfr-accent); }

.option-header {
    padding: 10px 16px; cursor: pointer; user-select: none;
    display: flex; align-items: center; justify-content: space-between;
    transition: background 0.12s;
}
.option-header:hover { background: var(--color-surface-2); }
.option-header__left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.option-header__pos {
    font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--color-text-muted);
    width: 22px; height: 22px; background: var(--color-surface-2); border: 1px solid var(--color-border-light);
    border-radius: 3px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: all 0.3s;
}
.option-section.has-selection .option-header__pos {
    background: var(--mfr-accent); color: #fff; border-color: var(--mfr-accent);
}
.option-header__name {
    font-size: 13px; font-weight: 700; color: var(--color-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.option-header__tag {
    font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--mfr-accent); flex-shrink: 0;
}
.option-header__tag.is-done { color: var(--color-text-dim); }
.option-header__right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.option-header__sel {
    font-family: var(--font-mono); font-size: 11px; color: var(--e57-blue); font-weight: 600;
    background: rgba(23,75,127,0.06); padding: 3px 8px; border-radius: 3px;
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.option-header__arrow { font-size: 10px; color: var(--color-text-dim); transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); }
.option-section.is-open .option-header__arrow { transform: rotate(180deg); }

.option-body { display: none; padding: 8px 12px 12px; background: var(--color-surface-2); }
.option-section.is-open .option-body { display: block; }
.option-section.is-open .option-header { border-bottom: 1px solid var(--color-border-light); }

/* Section labels */
.options-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--color-text-dim); padding: 12px 0 6px; margin-top: 8px;
    border-top: 1px solid var(--color-border-light);
}
.options-label:first-child { margin-top: 0; border-top: none; }
.options-label span { font-weight: 600; margin-left: 6px; }

/* Choice Rows */
.choice {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    border: 1px solid var(--color-border-light); border-radius: var(--radius-sm); margin-bottom: 3px;
    cursor: pointer; position: relative; overflow: hidden; background: var(--color-surface-1);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.2s, transform 0.1s;
}
.choice:hover { border-color: var(--color-border); box-shadow: 0 1px 4px rgba(0,0,0,0.06); transform: translateX(2px); }
.choice.is-selected {
    border-color: var(--mfr-accent); background: rgba(var(--mfr-accent-rgb),0.04);
    border-left: 3px solid var(--mfr-accent); box-shadow: 0 1px 6px rgba(var(--mfr-accent-rgb),0.1);
}
.choice.is-disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.choice.is-disabled .choice__label::after { content: " — Not available"; font-size: 10px; color: var(--e57-red); font-weight: 600; }

/* Ripple */
.choice__ripple {
    position: absolute; border-radius: 50%;
    background: rgba(var(--mfr-accent-rgb), 0.12);
    transform: scale(0); pointer-events: none;
}
.choice__ripple.animate { animation: choiceRipple 0.5s ease-out forwards; }
@keyframes choiceRipple { to { transform: scale(1); opacity: 0; } }

.choice__radio {
    width: 16px; height: 16px; border: 2px solid var(--color-border);
    border-radius: 50%; flex-shrink: 0; position: relative; display: flex;
    align-items: center; justify-content: center; transition: border-color 0.2s;
}
.choice__radio::after {
    content: ""; width: 0; height: 0; background: var(--mfr-accent);
    border-radius: 50%; position: absolute;
    transition: width 0.3s cubic-bezier(0.34,1.56,0.64,1), height 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.choice.is-selected .choice__radio { border-color: var(--mfr-accent); }
.choice.is-selected .choice__radio::after { width: 8px; height: 8px; }

.choice__code {
    font-family: var(--font-mono); font-size: 12px; font-weight: 700;
    color: var(--e57-blue); min-width: 28px; text-align: center;
}
.choice.is-selected .choice__code { color: var(--mfr-accent); }
.choice__label { font-size: 13px; color: var(--color-text-secondary); flex: 1; line-height: 1.35; }
.choice.is-selected .choice__label { color: var(--color-text); font-weight: 500; }
.choice__badges { display: flex; gap: 8px; align-items: center; flex-shrink: 0; white-space: nowrap; }
.choice__price { font-family: var(--font-mono); font-size: 12px; font-weight: 600; min-width: 52px; text-align: right; }
.choice__price--add { color: var(--e57-blue); }
.choice__price--zero { color: var(--color-text-dim); }
.choice__lead { font-family: var(--font-mono); font-size: 10px; color: var(--color-text-dim); }
.choice__call {
    font-size: 9px; font-weight: 600; color: var(--color-text-dim);
    background: var(--color-surface-2); padding: 2px 6px; border-radius: 3px;
    text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid var(--color-border-light);
}

/* Sidebar */
.config-sidebar { margin-top: 32px; }
.summary {
    background: var(--color-surface-1); border: 1px solid var(--color-border-light);
    border-top: 3px solid var(--mfr-accent); border-radius: var(--radius-sm);
    position: sticky; top: 88px; overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.03);
}
.summary__header { padding: 20px; border-bottom: 1px solid var(--color-border-light); }
.summary__product { font-size: 13px; font-weight: 700; color: var(--e57-blue-dark); margin-bottom: 6px; }
.summary__code-label { font-size: 10px; color: var(--color-text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.summary__code {
    font-family: var(--font-mono); font-size: 14px; font-weight: 700;
    color: var(--e57-blue-dark); background: var(--color-surface-2); padding: 10px 14px;
    border-radius: var(--radius-sm); border: 1px solid var(--color-border-light);
    display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
    cursor: pointer; transition: border-color 0.2s;
}
.summary__code:hover { border-color: var(--e57-blue); }
.summary__code-text { word-break: break-all; line-height: 1.4; flex: 1; }
.summary__code-copy {
    font-size: 9px; color: var(--color-text-dim); font-family: var(--font-body);
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0; padding-top: 3px;
}

.summary__image { padding: 8px 20px; border-top: 1px solid var(--color-border-light); text-align: center; }
.summary__image img { max-height: 177px; margin: 0 auto; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.08)); }

.summary__body { padding: 16px 20px; }

/* Specs */
.qspec { display: flex; justify-content: space-between; padding: 2px 0; font-size: 11px; border-bottom: 1px solid var(--color-surface-2); }
.qspec__label { color: var(--color-text-muted); }
.qspec__val { font-weight: 600; color: var(--color-text); font-size: 12px; text-align: right; max-width: 55%; }
.qspec__val--pending { color: var(--color-text-dim); font-style: italic; font-weight: 400; }

/* Quantity */
.summary__qty { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--color-border-light); margin-top: 4px; }
.summary__qty-label { font-size: 11px; color: var(--color-text-muted); }
.summary__qty-ctrl { display: flex; border: 1px solid var(--color-border-light); border-radius: var(--radius-sm); overflow: hidden; }
.summary__qty-btn {
    width: 24px; height: 24px; border: none; background: var(--color-surface-2);
    cursor: pointer; font-size: 13px; font-weight: 700; color: var(--color-text-secondary);
    display: flex; align-items: center; justify-content: center;
}
.summary__qty-val {
    width: 34px; height: 24px; text-align: center; border: none;
    font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--color-text);
    background: var(--color-surface-1); border-left: 1px solid var(--color-border-light); border-right: 1px solid var(--color-border-light);
}

/* Pricing */
.summary__pricing { border-top: 1px solid var(--color-border-light); padding-top: 14px; }
.summary__price-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 12px; }
.summary__price-row--total { font-size: 20px; font-weight: 800; border-top: 2px solid var(--color-text); padding-top: 10px; margin-top: 6px; }
.summary__price-row--total .summary__price-val { color: var(--e57-blue-dark); }
.summary__price-val { font-family: var(--font-mono); font-weight: 600; color: var(--color-text); }
.summary__lead-row { font-size: 11px; color: var(--color-text-muted); text-align: right; margin-top: 1px; }
.summary__call-factory { background: transparent; padding: 4px 0; margin-top: 4px; font-size: 9px; color: var(--color-text-dim); text-align: center; font-style: italic; display: none; }
.summary__call-factory.is-visible { display: block; }

/* Action Grid */
.summary__actions { padding: 14px 20px; border-top: 1px solid var(--color-border-light); }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.action-btn {
    font-family: var(--font-body); font-size: 9px; font-weight: 700; padding: 6px 4px;
    border-radius: var(--radius-sm); cursor: pointer; text-transform: uppercase; letter-spacing: 0.03em;
    text-align: center; line-height: 1.1; transition: all 0.15s; white-space: nowrap;
}
.action-btn--quote { background: var(--mfr-accent); color: #fff; border: none; }
.action-btn--quote:hover { background: var(--e57-green-dark); }
.action-btn--quote:disabled { background: var(--color-surface-3); cursor: not-allowed; color: var(--color-text-dim); }
.action-btn--factory { background: var(--color-surface-2); color: var(--color-text-muted); border: 1px solid var(--color-border-light); }
.action-btn--factory.is-urgent { background: #dc2626; color: #fff; border-color: #dc2626; animation: factoryPulse 2s ease-in-out infinite; font-size: 11px; }
@keyframes factoryPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.3); } 50% { box-shadow: 0 0 0 4px rgba(220,38,38,0); } }
.action-btn--checkout { background: var(--e57-blue-dark); color: #fff; border: none; }
.action-btn--checkout:disabled { background: var(--color-surface-3); cursor: not-allowed; color: var(--color-text-dim); }
.action-btn--cart { background: transparent; color: var(--e57-blue-dark); border: 1px solid var(--color-border); }

.summary__note { font-size: 9px; color: var(--color-text-dim); text-align: center; margin-top: 8px; }
.summary__help { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--color-border-light); font-size: 11px; color: var(--color-text-muted); }
.summary__help a { color: var(--e57-blue); }

/* Constraint feedback */
.constraint-msg { display: none; align-items: flex-start; gap: 8px; padding: 10px 14px; margin-top: 10px;
    border-radius: var(--radius-sm); font-size: 12px; line-height: 1.45; }
.constraint-msg.is-visible { display: flex; }
.constraint-msg--error { background: rgba(223,39,39,0.06); border: 1px solid rgba(223,39,39,0.15); color: var(--e57-red); }
.constraint-msg--warning { background: rgba(241,181,18,0.06); border: 1px solid rgba(241,181,18,0.15); color: var(--e57-amber-dark); }
.constraint-msg--info { background: rgba(23,75,127,0.06); border: 1px solid rgba(23,75,127,0.15); color: var(--e57-blue); }
.violation { background: rgba(223,39,39,0.06); border: 1px solid rgba(223,39,39,0.15); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 6px; font-size: 12px; color: var(--e57-red); }
.constraint-warning { background: rgba(241,181,18,0.06); border: 1px solid rgba(241,181,18,0.15); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 6px; font-size: 12px; color: var(--e57-amber); }

/* Responsive */
@media (max-width: 1024px) { .config-layout { grid-template-columns: 1fr; } .summary { position: static; } .config-sidebar { margin-top: 0; } }
@media (max-width: 768px) { .config-layout { padding: 80px 1rem 1rem; } }
