/* ===========================
   OCI Bestandsübersicht
   App-spezifisches CSS
   (Farben, Radien, Schatten kommen aus OCI.Aura/aura.css)
   =========================== */

/* --- Inter Font (lokal, DSGVO-konform) --- */
@font-face {
    font-family: 'Inter';
    src: url('/fonts/inter-var-latin.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* --- Header --- */
.site-header {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border-bottom: var(--glass-border);
}

.header-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-brand:hover { color: var(--primary-hover); }

.header-links { display: flex; gap: 16px; }
.header-link {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 400;
}
.header-link:hover { color: var(--primary-color); }

/* --- Suche & Filter --- */
.search-bar {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.85rem;
    width: 100%;
    max-width: 400px;
    color: var(--text-primary);
    font-family: inherit;
}

.search-bar:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

/* --- Filter-Toggle Button --- */
.btn-filter-toggle {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-family: inherit;
    transition: border-color 0.25s;
}
.btn-filter-toggle:hover { border-color: var(--primary-color); color: var(--primary-color); }
.filter-badge {
    background: var(--primary-color);
    color: #fff;
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    font-weight: 600;
}

/* --- Filter-Panel --- */
.filter-panel {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.filter-group { margin-bottom: 12px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-group-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    cursor: pointer;
    user-select: none;
}
.filter-group-title:hover { color: var(--primary-color); }

.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }

.filter-chip {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}
.filter-chip:hover { border-color: var(--primary-color); color: var(--primary-color); }
.filter-chip.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

.filter-color-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    display: inline-block;
    flex-shrink: 0;
}

/* --- Kachel-Grid (Übersicht) --- */
.bestand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.bestand-card {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.bestand-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(79, 70, 229, 0.3);
    color: inherit;
}

.card-img { height: 180px; overflow: hidden; background: rgba(232, 222, 249, 0.15); position: relative; }
.card-marke-logo {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    object-fit: contain;
    background: rgba(255,255,255,0.85);
    border-radius: 6px;
    padding: 3px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.card-img > img:first-child { width: 100%; height: 100%; object-fit: cover; }
.card-img-placeholder {
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #e8def9 0%, #c4b5e0 50%, #a78bca 100%);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.8rem; font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.card-body { padding: 12px 14px; }
.card-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 2px; color: var(--text-primary); }
.card-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; }

.color-row { display: flex; gap: 4px; align-items: center; margin-bottom: 8px; }
.color-dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,0.1); display: inline-block; }
.color-count { font-size: 0.7rem; color: var(--text-muted); margin-left: 4px; }

.card-meta { display: flex; justify-content: space-between; align-items: center; }
.meta-text { font-size: 0.7rem; color: var(--text-muted); }

/* --- Badges (Bestand-spezifisch) --- */
.badge-green { background: rgba(5, 150, 105, 0.1); color: var(--success-color); font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); }
.badge-amber { background: rgba(217, 119, 6, 0.1); color: var(--warning-color); font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); }
.badge-red { background: rgba(168, 54, 75, 0.1); color: var(--danger-color); font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); }
.badge-blue { background: rgba(79, 70, 229, 0.1); color: var(--primary-color); font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); }

/* --- Attribute Section (Detail) --- */
.attr-section {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.attr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px 20px;
}

.attr-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.attr-value { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }

/* --- Selling Points --- */
.selling-points {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: var(--glass-border);
}

.sp {
    background: rgba(232, 222, 249, 0.4);
    color: var(--primary-color);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

/* --- Bestands-Matrix (Detail) --- */
.matrix-section {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

table.matrix {
    width: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
}

table.matrix thead tr.label-row th:not(:first-child),
table.matrix tbody td:not(:first-child) {
    min-width: 60px;
}

table.matrix thead tr.img-row th {
    padding: 8px 6px 4px;
    text-align: center;
    vertical-align: bottom;
    background: transparent;
    border: none;
}
table.matrix thead tr.img-row th:first-child { min-width: 80px; }

.th-thumb {
    width: 64px; height: 64px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.5rem; font-weight: 700; color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.15s;
    margin: 0 auto;
}
.th-thumb:hover { transform: scale(1.08); }

table.matrix thead tr.label-row th {
    background: rgba(232, 222, 249, 0.15);
    padding: 6px 8px;
    font-weight: 700;
    font-size: 0.68rem;
    color: var(--text-primary);
    text-align: center;
    border-bottom: var(--glass-border);
    vertical-align: top;
}
table.matrix thead tr.label-row th:first-child { text-align: left; }

.th-color-name {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
    margin-top: 1px;
}

table.matrix tbody td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid rgba(159, 156, 161, 0.1);
    font-variant-numeric: tabular-nums;
}
table.matrix tbody td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}
table.matrix tbody tr:hover { background: rgba(232, 222, 249, 0.1); }
table.matrix tbody tr.row-stripe { background: rgba(232, 222, 249, 0.18); }
table.matrix tbody tr.row-stripe td:first-child { background: rgba(237, 232, 248, 0.95); }
table.matrix tbody tr.row-stripe:hover { background: rgba(232, 222, 249, 0.28); }

