/**
 * Styles pour le système de gestion de données génériques
 */

/* Container principal */
.datas-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Filtres et recherche */
.datas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.datas-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #495057;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.filter-btn:hover {
    background-color: #e9ecef;
}

.filter-btn.active {
    background-color: #3498db;
    color: #fff;
    border-color: #3498db;
}

.datas-search {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 14px;
    min-width: 250px;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 10px;
    background-color: #6c757d;
    margin-left: 6px;
}

.filter-btn.active .badge {
    background-color: rgba(255, 255, 255, 0.8);
    color: #3498db;
}

/* Liste d'éléments */
.datas-list {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.datas-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.datas-list-title {
    font-size: 16px;
    font-weight: 600;
    color: #343a40;
    margin: 0;
}

.datas-list-actions {
    display: flex;
    gap: 10px;
}

.datas-items-container {
    overflow-y: auto;
    padding: 10px;
}

/* Items individuels */
.datas-item {
    background-color: #fff;
    border-radius: 6px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    overflow: hidden;
    border: 1px solid #f1f1f1;
}

.datas-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #e9ecef;
}

.datas-item-content {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    position: relative;
}

.datas-item-avatar,
.datas-item-icon {
    width: 40px;
    height: 40px;
    background-color: #f8f9fa;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.datas-item-avatar i,
.datas-item-icon i {
    font-size: 18px;
    color: #6c757d;
}

.datas-item-info {
    flex: 1;
    min-width: 0;
}

.datas-item-name,
.datas-item-title {
    font-size: 15px;
    font-weight: 600;
    color: #343a40;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.datas-item-details {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: #6c757d;
}

.datas-item-email,
.datas-item-phone,
.datas-item-category {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.datas-item-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

/* Badges de statut */
.status-active {
    background-color: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.status-inactive {
    background-color: rgba(189, 195, 199, 0.1);
    color: #7f8c8d;
}

.status-online,
.status-available {
    background-color: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.status-offline {
    background-color: rgba(189, 195, 199, 0.1);
    color: #7f8c8d;
}

.status-busy {
    background-color: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

.status-pending {
    background-color: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.status-progress {
    background-color: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

.status-resolved {
    background-color: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

/* Badges de priorité */
.priority-low {
    background-color: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.priority-medium {
    background-color: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

.priority-high {
    background-color: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.priority-urgent {
    background-color: rgba(192, 57, 43, 0.1);
    color: #c0392b;
    font-weight: 700;
}

.admin-badge {
    background-color: rgba(155, 89, 182, 0.1);
    color: #9b59b6;
}

.license-badge {
    background-color: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

/* Boutons d'action */
.datas-actions {
    display: flex;
    gap: 8px;
    margin-left: 15px;
}

.list-view-btn,
.list-edit-btn,
.list-delete-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-view-btn {
    color: #3498db;
}

.list-view-btn:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.list-edit-btn {
    color: #f39c12;
}

.list-edit-btn:hover {
    background-color: rgba(243, 156, 18, 0.1);
}

.list-delete-btn {
    color: #e74c3c;
}

.list-delete-btn:hover {
    background-color: rgba(231, 76, 60, 0.1);
}

/* États vides, chargement et erreur */
#datas-loading,
.datas-loading,
.datas-empty,
.datas-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

#datas-loading i,
#datas-loading .datas-loading i,
#datas-empty i,
#datas-empty .datas-empty i,
#datas-error i,
#datas-error .datas-error i,
.datas-loading i,
.datas-loading .datas-loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    animation: spin 1s linear infinite;
    color: #3498db;
}

#datas-loading i,
#datas-loading .datas-loading i {
    color: #3498db;
}

#datas-empty i,
#datas-empty .datas-empty i {
    color: #7f8c8d;
}

.datas-error i {
    color: #e74c3c;
}

#datas-loading p,
#datas-loading .datas-loading p,
#datas-empty p,
#datas-empty .datas-empty p,
#datas-error p,
#datas-error .datas-error p {
    color: #6c757d;
    font-size: 15px;
    margin: 0;
}

/* Panneau d'entité */
.entity-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background-color: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.entity-panel.open {
    right: 0;
}

.entity-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.entity-panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #343a40;
    display: flex;
    align-items: center;
    gap: 8px;
}

.entity-panel-header h3 i {
    font-size: 16px;
}

.entity-panel-close {
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    transition: all 0.2s;
}

.entity-panel-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #343a40;
}

.entity-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.entity-panel-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

/* Détails de l'entité */
.entity-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.entity-header {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

.entity-avatar,
.entity-icon {
    width: 60px;
    height: 60px;
    background-color: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.entity-avatar i,
.entity-icon i {
    font-size: 28px;
    color: #6c757d;
}

.entity-title {
    flex: 1;
}

.entity-title h2 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
    color: #343a40;
}

.entity-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.entity-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.entity-section {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.entity-section h3 {
    margin: 0 0 15px;
    font-size: 16px;
    font-weight: 600;
    color: #343a40;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.entity-field {
    display: flex;
    margin-bottom: 12px;
}

.entity-field:last-child {
    margin-bottom: 0;
}

.field-label {
    width: 140px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.field-value {
    flex: 1;
    color: #343a40;
    font-size: 14px;
}

.field-value.description {
    white-space: pre-line;
}

.entity-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1060;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 10vh auto;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    position: relative;
    animation: modalFadeIn 0.3s;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.modal-header.primary {
    background-color: #3498db;
    color: #fff;
}

.modal-header.danger {
    background-color: #e74c3c;
    color: #fff;
}

.modal-header.success {
    background-color: #2ecc71;
    color: #fff;
}

.modal-header.warning {
    background-color: #f39c12;
    color: #fff;
}

.modal-header.info {
    background-color: #3498db;
    color: #fff;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

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

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

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Formulaires */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #495057;
}

.form-control {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

/* Boutons */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 4px;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    color: #fff;
    background-color: #3498db;
    border-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
}

.btn-danger {
    color: #fff;
    background-color: #e74c3c;
    border-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
    border-color: #c0392b;
}

.btn-success {
    color: #fff;
    background-color: #2ecc71;
    border-color: #2ecc71;
}

.btn-success:hover {
    background-color: #27ae60;
    border-color: #27ae60;
}

.btn-warning {
    color: #fff;
    background-color: #f39c12;
    border-color: #f39c12;
}

.btn-warning:hover {
    background-color: #d35400;
    border-color: #d35400;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Toasts */
#toastContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1070;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    width: 300px;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: toastIn 0.3s;
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.toast-hide {
    animation: toastOut 0.3s;
}

@keyframes toastOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f1f1f1;
}

.toast-header i {
    margin-right: 8px;
}

.toast-info i {
    color: #3498db;
}

.toast-success i {
    color: #2ecc71;
}

.toast-error i {
    color: #e74c3c;
}

.toast-warning i {
    color: #f39c12;
}

.toast-header strong {
    flex: 1;
    font-weight: 600;
}

.toast-close {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
}

.toast-close:hover {
    color: #343a40;
}

.toast-body {
    padding: 12px 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .datas-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .datas-search {
        width: 100%;
    }
    
    .search-input {
        flex: 1;
    }
    
    .entity-panel {
        width: 100%;
        right: -100%;
    }
    
    .modal-content {
        width: 95%;
        margin-top: 5vh;
    }
    
    .datas-item-content {
        flex-wrap: wrap;
    }
    
    .datas-item-info {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .datas-actions {
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
        margin-top: 10px;
    }
    
    .entity-field {
        flex-direction: column;
    }
    
    .field-label {
        width: 100%;
        margin-bottom: 4px;
    }
}

/* Ajuster le card-header pour mettre les actions à droite */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

/* Style pour les actions dans le header */
.card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Style pour la zone de recherche */
.search-box {
    display: flex;
    align-items: center;
    position: relative;
    margin-right: 10px;
}

.search-input {
    padding: 6px 30px 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s;
    width: 180px;
}

.search-input:focus {
    width: 220px;
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.search-icon {
    position: absolute;
    right: 10px;
    color: #6c757d;
    font-size: 14px;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 30px;
    color: #6c757d;
    font-size: 12px;
    cursor: pointer;
    display: none;
    background: none;
    border: none;
    padding: 0;
}

.search-input:not(:placeholder-shown) + .search-clear {
    display: block;
}