/* ==========================================================================
   KIRONA Shop-Design-System
   Alle Werte kommen aus den --shop-*-Variablen (siehe Services/ShopThemeCss.cs),
   die je Mandant in der Tabelle ShopTheme liegen und zur Laufzeit in :root
   injiziert werden (Components/Layout/ShopThemeVariables.razor).
   ========================================================================== */

.shop-catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--shop-section-gap);
}

/* --- Gemeinsame Kartenbasis (Kachelansicht + Gruppenkarten) --- */
.shop-card {
    background: var(--shop-card-bg);
    border: 1px solid var(--shop-card-border);
    border-radius: var(--shop-radius-md);
    box-shadow: var(--shop-card-shadow);
    -webkit-backdrop-filter: var(--shop-card-backdrop);
    backdrop-filter: var(--shop-card-backdrop);
    overflow: hidden;
    transition: transform var(--shop-motion), box-shadow var(--shop-motion), border-color var(--shop-motion);
}

.shop-card:hover {
    transform: translateY(calc(var(--shop-hover-lift) * -1));
    box-shadow: var(--shop-shadow-lg);
}

/* --- Produktkarte --- */
.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
}

.product-card-image {
    position: relative;
    height: var(--shop-image-height);
    overflow: hidden;
    background: var(--shop-surface-2);
}

.product-card-image img {
    width: 100%;
    height: 100%;
    /* Ganze Bildfläche zeigen (kein Zuschnitt); auf die Breite skaliert, vertikal/horizontal zentriert. */
    object-fit: contain;
    object-position: center;
    transition: transform var(--shop-motion);
}

.product-card:hover .product-card-image img {
    transform: var(--shop-hover-zoom);
}

.product-card-image > .bi {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--shop-text-muted);
}

.product-image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--shop-motion);
}

.product-card:hover .product-image-nav { opacity: 1; }

.product-image-nav--prev { left: 0.5rem; }
.product-image-nav--next { right: 0.5rem; }

.product-card-body {
    display: flex;
    flex-direction: column;
    gap: calc(var(--shop-spacing) * 0.75);
    padding: var(--shop-card-pad);
    flex: 1;
}

.product-card-title {
    font-family: var(--shop-font-display);
    font-size: calc(var(--shop-font-size-base) * var(--shop-heading-scale));
    font-weight: 600;
    color: var(--shop-text);
    line-height: 1.25;
    margin: 0;
}

.product-card-mono {
    font-family: var(--shop-font-mono);
    font-size: calc(var(--shop-font-size-base) * 0.78);
    letter-spacing: 0.03em;
    color: var(--shop-text-muted);
}

