/* Fachl Lagerstand Styles */

:root {
    --fachl-primary: #4d6c8e;
    --fachl-secondary: #e74c3c;
    --fachl-success: #27ae60;
    --fachl-info: #3498db;
    --fachl-warning: #f39c12;
    --fachl-light: #ecf0f1;
    --fachl-dark: #34495e;
    --fachl-border-radius: 12px;
    --fachl-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Artikel-Tabelle Styles */
.fachl-artikel-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.fachl-artikel-table thead {
    background: var(--fachl-light);
}

.fachl-artikel-table th,
.fachl-artikel-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--fachl-light);
}

.fachl-artikel-table th {
    font-weight: 600;
    color: var(--fachl-dark);
}

.fachl-artikel-table tbody tr:hover {
    background: rgba(52, 152, 219, 0.05);
}

.fachl-artikel-table td.menge {
    font-weight: bold;
    color: var(--fachl-info);
}

.fachl-artikel-liste {
    max-height: 400px;
    overflow-y: auto;
}

.fachl-detail-card.full-width {
    grid-column: 1 / -1;
}

.fachl-lager-item.info {
    background: rgba(52, 152, 219, 0.1);
    border-left: 3px solid var(--fachl-info);
}

/* Tabellen-Ansicht Styles */
.fachl-table-container {
    max-width: 100%;
    margin: 20px auto;
    padding: 15px;
    background: white;
    border-radius: var(--fachl-border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.fachl-table-titel {
    color: var(--fachl-primary);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
}

.fachl-table-scroll {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fachl-overview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 1000px;
}

.fachl-overview-table thead {
    background: linear-gradient(135deg, var(--fachl-primary), var(--fachl-dark));
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.fachl-overview-table th {
    padding: 12px 6px;
    text-align: center;
    font-weight: 600;
    border-right: 1px solid rgba(255,255,255,0.2);
    white-space: nowrap;
    font-size: 12px;
    min-width: 60px;
}

.fachl-overview-table th.sticky-col {
    position: sticky;
    left: 0;
    background: var(--fachl-primary);
    z-index: 11;
    min-width: 140px;
    text-align: left;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.fachl-overview-table tbody tr {
    border-bottom: 1px solid #e8e8e8;
}

.fachl-overview-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.fachl-overview-table tbody tr:hover {
    background: rgba(52, 152, 219, 0.08);
}

.fachl-overview-table td {
    padding: 8px 6px;
    text-align: center;
    border-right: 1px solid #e8e8e8;
    font-size: 12px;
}

.fachl-overview-table td.standort-name {
    font-weight: 600;
    color: var(--fachl-dark);
    text-align: left;
    position: sticky;
    left: 0;
    background: inherit;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    z-index: 5;
}

.fachl-overview-table td.gesamt-menge {
    font-weight: bold;
    color: var(--fachl-info);
    background: rgba(52, 152, 219, 0.05);
}

.fachl-overview-table td.artikel-arten {
    font-weight: bold;
    color: var(--fachl-warning);
    background: rgba(243, 156, 18, 0.05);
}

.fachl-overview-table td.leer {
    background: #ff4757;
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.fachl-overview-table td.verfuegbar {
    background: #2ed573;
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.fachl-table-loading {
    text-align: center;
    padding: 40px;
    color: var(--fachl-dark);
}

.fachl-table-loading .fachl-spinner {
    margin: 0 auto 15px;
}

/* Accordion Styles */
.fachl-accordion-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.fachl-standort-accordion {
    border-bottom: 1px solid #e8e8e8;
}

.fachl-standort-accordion:last-child {
    border-bottom: none;
}

.fachl-standort-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--fachl-primary), var(--fachl-dark));
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
}

.fachl-standort-header:hover {
    background: linear-gradient(135deg, var(--fachl-dark), var(--fachl-primary));
}

.fachl-standort-name {
    font-weight: 600;
    font-size: 16px;
}

.fachl-standort-stats {
    display: flex;
    gap: 15px;
    font-size: 14px;
}

.fachl-gesamt {
    color: #3498db;
    font-weight: bold;
}

.fachl-arten {
    color: #f39c12;
    font-weight: bold;
}

.fachl-fehlen {
    color: #e74c3c;
    font-weight: bold;
    background: rgba(231, 76, 60, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
}

.fachl-toggle {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.fachl-standort-content {
    background: #f9f9f9;
    padding: 20px;
}

.fachl-artikel-section {
    margin-bottom: 20px;
}

.fachl-artikel-section:last-child {
    margin-bottom: 0;
}

.fachl-section-title {
    margin: 0 0 10px 0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

.fachl-section-title.fehlen {
    background: rgba(231, 76, 60, 0.1);
    color: #c0392b;
    border-left: 4px solid #e74c3c;
}

.fachl-section-title.vorhanden {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border-left: 4px solid #2ed573;
}

.fachl-artikel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 4px;
    font-size: 13px;
    gap: 10px;
}

.fachl-artikel-item.fehlt {
    background: rgba(231, 76, 60, 0.05);
    border-left: 3px solid #e74c3c;
}

.fachl-artikel-item.vorhanden {
    background: rgba(39, 174, 96, 0.05);
    border-left: 3px solid #2ed573;
}

.fachl-artikel-name {
    flex: 2;
    font-weight: 500;
}

.fachl-artikel-ean {
    flex: 1;
    color: #7f8c8d;
    font-size: 11px;
    font-family: monospace;
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 3px;
}

.fachl-artikel-status {
    color: #e74c3c;
    font-weight: bold;
    font-size: 12px;
    min-width: 60px;
    text-align: center;
}

.fachl-artikel-menge {
    color: #27ae60;
    font-weight: bold;
    font-size: 12px;
    min-width: 80px;
    text-align: center;
}

.fachl-no-data {
    text-align: center;
    padding: 40px;
    color: var(--fachl-dark);
    font-style: italic;
}

/* Matrix Table Styles */
.fachl-matrix-container {
    max-width: 100%;
    margin: 20px auto;
    padding: 15px;
    background: white;
    border-radius: var(--fachl-border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.fachl-matrix-titel {
    color: var(--fachl-primary);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
}

.fachl-matrix-scroll {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fachl-matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 800px;
}

.fachl-matrix-table thead {
    background: white;
    color: var(--fachl-dark);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #e8e8e8;
}

.fachl-matrix-table th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    border-right: 1px solid rgba(255,255,255,0.2);
    white-space: nowrap;
    font-size: 14px;
    font-family: inherit;
}

.fachl-matrix-table th.sticky-col {
    position: sticky;
    left: 0;
    background: white !important;
    color: var(--fachl-dark) !important;
    z-index: 11;
    min-width: 120px;
    text-align: left;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    font-weight: 600;
}

.fachl-matrix-table th.ean-col {
    min-width: 100px;
    font-family: inherit;
    font-size: 13px;
    padding: 8px 4px;
    background: white !important;
    color: var(--fachl-dark) !important;
    font-weight: 600;
    border-bottom: none;
}

.fachl-matrix-table .product-names-row {
    background: white !important;
}

.fachl-matrix-table th.product-name-col {
    font-size: 13px;
    font-weight: normal;
    color: var(--fachl-dark) !important;
    padding: 8px 4px;
    white-space: normal;
    line-height: 1.2;
    min-width: 100px;
    max-width: 120px;
    word-wrap: break-word;
    background: white !important;
    border-bottom: 2px solid #e8e8e8;
    vertical-align: top;
}

.fachl-matrix-table tbody tr {
    border-bottom: 1px solid #e8e8e8;
}

.fachl-matrix-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}


.fachl-matrix-table td {
    padding: 8px;
    text-align: center;
    border-right: 1px solid #e8e8e8;
    font-size: 14px;
    font-weight: bold;
    font-family: inherit;
}

.fachl-matrix-table td.standort-name {
    font-weight: 600;
    color: var(--fachl-dark);
    text-align: left;
    position: sticky;
    left: 0;
    background: inherit;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    z-index: 5;
    font-size: 14px;
    font-family: inherit;
}

.fachl-matrix-table td.menge-null {
    background: #ff4757;
    color: black;
    font-weight: bold;
}

.fachl-matrix-table td.menge-niedrig {
    background: #ffd700;
    color: black;
    font-weight: bold;
}

.fachl-matrix-table td.menge-vorhanden {
    background: #2ed573;
    color: black;
    font-weight: bold;
}

.fachl-matrix-loading {
    text-align: center;
    padding: 40px;
    color: var(--fachl-dark);
}

/* Umsatz Matrix Styles */
.fachl-matrix-table .umsatz-artikel {
    background: #e8f4f8;
    color: var(--fachl-info);
    font-weight: bold;
}

.fachl-matrix-table .umsatz-gesamt-row {
    background: rgba(39, 174, 96, 0.1);
    border-top: 2px solid var(--fachl-success);
}

.fachl-matrix-table .umsatz-gesamt {
    background: var(--fachl-success);
    color: white;
    font-weight: bold;
    font-size: 16px;
    text-align: center;
}

.fachl-umsatz-info {
    margin-top: 15px;
    padding: 10px;
    background: rgba(52, 152, 219, 0.05);
    border-left: 3px solid var(--fachl-info);
    border-radius: 4px;
}

.fachl-umsatz-info p {
    margin: 5px 0;
    color: var(--fachl-dark);
}

#fachl-umsatz-timestamp {
    font-weight: 600;
    color: var(--fachl-info);
}

/* Button Styles für Umsatz Matrix */
.fachl-umsatz-info button {
    margin-right: 10px;
    cursor: pointer;
}

.fachl-umsatz-info button:hover {
    opacity: 0.9;
}

.dashicons.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .fachl-table-container {
        padding: 10px;
        margin: 10px;
    }
    
    .fachl-standort-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .fachl-standort-stats {
        flex-direction: column;
        gap: 5px;
    }
    
    .fachl-artikel-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

.fachl-lagerstand-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.fachl-titel {
    text-align: center;
    color: var(--fachl-primary);
    font-size: 2rem;
    margin-bottom: 2rem;
    font-weight: 600;
    position: relative;
    padding-bottom: 15px;
}

.fachl-titel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--fachl-secondary), var(--fachl-primary));
    border-radius: 2px;
}

/* Filter Container */
.fachl-filter-container {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.fachl-search-input,
.fachl-region-filter {
    flex: 1;
    min-width: 200px;
    padding: 12px 20px;
    border: 2px solid var(--fachl-light);
    border-radius: var(--fachl-border-radius);
    font-size: 1rem;
    transition: var(--fachl-transition);
    background: white;
}

.fachl-search-input:focus,
.fachl-region-filter:focus {
    outline: none;
    border-color: var(--fachl-info);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Grid Layout */
.fachl-standorte-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

/* Standort Card */
.fachl-standort-card {
    background: white;
    border-radius: var(--fachl-border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    transition: var(--fachl-transition);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.fachl-standort-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.fachl-standort-card.hidden {
    display: none;
}

/* Card Header */
.fachl-standort-header {
    background: linear-gradient(135deg, var(--fachl-primary) 0%, var(--fachl-dark) 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fachl-standort-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color:blanchedalmond !important
}

.fachl-standort-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* Card Body */
.fachl-standort-body {
    padding: 25px 20px;
    min-height: 120px;
    background: linear-gradient(180deg, #fafbfc 0%, white 100%);
}

/* Loading State */
.fachl-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--fachl-dark);
}

.fachl-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--fachl-light);
    border-top-color: var(--fachl-info);
    border-radius: 50%;
    animation: fachl-spin 1s linear infinite;
}

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

/* Lagerstand Content */
.fachl-lagerstand-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.fachl-lager-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--fachl-info);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.fachl-lager-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fachl-lager-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--fachl-primary);
}

