﻿/* Tabellen-Buttons Styling */
.table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

    .table .btn-sm i {
        font-size: 0.875rem;
    }

/* Hover-Effekt auch für Tabellen-Buttons */
.table .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Button-Gruppe in Tabellenzelle */
.table td .d-flex {
    justify-content: flex-start;
}

/* Kompaktere Spinner für kleine Buttons */
.table .spinner-border-sm {
    width: 0.75rem;
    height: 0.75rem;
    border-width: 0.1em;
}

/* Zeilen-Hintergrund mit höherer Spezifität für Bootstrap-Tabellen - DEZENT */
.table-striped > tbody > tr.row-furniture,
.table-striped > tbody > tr.row-furniture:nth-of-type(odd) > * {
    --bs-table-bg-type: rgba(220, 53, 69, 0.05);
    background-color: rgba(220, 53, 69, 0.05);
}

.table-striped > tbody > tr.row-assembly,
.table-striped > tbody > tr.row-assembly:nth-of-type(odd) > * {
    --bs-table-bg-type: rgba(13, 110, 253, 0.05);
    background-color: rgba(13, 110, 253, 0.05);
}

.table-striped > tbody > tr.row-fragile,
.table-striped > tbody > tr.row-fragile:nth-of-type(odd) > * {
    --bs-table-bg-type: rgba(255, 193, 7, 0.05);
    background-color: rgba(255, 193, 7, 0.05);
}

.table-striped > tbody > tr.row-box,
.table-striped > tbody > tr.row-box:nth-of-type(odd) > * {
    --bs-table-bg-type: rgba(25, 135, 84, 0.05);
    background-color: rgba(25, 135, 84, 0.05);
}

.table-striped > tbody > tr.row-other,
.table-striped > tbody > tr.row-other:nth-of-type(odd) > * {
    --bs-table-bg-type: rgba(108, 117, 125, 0.05);
    background-color: rgba(108, 117, 125, 0.05);
}

/* Hover-Effekt anpassen - etwas stärker */
.table-hover > tbody > tr.row-furniture:hover > * {
    --bs-table-bg-state: rgba(220, 53, 69, 0.15);
    background-color: rgba(220, 53, 69, 0.15);
}

.table-hover > tbody > tr.row-assembly:hover > * {
    --bs-table-bg-state: rgba(13, 110, 253, 0.15);
    background-color: rgba(13, 110, 253, 0.15);
}

.table-hover > tbody > tr.row-fragile:hover > * {
    --bs-table-bg-state: rgba(255, 193, 7, 0.15);
    background-color: rgba(255, 193, 7, 0.15);
}

.table-hover > tbody > tr.row-box:hover > * {
    --bs-table-bg-state: rgba(25, 135, 84, 0.15);
    background-color: rgba(25, 135, 84, 0.15);
}

.table-hover > tbody > tr.row-other:hover > * {
    --bs-table-bg-state: rgba(108, 117, 125, 0.15);
    background-color: rgba(108, 117, 125, 0.15);
}

/* Sortierbare Spaltenköpfe */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px;
}

/* Hover für dunkle Tabellenköpfe */
.table-dark .sortable-header:hover {
    color: cornflowerblue;
}

.sortable-header::after {
    content: "↕";
    position: absolute;
    right: 5px;
    opacity: 0.3;
}

.sortable-header.sort-asc::after {
    content: "↑";
    opacity: 1;
}

.sortable-header.sort-desc::after {
    content: "↓";
    opacity: 1;
}

/* Volumen-Spalte etwas breiter */
th[data-sort="volume"] {
    min-width: 90px;
}

.icon-needed {
    color: #dc3545;
}

/* Thumbnail-Hover EXAKT wie Table-Hover - Furniture/Rot */
.table-hover > tbody > tr.row-furniture.thumbnail-hover > * {
    --bs-table-bg-state: rgba(220, 53, 69, 0.15);
    background-color: rgba(220, 53, 69, 0.15);
}

/* Assembly/Blau */
.table-hover > tbody > tr.row-assembly.thumbnail-hover > * {
    --bs-table-bg-state: rgba(13, 110, 253, 0.15);
    background-color: rgba(13, 110, 253, 0.15);
}

/* Box/Grün */
.table-hover > tbody > tr.row-box.thumbnail-hover > * {
    --bs-table-bg-state: rgba(25, 135, 84, 0.15);
    background-color: rgba(25, 135, 84, 0.15);
}

/* Fragile/Gelb */
.table-hover > tbody > tr.row-fragile.thumbnail-hover > * {
    --bs-table-bg-state: rgba(255, 193, 7, 0.15);
    background-color: rgba(255, 193, 7, 0.15);
}

/* Other/Grau */
.table-hover > tbody > tr.row-other.thumbnail-hover > * {
    --bs-table-bg-state: rgba(108, 117, 125, 0.15);
    background-color: rgba(108, 117, 125, 0.15);
}

/* Sticky Image Container */
.card-body.bg-white {
    position: sticky;
    top: 70px; /* Platz für Navigation */
    z-index: 10;
    background-color: white;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 1rem !important;
    margin-bottom: 0 !important;
    max-height: 200px; /* Begrenzte Höhe */
    overflow-x: auto; /* Horizontales Scrollen wenn nötig */
    overflow-y: hidden;
    transition: box-shadow 0.2s ease-in-out;
}

    /* Schatten beim Scrollen */
    .card-body.bg-white.scrolled {
        box-shadow: 0 2px 4px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.1);
    }

