/**
 * UI/UX Enhancements - Améliorations globales pour l'intranet DTISI
 * Compatible avec le thème sombre bleu nuit (#000060)
 * IMPORTANT: Utilise les variables CSS de dark-theme.css
 * IMPORTANT: Pas de dégradés violets, couleurs neutres uniquement
 */

/* ========================================
   1. ANIMATIONS ET TRANSITIONS
   ======================================== */

/* Animation d'apparition douce pour les pages */
.container-fluid, .container {
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   2. AMÉLIORATIONS DES CARTES
   ======================================== */

.card {
    border-radius: 8px !important;
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1)) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: var(--bg-card, rgba(0, 0, 80, 0.4)) !important;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-header {
    border-bottom: 1px solid var(--border-light, rgba(255, 255, 255, 0.1)) !important;
    border-radius: 8px 8px 0 0 !important;
    /* Garde le background défini par dark-theme.css */
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    border-top: 1px solid var(--border-light, rgba(255, 255, 255, 0.1)) !important;
    background-color: rgba(0, 0, 50, 0.3) !important;
}

/* ========================================
   3. AMÉLIORATIONS DES BOUTONS
   ======================================== */

.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Effet ripple subtil */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* ========================================
   4. AMÉLIORATIONS DES TABLEAUX
   ======================================== */

/* En-têtes de tableaux */
.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    padding: 0.875rem 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    /* Garde le background défini par dark-theme.css ou DataTables */
}

/* Lignes de tableau avec effet hover */
.table tbody tr {
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.table tbody tr:hover {
    transform: scale(1.005);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Cellules de tableau */
.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

/* DataTables wrapper */
.dataTables_wrapper {
    padding: 0.5rem;
}

.dataTables_filter input,
.dataTables_length select {
    border-radius: 6px;
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    padding: 0.4rem 0.75rem;
    background-color: var(--bg-input, rgba(0, 0, 60, 0.5));
    color: var(--text-primary, #f0f0f0);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dataTables_filter input:focus,
.dataTables_length select:focus {
    border-color: var(--color-primary-border, rgba(93, 173, 226, 0.4));
    box-shadow: 0 0 0 0.2rem rgba(93, 173, 226, 0.15);
    outline: none;
}

/* Pagination */
.pagination {
    gap: 0.25rem;
}

.page-link {
    border-radius: 6px;
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    margin: 0 0.125rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.page-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ========================================
   5. AMÉLIORATIONS DES FORMULAIRES
   ======================================== */

.form-control,
.form-select,
textarea.form-control {
    border-radius: 6px;
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    padding: 0.625rem 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
    background-color: var(--bg-input, rgba(0, 0, 60, 0.5));
    color: var(--text-primary, #f0f0f0);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary-border, rgba(93, 173, 226, 0.4));
    box-shadow: 0 0 0 0.2rem rgba(93, 173, 226, 0.15);
    transform: translateY(-1px);
    outline: none;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-tertiary, #d0d0d0);
    font-size: 0.9rem;
}

/* Input groups */
.input-group {
    border-radius: 6px;
}

.input-group-text {
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    background-color: rgba(0, 0, 70, 0.5);
    color: var(--text-secondary, #b0b0b0);
}

/* ========================================
   6. BADGES MODERNES
   ======================================== */

.badge {
    border-radius: 4px;
    padding: 0.3rem 0.65rem;
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.3px;
}

.badge-pill {
    border-radius: 50rem;
}

/* ========================================
   7. ALERTS AMÉLIORÉES
   ======================================== */

.alert {
    border-radius: 8px;
    border-left: 4px solid;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-dismissible .btn-close {
    padding: 1rem 1.25rem;
}

/* ========================================
   8. MODALS AMÉLIORÉS
   ======================================== */

.modal-content {
    border-radius: 12px;
    border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.2));
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    background-color: var(--bg-secondary, #000050);
}

.modal-header {
    border-bottom: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    border-radius: 12px 12px 0 0;
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: var(--text-primary, #f0f0f0);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    padding: 1rem 1.5rem;
}

/* Animation d'ouverture */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
}

.modal.show .modal-dialog {
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================
   9. BREADCRUMBS
   ======================================== */

.breadcrumb {
    background: transparent;
    padding: 0.625rem 0;
    margin-bottom: 1.25rem;
    border-radius: 6px;
}

.breadcrumb-item {
    font-size: 0.875rem;
    color: var(--text-secondary, #b0b0b0);
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.1rem;
    color: var(--text-secondary, #b0b0b0);
}

.breadcrumb-item.active {
    color: var(--text-primary, #f0f0f0);
    font-weight: 500;
}

.breadcrumb-item a {
    color: var(--color-primary-text, #5dade2);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: #7ec8f0;
    text-decoration: underline;
}

/* ========================================
   10. TOOLTIPS
   ======================================== */

.tooltip-inner {
    background-color: rgba(0, 0, 40, 0.95);
    border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.2));
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-size: 0.85rem;
}

/* ========================================
   11. PROGRESS BARS
   ======================================== */

.progress {
    height: 1.125rem;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.progress-bar {
    border-radius: 6px;
    transition: width 0.6s ease;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ========================================
   12. SPINNERS
   ======================================== */

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner-border,
.spinner-grow {
    animation: spin 0.75s linear infinite;
}

/* ========================================
   13. HEADERS DE PAGE
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary, #f0f0f0);
}

h1 {
    font-size: 1.875rem;
    margin-bottom: 1.25rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

/* Titre avec icône */
h1 i, h2 i, h3 i, h4 i {
    margin-right: 0.5rem;
    opacity: 0.85;
}

/* ========================================
   14. NAVIGATION TABS
   ======================================== */

.nav-tabs {
    border-bottom: 2px solid var(--border-light, rgba(255, 255, 255, 0.1));
    margin-bottom: 1.25rem;
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 6px 6px 0 0;
    padding: 0.625rem 1.25rem;
    color: var(--text-secondary, #b0b0b0);
    transition: color 0.2s ease, background-color 0.2s ease;
    margin-bottom: -2px;
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary, #f0f0f0);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-tabs .nav-link.active {
    color: var(--color-primary-text, #5dade2);
    background-color: rgba(0, 123, 255, 0.1);
    border-bottom: 2px solid var(--color-primary-text, #5dade2);
    font-weight: 500;
}

/* ========================================
   15. SCROLLBAR PERSONNALISÉE
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 60, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(93, 173, 226, 0.4);
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 60, 0.3);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(93, 173, 226, 0.6);
}

/* ========================================
   16. UTILITAIRES PERSONNALISÉS
   ======================================== */

/* Ombre douce */
.shadow-soft {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

/* Ombre forte */
.shadow-strong {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

/* Bordure avec couleur du thème */
.border-themed {
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1)) !important;
}

/* Fond légèrement élevé */
.bg-elevated {
    background-color: rgba(0, 0, 70, 0.4) !important;
}

/* ========================================
   17. RESPONSIVE IMPROVEMENTS
   ======================================== */

@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
        border-radius: 6px !important;
    }

    .btn {
        font-size: 0.875rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .table {
        font-size: 0.85rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }
}

/* ========================================
   18. FOCUS VISIBLE (Accessibilité)
   ======================================== */

*:focus-visible {
    outline: 2px solid var(--color-primary-text, #5dade2);
    outline-offset: 2px;
}

/* ========================================
   19. PRINT STYLES
   ======================================== */

@media print {
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .btn,
    .pagination,
    .breadcrumb,
    nav {
        display: none;
    }

    body {
        background-color: white;
        color: black;
    }
}
