/* Item Selector Modal Styles - Version améliorée avec pagination */

.item-selector-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.item-selector-modal.active {
    opacity: 1;
    visibility: visible;
}

.item-selector-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.item-selector-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: linear-gradient(135deg, 
        rgba(20, 25, 35, 0.98) 0%, 
        rgba(25, 30, 40, 0.98) 50%,
        rgba(20, 25, 35, 0.98) 100%);
    border: 2px solid rgba(0, 168, 255, 0.4);
    border-radius: 16px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.item-selector-modal.active .item-selector-content {
    transform: translate(-50%, -50%) scale(1);
}

.item-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 168, 255, 0.2);
    background: linear-gradient(90deg, 
        rgba(0, 168, 255, 0.1) 0%, 
        rgba(0, 168, 255, 0.05) 50%, 
        rgba(0, 168, 255, 0.1) 100%);
}

.item-selector-header h3 {
    color: rgba(0, 168, 255, 0.9);
    font-size: 1.5rem;
    margin: 0;
    font-weight: 700;
}

.close-selector {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 8px;
}

.close-selector:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

/* Filtres */
.item-filters {
    padding: 1rem 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.item-search {
    flex: 1;
}

.item-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 168, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.item-search-input:focus {
    outline: none;
    border-color: rgba(0, 168, 255, 0.6);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.2);
}

.item-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.category-filter {
    min-width: 200px;
}

.category-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 168, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-select:focus {
    outline: none;
    border-color: rgba(0, 168, 255, 0.6);
    box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.2);
}

.category-select option {
    background: rgba(20, 25, 35, 0.98);
    color: white;
}

/* Informations */
.items-info {
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.items-count {
    font-weight: 600;
}

.items-pagination-info {
    color: rgba(0, 168, 255, 0.8);
}

/* Grille d'items */
.items-grid {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.item-card {
    background: linear-gradient(135deg, 
        rgba(30, 30, 40, 0.9) 0%, 
        rgba(40, 40, 50, 0.9) 100%);
    border: 2px solid rgba(0, 168, 255, 0.3);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.item-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(0, 168, 255, 0.6) 50%,
        transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.item-card:hover {
    border-color: rgba(0, 168, 255, 0.6);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.item-card:hover::before {
    opacity: 1;
}

.item-card.selected {
    border-color: rgba(0, 168, 255, 0.8);
    background: linear-gradient(135deg, 
        rgba(0, 168, 255, 0.2) 0%, 
        rgba(30, 30, 40, 0.9) 100%);
    transform: translateY(-2px);
}

.item-card.selected::before {
    opacity: 1;
    background: linear-gradient(90deg, 
        rgba(0, 168, 255, 0.8) 0%,
        rgba(100, 200, 255, 0.8) 50%,
        rgba(0, 168, 255, 0.8) 100%);
}

.item-image {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    border: 2px solid rgba(0, 168, 255, 0.3);
    transition: all 0.3s ease;
}

.item-card:hover .item-image {
    border-color: rgba(0, 168, 255, 0.6);
    transform: scale(1.05);
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-info {
    width: 100%;
}

.item-name {
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
}

.item-category-tag {
    background: rgba(0, 168, 255, 0.2);
    color: rgba(0, 168, 255, 0.9);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(0, 168, 255, 0.3);
}

/* Pagination */
.pagination-controls {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pagination-btn {
    background: rgba(0, 168, 255, 0.2);
    border: 1px solid rgba(0, 168, 255, 0.4);
    color: rgba(0, 168, 255, 0.9);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(0, 168, 255, 0.3);
    border-color: rgba(0, 168, 255, 0.6);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-numbers {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pagination-number {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

.pagination-number:hover {
    background: rgba(0, 168, 255, 0.2);
    border-color: rgba(0, 168, 255, 0.4);
    color: rgba(0, 168, 255, 0.9);
}

.pagination-number.active {
    background: rgba(0, 168, 255, 0.4);
    border-color: rgba(0, 168, 255, 0.6);
    color: white;
}

.pagination-dots {
    color: rgba(255, 255, 255, 0.5);
    padding: 0 0.5rem;
}

/* Actions */
.selector-actions {
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cancel-selection {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: rgba(255, 107, 107, 0.9);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.cancel-selection:hover {
    background: rgba(255, 107, 107, 0.3);
    border-color: rgba(255, 107, 107, 0.6);
}

.confirm-selection {
    background: rgba(0, 168, 255, 0.2);
    border: 1px solid rgba(0, 168, 255, 0.4);
    color: rgba(0, 168, 255, 0.9);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.confirm-selection:hover:not(:disabled) {
    background: rgba(0, 168, 255, 0.3);
    border-color: rgba(0, 168, 255, 0.6);
    color: white;
}

.confirm-selection:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .item-selector-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .item-filters {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .category-filter {
        min-width: auto;
        width: 100%;
    }
    
    .items-grid {
        grid-template-columns: repeat(2, 1fr); /* Forcer 2 colonnes sur mobile */
        gap: 0.5rem;
        padding: 0.75rem;
        max-height: 50vh; /* Limiter la hauteur pour éviter débordement */
    }
    
    .item-card {
        padding: 0.75rem;
        min-height: auto;
    }
    
    .item-image {
        width: 48px;
        height: 48px;
    }
    
    .item-name {
        font-size: 0.8rem;
    }
    
    .selector-actions {
        flex-direction: column;
        padding: 1rem;
    }
    
    .selector-actions button {
        width: 100%;
    }
    
    .pagination-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .pagination-btn {
        padding: 0.5rem;
        font-size: 0.85rem;
        min-width: 70px;
    }
    
    .pagination-numbers {
        gap: 0.25rem;
        flex-wrap: wrap;
    }
    
    .pagination-number {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
        min-width: 35px;
    }
    
    .items-info {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
}