/* ===== CONTRÔLES DE VUE DANS LE HEADER ===== */

.view-controls-group {
    display: flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 22px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.view-controls-group .fab-secondary {
    margin: 0;
    border: none;
    background: transparent;
    transition: var(--transition);
    position: relative;
}

.view-controls-group .fab-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
}

.view-controls-group .fab-secondary:first-child {
    border-radius: 20px 0 0 20px;
}

.view-controls-group .fab-secondary:last-child {
    border-radius: 0 20px 20px 0;
}

/* Séparateur entre les boutons */
.view-controls-group .fab-secondary:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
}

/* ===== VUES D'AFFICHAGE ===== */

/* Vue Grille (par défaut) */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* Vue Liste */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-list-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    padding: 12px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: var(--transition);
}

.item-list-row:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow);
}

.item-list-photo-wrapper {
    position: relative;
    flex-shrink: 0;
}

.item-list-photo {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.item-list-photo.item-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bois-clair);
}

.item-list-info {
    flex: 1;
    min-width: 0;
}

.item-list-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--terre-brune);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-list-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #8B7355;
}

.item-list-category,
.item-list-location {
    display: flex;
    align-items: center;
    gap: 4px;
}

.item-list-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.item-list-value {
    font-weight: 600;
    color: var(--vert-feuille);
    font-size: 14px;
}

.item-list-arrow {
    font-size: 24px;
    color: #D4CEC4;
}

/* Vue Tableau */
.items-table {
    width: 100%;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.items-table thead {
    background: var(--vert-feuille);
    color: white;
}

.items-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.items-table tbody tr {
    border-bottom: 1px solid #F0F0F0;
    cursor: pointer;
    transition: var(--transition);
}

.items-table tbody tr:hover {
    background: var(--blanc-casse);
}

.items-table tbody tr:last-child {
    border-bottom: none;
}

.items-table td {
    padding: 12px 16px;
    font-size: 14px;
}

.item-table-photo img,
.item-table-photo .item-photo-placeholder {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
}

.item-table-photo .item-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bois-clair);
}

.item-table-name {
    font-weight: 600;
    color: var(--terre-brune);
}

.item-table-category {
    color: #8B7355;
}

.item-table-location {
    color: var(--vert-feuille);
}

.badge-etat {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-neuf {
    background: #E8F5E9;
    color: #2E7D32;
}

.badge-bon {
    background: #E3F2FD;
    color: #1976D2;
}

.badge-usé {
    background: #FFF3E0;
    color: #F57C00;
}

.badge-à.réparer {
    background: #FFEBEE;
    color: #C62828;
}

.item-table-value {
    font-weight: 600;
    color: var(--vert-feuille);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--blanc-casse);
}

/* ===== REGROUPEMENT PAR CATÉGORIE ===== */

.category-group {
    margin-bottom: 40px;
    background: #FAFAF8;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 1px 3px rgba(139, 69, 19, 0.08);
}

.category-group:last-child {
    margin-bottom: 0;
}

.category-group-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--vert-feuille), var(--vert-mousse));
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(34, 139, 34, 0.2);
    margin-bottom: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.category-group-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 139, 34, 0.3);
}

.category-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.category-name {
    flex: 1;
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 1.3;
}

.category-count {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-items {
    /* Hérite du style de vue (grid, list, table) */
    padding: 0;
}

/* Appliquer les styles de grille aux items dans les groupes */
.category-items.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.category-items.items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .item-list-row {
        padding: 10px;
        gap: 12px;
    }

    .item-list-photo {
        width: 50px;
        height: 50px;
    }

    .item-list-meta {
        flex-direction: column;
        gap: 4px;
    }

    /* Tableau responsive : scroll horizontal */
    .items-table {
        display: block;
        overflow-x: auto;
    }

    .items-table table {
        min-width: 600px;
    }

    .category-group-header {
        padding: 10px 12px;
    }

    .category-name {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .item-list-name {
        font-size: 14px;
    }

    .item-list-meta {
        font-size: 12px;
    }

    .item-list-value {
        font-size: 13px;
    }
}

/* ===== ANIMATIONS ===== */

.category-group {
    animation: categoryFadeIn 0.3s ease;
}

@keyframes categoryFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}