/**
 * OBD-Finder Drill-Down-Wizard Styles.
 * Scope: nur .sof-drilldown & Kindelemente — kein Bleed in obd-style.css.
 */

.sof-drilldown {
    --sof-dd-bg:       #ffffff;
    --sof-dd-border:   #ebebeb;
    --sof-dd-border-h: #c9c9c9;
    --sof-dd-text:     #222222;
    --sof-dd-muted:    #888888;
    --sof-dd-accent:   #e30613;
    --sof-dd-accent-h: #b5040f;
    --sof-dd-bg-soft:  #f6f6f6;
    --sof-dd-radius:   8px;

    box-sizing: border-box;
    /* Schrift vom Theme erben — passt sich automatisch ans CI an */
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    color: var(--sof-dd-text);
    background: var(--sof-dd-bg);
    border: 1px solid var(--sof-dd-border);
    border-radius: var(--sof-dd-radius);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    padding: 24px;
    margin: 1.5em 0;
    min-height: 320px;
}
.sof-drilldown *,
.sof-drilldown *::before,
.sof-drilldown *::after { box-sizing: inherit; }

.sof-dd-helper {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    margin: 0 0 16px;
    border: 1px solid var(--sof-dd-border);
    border-radius: 10px;
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
}
.sof-dd-helper-copy {
    flex: 1 1 360px;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
}
.sof-dd-helper-copy strong {
    color: #222;
}
.sof-dd-helper-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.sof-dd-helper-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--sof-dd-border);
    background: #fff;
    color: var(--sof-dd-accent);
    font-weight: 600;
    text-decoration: none;
}
.sof-dd-helper-actions a:hover,
.sof-dd-helper-actions a:focus-visible {
    border-color: var(--sof-dd-accent);
    color: var(--sof-dd-accent-h);
}

/* ---------- Header / Breadcrumbs ---------- */
.sof-dd-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--sof-dd-border);
    margin-bottom: 16px;
}
.sof-dd-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1 1 auto;
}
.sof-dd-crumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--sof-dd-border);
    background: var(--sof-dd-bg-soft);
    color: var(--sof-dd-muted);
    border-radius: 999px;
    font-size: 0.85em;
    cursor: not-allowed;
    transition: background .15s, color .15s, border-color .15s;
}
.sof-dd-crumb.is-on    { color: var(--sof-dd-text); cursor: pointer; }
.sof-dd-crumb.is-on:hover { border-color: var(--sof-dd-border-h); background: rgba(227,6,19,0.06); }
.sof-dd-crumb.is-current {
    background: var(--sof-dd-accent);
    border-color: var(--sof-dd-accent);
    color: #fff;
}
.sof-dd-crumb-num {
    display: inline-block;
    min-width: 18px; height: 18px; line-height: 18px;
    text-align: center;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 50%;
    background: rgba(0,0,0,.08);
}
.sof-dd-crumb.is-current .sof-dd-crumb-num { background: rgba(255,255,255,.2); }
.sof-dd-crumb-label { font-weight: 500; }
.sof-dd-crumb-val {
    font-weight: 400;
    opacity: .85;
}

.sof-dd-summary {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
    margin: 0 0 16px;
    border: 1px solid var(--sof-dd-border);
    border-radius: 10px;
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
}
.sof-dd-summary-copy {
    display: grid;
    gap: 4px;
    color: #555;
    font-size: 13px;
    line-height: 1.55;
}
.sof-dd-summary-copy strong {
    color: #222;
    font-size: 14px;
}
.sof-dd-summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.sof-dd-summary-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(227, 6, 19, 0.08);
    color: #8f0d15;
    font-size: 12px;
    font-weight: 600;
}
.sof-dd-summary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.sof-dd-summary-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--sof-dd-border);
    background: #fff;
    color: var(--sof-dd-accent);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}
.sof-dd-summary-actions a:hover,
.sof-dd-summary-actions a:focus-visible {
    border-color: var(--sof-dd-accent);
    color: var(--sof-dd-accent-h);
}

.sof-dd-actions {
    display: flex; gap: 8px;
}
.sof-dd-back,
.sof-dd-reset {
    padding: 6px 12px;
    border: 1px solid var(--sof-dd-border);
    background: var(--sof-dd-bg);
    color: var(--sof-dd-text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
}
.sof-dd-back:hover,
.sof-dd-reset:hover {
    border-color: var(--sof-dd-border-h);
    background: var(--sof-dd-bg-soft);
}

/* ---------- Stage / Animation ---------- */
.sof-dd-stage {
    position: relative;
    min-height: 200px;
}
.sof-dd-h {
    margin: 0 0 20px 0;
    font-size: 1.4em;
    font-weight: 700;
    color: var(--sof-dd-text);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--sof-dd-accent);
    display: inline-block;
}
.sof-dd-sub {
    margin: -6px 0 18px;
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    max-width: 780px;
}
.sof-dd-loading,
.sof-dd-empty {
    color: var(--sof-dd-muted);
    font-style: italic;
    padding: 24px 0;
}