.fachl-lager-item.success {
    border-left-color: var(--fachl-success);
}

.fachl-lager-item.warning {
    border-left-color: var(--fachl-warning);
}

/* Progress Bar */
.fachl-progress-container {
    margin-top: 20px;
}

.fachl-progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--fachl-dark);
}

.fachl-progress-bar {
    height: 8px;
    background: var(--fachl-light);
    border-radius: 10px;
    overflow: hidden;
}

.fachl-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--fachl-info), var(--fachl-success));
    transition: width 0.6s ease;
    border-radius: 10px;
}

/* Card Footer */
.fachl-standort-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--fachl-light);
    background: #fafbfc;
}

.fachl-btn-details {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--fachl-info) 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--fachl-transition);
}

.fachl-btn-details:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.fachl-btn-details:active {
    transform: translateY(0);
}

/* Error State */
.fachl-error {
    background: #ffe6e6;
    color: var(--fachl-secondary);
    padding: 20px;
    border-radius: var(--fachl-border-radius);
    text-align: center;
    border: 1px solid #ffcccc;
}

/* Modal Styles */
.fachl-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fachl-fade-in 0.3s ease;
}

.fachl-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fachl-modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--fachl-border-radius);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: fachl-slide-up 0.3s ease;
}

.fachl-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--fachl-light);
}

.fachl-modal-title {
    font-size: 1.5rem;
    color: var(--fachl-primary);
    margin: 0;
}

.fachl-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #95a5a6;
    transition: var(--fachl-transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.fachl-modal-close:hover {
    background: var(--fachl-light);
    color: var(--fachl-secondary);
}

/* Animations */
@keyframes fachl-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fachl-slide-up {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .fachl-lagerstand-container {
        padding: 15px;
    }
    
    .fachl-titel {
        font-size: 1.5rem;
    }
    
    .fachl-standorte-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .fachl-filter-container {
        flex-direction: column;
    }
    
    .fachl-search-input,
    .fachl-region-filter {
        width: 100%;
    }
    
    .fachl-lagerstand-content {
        grid-template-columns: 1fr;
    }
    
    .fachl-modal-content {
        padding: 20px;
        margin: 20px;
    }
}

@media (max-width: 480px) {
    .fachl-standort-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .fachl-lager-value {
        font-size: 1.2rem;
    }
}

/* Print Styles */
@media print {
    .fachl-filter-container,
    .fachl-btn-details,
    .fachl-modal {
        display: none !important;
    }
    
    .fachl-standort-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}