/* ========================================================================
   STYLES POUR LE TABLEAU DES FICHES INFOS MÉDICAMENTS - FRONTEND
   ======================================================================== */

.fiches-medicaments-container {
    margin: 20px 0;
}

/* Contrôles de recherche et filtres */
.fiches-controls {
    margin-bottom: 20px;
}

.fiches-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.fiches-controls .search-input-container {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

.fiches-controls .search-input-container .search-input {
    flex: 1;
    padding: 12px 45px 12px 16px;
    border: 1px solid #ddd;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}


.fiches-controls .search-button {
    position: absolute;
    right: 12px;
    background: none !important;
    border: none;
    color: #ababab !important;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fiches-controls .search-button:hover {
    color: var(--uicore-primary-color, #3B9E35) !important;
}

.fiches-controls .filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 19px 20px;
    border: 1px solid #ddd;
    background-color: white;
    color: #555;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: all 0.2s;
    font-weight: 500;
}

.fiches-controls .filter-toggle-btn:hover {
    background: #e9ecef;
    border-color: var(--uicore-primary-color, #3B9E35);
    color: var(--uicore-primary-color, #3B9E35);
}

/* Modal des filtres */
.filter-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

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

.filter-modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
}

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

.filter-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}

.filter-modal-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.filter-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #aaa;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.filter-close-btn:hover {
    color: #333;
    background: #f0f0f0;
}

.filter-modal-body {
    padding: 25px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.filter-select,
.filter-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--uicore-primary-color, #3B9E35);
}

.filter-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.apply-btn {
    padding: 10px 24px;
    background: var(--uicore-primary-color, #3B9E35);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.apply-btn:hover {
    opacity: 0.9;
}

.reset-btn {
    padding: 10px 24px;
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: #e9ecef;
}

/* Tableau responsive */
.table-responsive {
    overflow-x: auto;
}

.fiches-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    line-height: 1.5;
    background: white;
}

.fiches-table .pdf-link,
.fiches-table .custom-link {
    font-size: 13px;
    color: var(--uicore-primary-color, #3B9E35);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.fiches-table .pdf-link:hover,
.fiches-table .custom-link:hover {
    background: #f0f7f0;
    text-decoration: none;
}

.fiches-table th {
    background: var(--uicore-primary-color, #3B9E35);
    color: white;
    font-weight: 600;
    padding: 16px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    min-width: 100px;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s;
}

.sortable-header:hover {
    background: #2b7d26;
}

.sort-indicator {
    font-size: 11px;
    margin-left: 5px;
    opacity: 0.7;
}

.sortable-header.sort-asc .sort-indicator::after {
    content: ' ↑';
    opacity: 1;
}

.sortable-header.sort-desc .sort-indicator::after {
    content: ' ↓';
    opacity: 1;
}

.fiches-table td {
    padding: 14px;
    border: 1px solid #e1e1e1;
    vertical-align: middle;
    word-wrap: break-word;
}

.fiches-table tbody tr {
    transition: background-color 0.2s;
}

.fiches-table tbody tr:hover {
    background-color: #f8f9fa;
}

.fiches-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.fiches-table tbody tr:nth-child(even):hover {
    background-color: #f0f0f0;
}

/* Badge de catégorie */
.category-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.no-file {
    color: #adb5bd;
    font-style: italic;
    font-size: 13px;
}

.text-center {
    text-align: center;
}

/* Pagination */
.fiches-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
    padding: 20px;
    background: white;
    border-radius: 8px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--uicore-primary-color, #3B9E35);
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination-btn:hover {
    opacity: 0.9;
    text-decoration: none;
    transform: translateY(-1px);
}

.pagination-info {
    font-weight: 500;
    color: #495057;
    font-size: 15px;
}

/* Informations du tableau */
.fiches-info {
    margin-top: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    color: #6c757d;
}

.fiches-info p {
    margin: 0;
}

.fiches-info strong {
    color: var(--uicore-primary-color, #3B9E35);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .fiches-search {
        flex-direction: column;
        align-items: stretch;
    }
    
    .fiches-controls .filter-toggle-btn {
        justify-content: center;
        width: 100%;
    }
    
    .filter-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .fiches-table {
        font-size: 12px;
    }
    
    .fiches-table th,
    .fiches-table td {
        padding: 10px 8px;
        min-width: 80px;
    }
    
    .fiches-table th {
        font-size: 11px;
    }
    
    .search-input {
        font-size: 16px; /* Éviter le zoom sur iOS */
    }
    
    .pagination-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .fiches-pagination {
        flex-direction: column;
        gap: 10px;
    }
    
    .pagination-info {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .fiches-table th,
    .fiches-table td {
        font-size: 11px;
        padding: 8px 6px;
    }
    
    .category-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .pdf-link svg,
    .custom-link svg {
        width: 16px;
        height: 16px;
    }
}

/* Animation du chargement */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fiches-table tbody tr {
    animation: fadeIn 0.3s ease-out;
}