@keyframes sof-dd-slide-in {
    from { transform: translateX(24px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
.sof-dd-slide-in {
    animation: sof-dd-slide-in 0.28s ease-out;
}

/* ---------- Grids ---------- */
.sof-dd-grid {
    display: grid;
    gap: 12px;
}
.sof-dd-grid-cat   { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.sof-dd-grid-brand { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.sof-dd-grid-model { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.sof-dd-grid-year  { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ---------- Cards ---------- */
.sof-dd-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px;
    background: var(--sof-dd-bg);
    border: 1px solid var(--sof-dd-border);
    border-radius: var(--sof-dd-radius);
    cursor: pointer;
    text-align: left;
    transition: transform .12s, border-color .15s, box-shadow .15s;
    font-family: inherit;
    font-size: 1em;
    color: inherit;
}
.sof-dd-card:hover,
.sof-dd-card:focus-visible {
    border-color: var(--sof-dd-accent);
    box-shadow: 0 6px 18px rgba(227, 6, 19, 0.12);
    transform: translateY(-2px);
    outline: none;
    background: rgba(227,6,19,0.02);
}
.sof-dd-card-title {
    font-weight: 600;
    font-size: 1.02em;
    color: var(--sof-dd-text);
}
.sof-dd-card-meta {
    font-size: 0.85em;
    color: var(--sof-dd-muted);
}

/* Category cards: bigger, icon */
.sof-dd-card-cat {
    align-items: center;
    text-align: center;
    padding: 22px 14px;
    min-height: 140px;
}
.sof-dd-card-icon {
    display: inline-flex;
    width: 56px; height: 56px;
    color: var(--sof-dd-accent);
    margin-bottom: 8px;
}
.sof-dd-card-icon svg {
    width: 100%; height: 100%;
}

/* ---------- Quick-Jump A-Z ---------- */
.sof-dd-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
    padding: 8px;
    background: var(--sof-dd-bg-soft);
    border-radius: 8px;
}
.sof-dd-jump-btn {
    display: inline-block;
    min-width: 28px;
    padding: 4px 8px;
    text-align: center;
    text-decoration: none;
    color: var(--sof-dd-accent);
    border: 1px solid transparent;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9em;
}
.sof-dd-jump-btn:hover,
.sof-dd-jump-btn:focus {
    background: var(--sof-dd-bg);
    border-color: var(--sof-dd-border);
    color: var(--sof-dd-accent-h);
}

.sof-dd-letters {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.sof-dd-letter-h {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    color: var(--sof-dd-muted);
    border-bottom: 1px solid var(--sof-dd-border);
    padding-bottom: 4px;
}

/* ---------- Detail ---------- */
.sof-dd-detail {
    padding: 16px;
    border: 1px solid var(--sof-dd-border);
    border-radius: var(--sof-dd-radius);
    background: var(--sof-dd-bg-soft);
}
.sof-dd-detail p { margin: 0 0 8px 0; }
.sof-dd-detail-meta {
    color: #333;
    font-size: 14px;
}
.sof-dd-note {
    color: #666;
    font-size: 13px;
}
.sof-dd-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}
.sof-dd-detail-cta { margin-top: 16px; }
.sof-dd-deeplink {
    display: inline-block;
    padding: 8px 14px;
    background: var(--sof-dd-accent);
    color: #fff !important;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
}
.sof-dd-deeplink:hover { background: var(--sof-dd-accent-h); }
.sof-dd-secondary {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid var(--sof-dd-border);
    border-radius: 6px;
    background: #fff;
    color: #222;
    text-decoration: none;
    font-weight: 600;
}
.sof-dd-secondary:hover,
.sof-dd-secondary:focus-visible {
    border-color: var(--sof-dd-accent);
    color: var(--sof-dd-accent);
}

/* ---------- Mobile fullscreen ---------- */
@media (max-width: 720px) {
    .sof-drilldown.sof-dd-fullscreen {
        position: fixed;
        inset: 0;
        z-index: 9999;
        margin: 0;
        border-radius: 0;
        overflow-y: auto;
        padding: 12px;
    }
    .sof-dd-helper {
        padding: 14px;
    }
    .sof-dd-summary-actions {
        flex-direction: column;
    }
    .sof-dd-summary-actions a {
        width: 100%;
        justify-content: center;
    }
    .sof-dd-grid-cat   { grid-template-columns: repeat(2, 1fr); }
    .sof-dd-grid-brand { grid-template-columns: 1fr 1fr; }
    .sof-dd-grid-model { grid-template-columns: 1fr; }
    .sof-dd-grid-year  { grid-template-columns: 1fr 1fr; }
    .sof-dd-card-cat   { min-height: 120px; padding: 16px 8px; }
    .sof-dd-card-icon  { width: 44px; height: 44px; }
    .sof-dd-crumb-val  { display: none; }   /* spart Platz */
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .sof-dd-slide-in { animation: none; }
    .sof-dd-card { transition: none; }
    .sof-dd-card:hover { transform: none; }
}

/* Auto-Dark-Mode entfernt — Drilldown bleibt immer im CI-Stil von alarmanlage.de
   (hell, rot, klar) auch wenn der User-Browser System-Dark-Mode aktiviert hat. */

/* === CI-Override: alarmanlage.de Look === */
.sof-drilldown .sof-dd-card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.sof-drilldown .sof-dd-card-cat {
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
    border-width: 2px;
}
.sof-drilldown .sof-dd-card-cat:hover {
    background: linear-gradient(135deg, #fff5f6 0%, #fff 100%);
    border-color: #e30613;
}
.sof-drilldown .sof-dd-card-cat .sof-dd-card-icon {
    color: #e30613;
}
/* Crumbs etwas freundlicher */
.sof-drilldown .sof-dd-crumb {
    font-size: 0.9em;
    padding: 7px 14px;
}
.sof-drilldown .sof-dd-crumb.is-current {
    background: #e30613;
    border-color: #e30613;
    box-shadow: 0 2px 6px rgba(227,6,19,0.2);
}
/* Reset / Back-Buttons */
.sof-drilldown .sof-dd-back,
.sof-drilldown .sof-dd-reset {
    font-weight: 500;
    padding: 7px 14px;
    transition: all .15s;
}
.sof-drilldown .sof-dd-back:hover,
.sof-drilldown .sof-dd-reset:hover {
    background: #e30613;
    color: #fff;
    border-color: #e30613;
}