.stock-cell { font-weight: 700; }
.stock-cell.high { color: var(--success-color); }
.stock-cell.medium { color: var(--warning-color); }
.stock-cell.zero { color: rgba(159, 156, 161, 0.4); }

.size-label { white-space: nowrap; }

/* Nicht-Kollektion Markierung */
.stock-cell.nicht-kollektion { font-style: italic; opacity: 0.7; }
.matrix-legende {
    margin-top: 8px;
    font-size: 0.68rem;
    color: var(--text-muted);
}
.nicht-kollektion-marker { font-weight: 700; color: var(--warning-color); }

table.matrix tbody tr.sum-row td {
    border-top: 2px solid rgba(159, 156, 161, 0.2);
    font-weight: 700;
    background: rgba(232, 222, 249, 0.15);
}

.col-sum { background: rgba(232, 222, 249, 0.15) !important; }

/* Sticky erste Spalte (Mobile Scroll) */
table.matrix td:first-child,
table.matrix th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: rgba(255, 255, 255, 0.9);
}
table.matrix thead tr.label-row th:first-child,
table.matrix tbody tr.sum-row td:first-child { background: rgba(242, 238, 248, 0.95); }

/* --- QR-Hint --- */
.qr-hint {
    background: rgba(232, 222, 249, 0.3);
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .bestand-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 768px) {
    .bestand-grid { grid-template-columns: repeat(2, 1fr); }
    .search-bar { max-width: 100%; }
    .attr-grid { grid-template-columns: repeat(2, 1fr); }
    .th-thumb { width: 48px; height: 48px; }
    table.matrix { font-size: 0.65rem; }
    table.matrix thead tr.img-row th { padding: 4px 3px 2px; }
    table.matrix thead tr.label-row th,
    table.matrix tbody td { padding: 6px 4px; }
    table.matrix thead tr.label-row th { font-size: 0.58rem; }
    .th-color-name { font-size: 0.52rem; }
    .size-label { font-size: 0.6rem; }
    .filter-chip { min-height: 44px; display: inline-flex; align-items: center; }
    .page-link { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
    .btn-filter-toggle { width: auto; }
    .attr-section { padding: 12px 14px; }
    .matrix-section { padding: 12px 10px; }
    .detail-marke-logo { width: 32px; height: 32px; }
}

@media (max-width: 480px) {
    .bestand-grid { grid-template-columns: 1fr; }
    .card-img { height: 200px; }
    .th-thumb { width: 36px; height: 36px; border-radius: 4px; }
    table.matrix { font-size: 0.6rem; }
    table.matrix thead tr.label-row th,
    table.matrix tbody td { padding: 5px 3px; }
    .attr-grid { grid-template-columns: 1fr 1fr; gap: 8px 12px; }
    h2 { font-size: 1.3rem; }
    /* Ähnliche Artikel: kleinere Karten auf Mobile */
    .bestand-card .card-img { height: 140px; }
}

/* Sicherstellen, dass ähnliche Artikel auf allen Geräten sichtbar sind */
.bestand-grid { overflow: visible; }

/* --- Detail: Markenlogo neben Titel --- */
.detail-marke-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    margin-left: 4px;
}

/* --- Druckansicht (DIN A4, kompakt) --- */
@media print {
    body { background: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 11px !important; }
    .no-print { display: none !important; }
    .site-header, .footer { display: none !important; }
    .container { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }
    h2 { font-size: 1.1rem !important; margin-bottom: 4px !important; }
    .attr-section, .matrix-section {
        box-shadow: none !important; border: 1px solid #ddd !important;
        background: #fff !important; backdrop-filter: none !important;
        padding: 8px 10px !important; margin-bottom: 6px !important;
        border-radius: 4px !important;
    }
    .attr-section { padding: 4px 8px !important; margin-bottom: 4px !important; }
    .attr-grid { display: flex !important; flex-wrap: wrap !important; gap: 2px 14px !important; }
    .attr-grid > div { display: flex !important; gap: 4px !important; align-items: baseline !important; }
    .attr-label { font-size: 0.5rem !important; margin-bottom: 0 !important; }
    .attr-value { font-size: 0.6rem !important; }
    .badge-green { font-size: 0.5rem !important; padding: 1px 4px !important; }
    table.matrix { font-size: 0.6rem !important; width: auto !important; }
    table.matrix thead tr.img-row th { padding: 2px 3px 1px !important; }
    table.matrix thead tr.label-row th { padding: 3px 4px !important; font-size: 0.55rem !important; }
    table.matrix tbody td { padding: 3px 4px !important; }
    .th-thumb { width: 40px !important; height: 40px !important; border-radius: 3px !important; }
    .th-color-name { font-size: 0.5rem !important; }
    .size-label { font-size: 0.55rem !important; }
    table.matrix td:first-child, table.matrix th:first-child { position: static !important; }
    table.matrix tbody tr.row-stripe { background: #f0f0f0 !important; }
    .detail-marke-logo { width: 24px !important; height: 24px !important; }
    .mb-3 { margin-bottom: 4px !important; }
    @page { size: A4 landscape; margin: 8mm; }
}