.product-card-description {
    font-size: calc(var(--shop-font-size-base) * 0.9);
    color: var(--shop-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: var(--shop-desc-lines);
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.product-price {
    margin-top: auto;
}

.product-price-amount {
    font-family: var(--shop-font-display);
    font-size: calc(var(--shop-font-size-base) * 1.15);
    font-weight: 700;
    color: var(--shop-accent);
}

.product-price-note {
    font-size: calc(var(--shop-font-size-base) * 0.8);
    color: var(--shop-text-muted);
}

.product-card-actions {
    display: flex;
    gap: calc(var(--shop-spacing) * 0.75);
    margin-top: calc(var(--shop-spacing) * 0.5);
}

/* --- Listenansicht (High-Density) --- */
.product-list-row {
    display: flex;
    align-items: center;
    gap: var(--shop-spacing);
    padding: var(--shop-spacing);
    background: var(--shop-card-bg);
    border: 1px solid var(--shop-card-border);
    border-radius: var(--shop-radius-sm);
    transition: border-color var(--shop-motion);
}

.product-list-row:hover {
    border-color: var(--shop-accent);
}

.product-list-thumb {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: var(--shop-radius-sm);
    background: var(--shop-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-list-thumb img {
    width: 100%;
    height: 100%;
    /* Ganzes Bild zeigen, auf Breite skaliert, zentriert. */
    object-fit: contain;
    object-position: center;
}

.product-list-thumb .bi { color: var(--shop-text-muted); font-size: 1.4rem; }

.product-list-main {
    flex: 1;
    min-width: 0;
}

.product-list-meta {
    font-family: var(--shop-font-mono);
    font-size: calc(var(--shop-font-size-base) * 0.78);
    color: var(--shop-text-muted);
}

/* --- Lagerampel --- */
.availability-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: calc(var(--shop-font-size-base) * 0.8);
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.availability-badge::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: currentColor;
}

.availability-badge--in { color: var(--shop-stock-in); background: color-mix(in srgb, var(--shop-stock-in) 14%, transparent); }
.availability-badge--low { color: var(--shop-stock-low); background: color-mix(in srgb, var(--shop-stock-low) 16%, transparent); }
.availability-badge--out { color: var(--shop-stock-out); background: color-mix(in srgb, var(--shop-stock-out) 16%, transparent); }

/* --- Buttons --- */
.btn-shop-primary {
    background: var(--shop-grad-accent);
    border: none;
    color: var(--shop-on-accent);
    border-radius: var(--shop-radius-btn);
    font-family: var(--shop-font-display);
    font-weight: 600;
}

.btn-shop-primary:hover {
    filter: brightness(1.08);
    color: var(--shop-on-accent);
}

.btn-shop-secondary {
    background: transparent;
    border: 1px solid var(--shop-border);
    color: var(--shop-text);
    border-radius: var(--shop-radius-btn);
}

.btn-shop-secondary:hover {
    border-color: var(--shop-accent);
    color: var(--shop-accent);
}

/* --- Gruppenkarte --- */
.shop-group-card { cursor: pointer; }

.shop-group-image {
    height: var(--shop-image-height);
    width: 100%;
    object-fit: contain;
    object-position: center;
    background: var(--shop-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--shop-text-muted);
}

.shop-group-body {
    padding: var(--shop-card-pad);
}

.shop-group-title {
    font-family: var(--shop-font-display);
    font-size: calc(var(--shop-font-size-base) * var(--shop-heading-scale));
    font-weight: 600;
    color: var(--shop-text);
    margin: 0;
}

.shop-group-description {
    font-size: calc(var(--shop-font-size-base) * 0.9);
    color: var(--shop-text-muted);
    margin: 0.35rem 0 0;
}

/* Gruppenliste ohne Bilder (kompakt statt Kachelraster) */
.shop-group-list {
    display: flex;
    flex-direction: column;
    gap: var(--shop-spacing);
}

.shop-group-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--shop-spacing);
    padding: calc(var(--shop-spacing) * 0.9) var(--shop-spacing);
    background: var(--shop-card-bg);
    border: 1px solid var(--shop-card-border);
    border-radius: var(--shop-radius-sm);
    color: var(--shop-text);
    text-decoration: none;
    transition: border-color var(--shop-motion), background var(--shop-motion);
}

.shop-group-list-row:hover {
    border-color: var(--shop-accent);
    background: color-mix(in srgb, var(--shop-accent) 6%, var(--shop-card-bg));
    color: var(--shop-text);
}

.shop-group-list-main { display: flex; flex-direction: column; min-width: 0; }

.shop-group-list-title {
    font-family: var(--shop-font-display);
    font-size: calc(var(--shop-font-size-base) * 1.05);
    font-weight: 600;
    color: var(--shop-text);
}

.shop-group-list-desc {
    font-size: calc(var(--shop-font-size-base) * 0.85);
    color: var(--shop-text-muted);
    margin-top: .15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shop-group-list-action {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: calc(var(--shop-font-size-base) * 0.85);
    color: var(--shop-accent);
    white-space: nowrap;
    flex-shrink: 0;
}

/* --- Warenkorb (Seite) --- */
.cart-table-card {
    background: var(--shop-card-bg);
    border: 1px solid var(--shop-card-border);
    border-radius: var(--shop-radius-md);
    overflow: hidden;
}

.cart-summary-card {
    background: var(--shop-card-bg);
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius-md);
}

.cart-summary-header {
    background: var(--shop-grad-accent);
    color: var(--shop-on-accent);
    font-weight: 700;
}

.cart-summary-total {
    color: var(--shop-accent);
}

/* --- Slide-Over-Warenkorb --- */
.shop-fab {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1040;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    border: none;
    background: var(--shop-grad-accent);
    color: var(--shop-on-accent);
    box-shadow: var(--shop-shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.shop-fab-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--shop-danger);
    color: var(--shop-on-accent);
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1041;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--shop-motion);
}

.shop-drawer-backdrop--open {
    opacity: 1;
    pointer-events: auto;
}

.shop-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1042;
    width: min(420px, 100vw);
    background: var(--shop-bg);
    border-left: 1px solid var(--shop-border);
    box-shadow: var(--shop-shadow-lg);
    transform: translateX(100%);
    transition: transform var(--shop-motion);
    display: flex;
    flex-direction: column;
}

.shop-drawer--open {
    transform: translateX(0);
}

.shop-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--shop-card-pad);
    border-bottom: 1px solid var(--shop-border);
    font-family: var(--shop-font-display);
    font-weight: 600;
    color: var(--shop-text);
}

.shop-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--shop-card-pad);
}

.shop-drawer-foot {
    border-top: 1px solid var(--shop-border);
    padding: var(--shop-card-pad);
    background: var(--shop-surface);
}

.shop-drawer-line {
    display: flex;
    align-items: center;
    gap: var(--shop-spacing);
    padding: var(--shop-spacing) 0;
    border-bottom: 1px solid var(--shop-border);
}

.shop-drawer-line-title {
    flex: 1;
    font-weight: 600;
    color: var(--shop-text);
}

.shop-drawer-line-price {
    color: var(--shop-accent);
    font-weight: 700;
}

