/**
 * UI Components - Shared Styles
 * Common styles for list views across the admin interface
 * Brand color: #f4744e
 */

/* ==========================================================================
   Layout & Container
   ========================================================================== */

.container_list {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

/* ==========================================================================
   Header Section
   ========================================================================== */

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f4744e 0%, #d95a3b 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 15px rgba(244, 116, 78, 0.3);
}

.list-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */

.addBlock,
.addDocument {
    display: flex;
    gap: 12px;
    align-items: center;
}

.addBlock .form-group,
.addDocument .form-group {
    margin: 0;
}

.addBlock #id_name,
.addDocument #id_name {
    min-width: 300px;
    padding: 10px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
}

.addBlock #id_name:focus,
.addDocument #id_name:focus {
    outline: none;
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.btn-create {
    background: white;
    color: #f4744e;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-create:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Filters Section
   ========================================================================== */

.filters-section {
    background: white !important;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.filters-section .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filters-section .form-control {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.filters-section .form-control:focus {
    border-color: #f4744e;
    box-shadow: 0 0 0 3px rgba(244, 116, 78, 0.15);
    outline: none;
}

.filters-section .btn-secondary {
    background: #6c757d;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    color: white;
    transition: all 0.2s ease;
}

.filters-section .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* ==========================================================================
   Table Styling
   ========================================================================== */

.table-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

#blocListTable,
#blocListDocument {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
}

#blocListTable thead,
#blocListDocument thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

#blocListTable thead th,
#blocListDocument thead th {
    padding: 16px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border: none;
}

#blocListTable tbody tr,
#blocListDocument tbody tr {
    border-bottom: 1px solid #f1f3f5;
    transition: all 0.2s ease;
}

#blocListTable tbody tr:hover,
#blocListDocument tbody tr:hover {
    background: #fafbfc;
    transform: scale(1.002);
}

#blocListTable tbody td,
#blocListDocument tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    color: #212529;
}

#blocListDocument tbody td a {
    color: #f4744e;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

#blocListDocument tbody td a:hover {
    color: #d95a3b;
    text-decoration: underline;
}

/* ==========================================================================
   Badges & Status
   ========================================================================== */

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

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-primary {
    background: #e3f2fd;
    color: #1976d2;
}

.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #e3f2fd;
    color: #1976d2;
}

.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    margin-left: 6px;
}

.status-icon.success {
    background: #d4edda;
    color: #28a745;
}

/* ==========================================================================
   Action Buttons
   ========================================================================== */

.action-btn,
.document-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-right: 6px;
    text-decoration: none;
}

.action-btn:last-child,
.document-actions a:last-child {
    margin-right: 0;
}

/* Edit button */
.action-btn-edit,
.document-actions a[title="Modifier"] {
    background: #e3f2fd;
    color: #1976d2;
}

.action-btn-edit:hover,
.document-actions a[title="Modifier"]:hover {
    background: #1976d2;
    color: white;
}

/* Copy/Duplicate button */
.action-btn-copy,
.document-actions a[title="Dupliquer"] {
    background: #fff3e0;
    color: #f57c00;
}

.action-btn-copy:hover,
.document-actions a[title="Dupliquer"]:hover {
    background: #f57c00;
    color: white;
}

/* Clipboard button */
.document-actions a[title="Copier"] {
    background: #e3f2fd;
    color: #1976d2;
}

.document-actions a[title="Copier"]:hover {
    background: #1976d2;
    color: white;
}

/* Delete button */
.action-btn-delete,
.document-actions a[title="Supprimer"] {
    background: #ffebee;
    color: #d32f2f;
}

.action-btn-delete:hover,
.document-actions a[title="Supprimer"]:hover {
    background: #d32f2f;
    color: white;
}

.id_to_copy {
    font-size: 0px;
}

/* ==========================================================================
   DataTables Customization
   ========================================================================== */

div.dt-container {
    padding: 24px;
}

div.dt-container .dt-paging .dt-paging-button {
    padding: 8px 16px;
    margin: 0 4px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

div.dt-container .dt-paging .dt-paging-button:hover {
    background: #f4744e;
    color: white;
    border-color: #f4744e;
}

div.dt-container .dt-paging .dt-paging-button.current {
    background: #1f7b9c;
    color: white !important;
    border-color: #1f7b9c;
}

div.dt-container .dt-length select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

div.dt-container .dt-search input {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    margin-left: 8px;
}

.dataTables_empty {
    text-align: center;
    padding: 40px !important;
    color: #6c757d;
    font-size: 14px;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.toast-notification.success {
    background: #28a745;
    color: white;
}

.toast-notification.error {
    background: #dc3545;
    color: white;
}

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

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .list-header {
        flex-direction: column;
        gap: 16px;
    }

    .addBlock,
    .addDocument {
        flex-direction: column;
        width: 100%;
    }

    .addBlock #id_name,
    .addDocument #id_name {
        min-width: 100%;
    }

    .btn-create {
        width: 100%;
        justify-content: center;
    }

    .filters-section .row > div {
        margin-bottom: 12px;
    }
}