/* Tabelle bekommt mehr Abstand nach oben */
.table-responsive {
    margin-top: 1rem;
}

.table td .fa-solid {
    font-size: 0.9rem;
    cursor: help;
}

    /* Hover-Effekt für Icons */
    .table td .fa-solid:hover {
        transform: scale(1.2);
        transition: transform 0.2s;
    }

/* Services Spalte */
.table td div.d-flex {
    min-height: 20px;
    padding-top: 6px; /* Schiebt die Icons etwas nach unten */
}

.table td:nth-child(6) { /* 6. Spalte = Services */
    max-width: 180px; /* Platz für 5 Icons + Gaps */
}

    .table td:nth-child(6) .d-flex {
        max-width: 120px;
        margin: 0 auto; /* Zentrieren */
        padding-top: 6px;
    }

    /* Icons in Services-Spalte */
    .table td:nth-child(6) .fa-solid {
        font-size: 0.9rem;
        width: 15px; /* Feste Breite pro Icon */
        text-align: center;
    }

.table thead th {
    background-color: #495057; /* Dunkles Grau */
    color: white;
}

/* Hover-Effekt für sortierbare Header */
.sortable-header:hover {
    color: #6495ED !important; /* Cornflower Blue */
}

    /* Optional: Auch das Sortier-Icon in Cornflower Blue */
    .sortable-header:hover::after {
        color: #6495ED;
    }

/* Card-Body für Bilder - flexible Höhe */
.card-body.bg-white {
    max-height: none !important; /* Keine Höhenbeschränkung */
    overflow: visible !important;
}

    /* Oder mit maximaler Höhe aber scrollbar */
    .card-body.bg-white.image-gallery {
        max-height: 500px; /* Genug für ~3 Reihen */
        overflow-y: auto;
        overflow-x: hidden;
    }

/* Scrolled-State anpassen */
.card-body.scrolled {
    max-height: none !important;
}


/* Grid-Layout für Bilder - max 4 Spalten */
.image-gallery {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 200px));
    gap: 1rem;
    padding: 1rem;
    max-height: none;
    justify-content: start; /* Links ausrichten statt über ganze Breite verteilen */
}

/* Toggle Button Styling */
.toggle-table-btn {
    background-color: orangered;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 0;
}

    /* Standard Button-Hover aus buttons.css übernehmen */
    .toggle-table-btn:hover {
        transform: translateY(-2px);
        background-color: orangered;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
        border: 0;
    }

    /* Badge im Toggle-Button */
    .toggle-table-btn .badge {
        font-size: 0.7rem;
        margin-top: 1px;
        padding: 0.2rem 0.4rem;
        border-radius: 0.25rem;
        font-weight: bold;        
    }

    /* Fokus-Rahmen NUR für Toggle-Button entfernen */
    .toggle-table-btn:focus,
    .toggle-table-btn:focus-visible,
    .toggle-table-btn:active:focus,
    .toggle-table-btn.active:focus,
    .toggle-table-btn:focus:not(:focus-visible) {
        box-shadow: none !important;
        outline: none !important;
        border-color: #6c757d !important; /* Behalte die normale Border-Farbe */
    }

    /* Auch nach dem Klick */
    .toggle-table-btn:active,
    .toggle-table-btn.active {
        box-shadow: none !important;
        outline: none !important;
        border-color: #6c757d !important;
    }


/* Icon Animation */
.toggle-icon {
    transition: transform 0.3s ease;
}

/* Table Container */
.table-container {
    overflow: hidden;
    transition: all 0.3s ease;
}

    /* Entferne den margin-top von .table-responsive wenn es in .table-container ist */
    .table-container .table-responsive {
        margin-top: 0;
        border-top: 1px solid #dee2e6;
    }

/* Sanfterer Übergang zwischen Bildern und Toggle-Button */
.card-body.image-gallery {
    margin-bottom: 0;
    padding-bottom: 0.5rem;
}

/* Button Container zentriert */
.card-body.d-flex.justify-content-center {
    padding-top: 0.5rem !important;
    padding-bottom: 1rem !important;
}

/* Responsive Card Header */
@media (max-width: 767px) {
    .card-header .d-flex {
        flex-direction: column;
        align-items: stretch !important;
    }

    .card-header h5 {
        margin-bottom: 0.75rem !important;
        text-align: center;
    }

    .card-header .btn {
        width: 100%;
        margin-bottom: 0.25rem;
    }

    .card-header form {
        width: 100%;
    }

        .card-header form .btn {
            width: 100%;
        }
}

/* Medium Breakpoint - Buttons in 2er Reihen */
@media (min-width: 768px) and (max-width: 991px) {
    .card-header .d-flex.gap-2 {
        max-width: 400px;
    }
}

/* Sehr schmale Viewports (unter 400px) */
@media (max-width: 399px) {
    .card-header .btn-sm {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
    }

        /* Icons etwas kleiner */
        .card-header .btn-sm i {
            font-size: 0.75rem;
        }
}

/* Tablet-Ansicht optimieren */
@media (min-width: 576px) and (max-width: 767px) {
    .card-header .d-flex.gap-2 {
        justify-content: center;
    }
}