/* --- Skeleton-Loader --- */
.shop-skeleton {
    border-radius: var(--shop-radius-md);
    background: linear-gradient(
        100deg,
        var(--shop-surface) 40%,
        var(--shop-surface-2) 50%,
        var(--shop-surface) 60%);
    background-size: 200% 100%;
    animation: shop-shimmer 1.4s ease infinite;
}

@keyframes shop-shimmer {
    0% { background-position: 120% 0; }
    100% { background-position: -80% 0; }
}

/* --- Suche --- */
.shop-search-box {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--shop-card-bg);
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius-input);
    padding: 0.5rem 0.9rem;
}

.shop-search-box input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--shop-text);
    outline: none;
    font-size: var(--shop-font-size-base);
}

.shop-search-box input::placeholder { color: var(--shop-text-muted); }
.shop-search-box .bi { color: var(--shop-text-muted); }

/* --- Facetten --- */
.shop-facets {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    background: var(--shop-card-bg);
    border: 1px solid var(--shop-border);
    border-radius: var(--shop-radius-md);
    padding: var(--shop-card-pad);
}

.shop-facets-group { display: flex; flex-direction: column; gap: 0.4rem; }

.shop-facets-label {
    font-family: var(--shop-font-display);
    font-weight: 600;
    font-size: calc(var(--shop-font-size-base) * 0.85);
    color: var(--shop-text);
}

.shop-facet-chip {
    text-align: left;
    border: 1px solid var(--shop-border);
    background: transparent;
    color: var(--shop-text-muted);
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    font-size: calc(var(--shop-font-size-base) * 0.85);
}

.shop-facet-chip--active {
    background: color-mix(in srgb, var(--shop-accent) 16%, transparent);
    border-color: var(--shop-accent);
    color: var(--shop-accent);
}

/* --- Ansichten-Umschalter --- */
.shop-viewswitch { display: flex; gap: 0.3rem; }

.shop-viewbtn {
    border: 1px solid var(--shop-border);
    background: var(--shop-card-bg);
    color: var(--shop-text-muted);
    border-radius: var(--shop-radius-btn);
    padding: 0.35rem 0.6rem;
}

.shop-viewbtn--active { color: var(--shop-accent); border-color: var(--shop-accent); }

/* --- Herkunfts-Badge --- */
.source-badge {
    display: inline-flex;
    font-size: calc(var(--shop-font-size-base) * 0.78);
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--shop-surface-2);
    color: var(--shop-text-muted);
    border: 1px solid var(--shop-border);
}

.source-badge--shop { color: var(--shop-accent); border-color: var(--shop-accent); }
.source-badge--inventory { color: var(--shop-info); border-color: var(--shop-info); }
.source-badge--supplier { color: var(--shop-accent-2); border-color: var(--shop-accent-2); }

/* --- High-Density-Tabelle --- */
.shop-table { border: 1px solid var(--shop-border); border-radius: var(--shop-radius-md); overflow: hidden; }

.shop-table-head,
.shop-table-row {
    display: grid;
    grid-template-columns: 1.6fr 0.8fr 1fr 1fr;
    gap: var(--shop-spacing);
    align-items: center;
    padding: 0.55rem var(--shop-card-pad);
}

.shop-table-head {
    font-family: var(--shop-font-display);
    font-weight: 600;
    font-size: calc(var(--shop-font-size-base) * 0.82);
    color: var(--shop-text-muted);
    background: var(--shop-surface-2);
    border-bottom: 1px solid var(--shop-border);
}

.shop-table-row { border-bottom: 1px solid var(--shop-border); cursor: pointer; background: var(--shop-card-bg); }
.shop-table-row:hover { background: color-mix(in srgb, var(--shop-accent) 5%, var(--shop-card-bg)); }
.shop-table-row:last-child { border-bottom: none; }

/* --- Preis-Aufschlüsselung --- */
.price-breakdown summary { cursor: pointer; }

.price-breakdown-list {
    list-style: none;
    margin: 0.4rem 0 0;
    padding: 0;
    font-size: calc(var(--shop-font-size-base) * 0.82);
    color: var(--shop-text-muted);
}

.price-breakdown-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.15rem 0;
}

.price-breakdown-discount { color: var(--shop-success); }

.price-breakdown-total {
    border-top: 1px solid var(--shop-border);
    margin-top: 0.25rem;
    padding-top: 0.25rem;
    font-weight: 700;
    color: var(--shop-text);
}

/* --- Mengen-Konfigurator --- */
.qty-config { display: flex; align-items: center; gap: 0.4rem; }

.qty-config-input { width: 4rem; text-align: center; }

.qty-config-unit { color: var(--shop-text-muted); font-size: calc(var(--shop-font-size-base) * 0.85); }

.qty-config-pack {
    font-size: calc(var(--shop-font-size-base) * 0.8);
    color: var(--shop-text-muted);
    margin-top: 0.3rem;
}
