/* ===================================
   DESIGN PROFESSIONNEL ADMIN PORTAL
   ================================ === */

/* Variables de couleurs professionnelles */
:root {
    --primary-color: #4F46E5;
    --primary-dark: #4338CA;
    --secondary-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --info-color: #3B82F6;
    --dark-color: #1F2937;
    --light-bg: #F9FAFB;
    --card-bg: #FFFFFF;
    --border-color: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Fond général plus agréable */
body {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Cartes modernes et élégantes */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-bottom: none;
    border-radius: 12px 12px 0 0 !important;
    padding: 20px 24px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: white !important;
    margin: 0;
}

/* Breadcrumb élégant */
.breadcrumb {
    background: var(--card-bg);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    color: var(--primary-dark);
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* Tables modernes et professionnelles */
.table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.table-responsive {
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.table thead {
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
}

.table thead th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding: 16px;
}

.table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #F3F4F6;
}

.table tbody tr:hover {
    background: #F9FAFB;
    transform: scale(1.01);
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    color: var(--text-primary);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #F9FAFB;
}

.table-hover tbody tr:hover {
    background-color: #F3F4F6 !important;
}

/* Badges professionnels */
.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}

.badge.bg-success, .badge.bg-primary, .badge.bg-danger, .badge.bg-warning, .badge.bg-info {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bg-success {
    background-color: var(--secondary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.bg-info {
    background-color: var(--info-color) !important;
}

/* Boutons modernes et attractifs */
.btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #3730A3 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #DC2626 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #D97706 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #2563EB 100%);
    color: white;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline-danger {
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger-color);
    color: white;
}

.btn-outline-info {
    border: 2px solid var(--info-color);
    color: var(--info-color);
    background: transparent;
}

.btn-outline-info:hover {
    background: var(--info-color);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-group {
    gap: 4px;
}

/* Input et formulaires élégants */
.form-control, .form-select {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.input-group {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.input-group .form-control {
    border-right: none;
}

.input-group .btn {
    border-radius: 0;
}

/* Alertes modernes */
.alert {
    border: none;
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: var(--shadow-md);
    border-left: 4px solid;
}

.alert-success {
    background-color: #D1FAE5;
    border-left-color: var(--secondary-color);
    color: #065F46;
}

.alert-danger {
    background-color: #FEE2E2;
    border-left-color: var(--danger-color);
    color: #991B1B;
}

.alert-warning {
    background-color: #FEF3C7;
    border-left-color: var(--warning-color);
    color: #92400E;
}

.alert-info {
    background-color: #DBEAFE;
    border-left-color: var(--info-color);
    color: #1E40AF;
}

/* Pagination élégante */
.pagination {
    gap: 8px;
}

.page-item .page-link {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 8px 16px;
    transition: all 0.2s;
    margin: 0 4px;
}

.page-item .page-link:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.page-item.disabled .page-link {
    background: #F3F4F6;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* Modal moderne */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    padding: 20px 24px;
}

.modal-title {
    font-weight: 600;
    font-size: 1.25rem;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 20px 24px;
}

.btn-close {
    filter: brightness(0) invert(1);
}

/* Images dans les tableaux */
.img-thumbnail {
    border-radius: 8px;
    border: 2px solid var(--border-color);
    padding: 4px;
    background: white;
    transition: all 0.3s ease;
}

.img-thumbnail:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

/* Spinner moderne */
.spinner-border {
    border-width: 3px;
}

/* États vides élégants */
.text-center i.fa-3x,
.text-center .bi[style*="font-size: 3rem"] {
    color: #9CA3AF !important;
    opacity: 0.5;
}

/* Titres de page */
h1, .h1 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 16px;
}

/* Responsive design professionnel - Version étendue */
@media (max-width: 768px) {
    /* Espacement général réduit */
    body {
        padding: 8px;
    }
    
    .container-fluid {
        padding: 0 8px;
    }
    
    /* En-têtes de carte compacts */
    .card-header {
        padding: 12px 16px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    /* Boutons pleine largeur sur mobile (sauf dans les tableaux) */
    .btn:not(.btn-group .btn):not(.table .btn) {
        width: 100%;
        margin-bottom: 8px;
    }
    
    /* Groupes de boutons en ligne pour les actions */
    .btn-group:not(.table .btn-group) {
        display: flex;
        flex-direction: row;
        gap: 8px;
        width: 100%;
    }
    
    .btn-group:not(.table .btn-group) .btn {
        flex: 1;
        margin-bottom: 0;
    }
    
    /* Amélioration de la barre d'actions */
    .d-flex.justify-content-between.mb-3,
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px;
    }
    
    /* Recherche pleine largeur */
    .input-group {
        width: 100% !important;
    }
    
    /* Filtres empilés */
    .row > div[class*="col-"] {
        margin-bottom: 12px;
    }
}

/* Amélioration pour petits écrans (mobiles en portrait) */
@media (max-width: 575px) {
    /* Typographie adaptée */
    body {
        font-size: 14px;
    }
    
    /* Boutons avec texte plus court */
    .btn {
        font-size: 0.875rem;
        padding: 8px 16px;
    }
    
    /* Alertes compactes */
    .alert {
        padding: 12px 16px;
        font-size: 0.875rem;
    }
    
    /* Container sans padding sur très petits écrans */
    .container-fluid {
        padding: 0 4px;
    }
}

/* Animation de chargement */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease;
}

/* Effet hover sur les cartes */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

/* Label des formulaires */
.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Amélioration du container principal */
.container-fluid {
    max-width: 1400px;
    margin: 0 auto;
}

/* Amélioration des icônes */
i.bi, i.fas, i.oi {
    margin-right: 6px;
}

/* Style pour les lignes de données mobiles - Mode Card */
@media (max-width: 767px) {
    /* Masquer les en-têtes de tableau */
    .table thead {
        display: none;
    }
    
    /* Transformer chaque ligne en carte */
    .table, .table tbody {
        display: block;
        width: 100%;
    }
    
    .table tbody tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 16px;
        box-shadow: var(--shadow-md);
        background: white;
        transition: all 0.3s ease;
    }
    
    .table tbody tr:hover {
        box-shadow: var(--shadow-lg);
        transform: translateY(-2px);
    }
    
    /* Chaque cellule devient une ligne */
    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 10px 0;
        border-bottom: 1px solid #F3F4F6;
        gap: 12px;
        text-align: right;
    }
    
    .table tbody td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .table tbody td:first-child {
        padding-top: 0;
    }
    
    /* Label pour chaque donnée */
    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-primary);
        font-size: 0.875rem;
        text-align: left;
        flex: 0 0 40%;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }
    
    /* Le contenu de la cellule */
    .table tbody td > * {
        text-align: right;
        flex: 1;
    }
    
    /* Images dans les cellules mobiles */
    .table tbody td img {
        max-width: 80px;
        height: auto;
        margin-left: auto;
    }
    
    /* Badges dans les cellules mobiles */
    .table tbody td .badge {
        margin-left: auto;
        display: inline-block;
    }
    
    /* Boutons d'action en mobile */
    .table tbody td .btn-group {
        display: flex;
        flex-direction: row;
        gap: 6px;
        margin-left: auto;
        width: auto;
    }
    
    .table tbody td .btn-group .btn {
        width: auto;
        padding: 8px 12px;
        font-size: 0.75rem;
        margin-bottom: 0;
    }
    
    .table tbody td .btn-sm {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
    
    /* Checkboxes en mobile */
    .table tbody td input[type="checkbox"] {
        margin-left: auto;
        transform: scale(1.3);
    }
    
    /* Formulaires dans les cellules */
    .table tbody td .form-control,
    .table tbody td .form-select {
        max-width: 150px;
        margin-left: auto;
        font-size: 0.875rem;
    }
    
    /* Alignement du contenu texte */
    .table tbody td {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Responsive pour tablettes (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .table thead th {
        font-size: 0.75rem;
        padding: 12px 8px;
    }
    
    .table tbody td {
        font-size: 0.875rem;
        padding: 12px 8px;
    }
    
    .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    .badge {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}

/* Amélioration des cartes en mobile */
@media (max-width: 767px) {
    .card {
        border-radius: 10px;
        margin-bottom: 16px;
    }
    
    .card-header {
        padding: 12px 16px;
        font-size: 1rem;
    }
    
    .card-body {
        padding: 16px;
    }
    
    /* Pagination en mobile */
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
    }
    
    .page-item .page-link {
        padding: 6px 12px;
        font-size: 0.875rem;
        margin: 2px;
    }
    
    /* Modals en mobile */
    .modal-dialog {
        margin: 10px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    /* Formulaires en mobile */
    .form-label {
        font-size: 0.875rem;
    }
    
    .form-control,
    .form-select {
        font-size: 0.875rem;
    }
    
    /* Breadcrumb en mobile */
    .breadcrumb {
        font-size: 0.875rem;
        padding: 10px 12px;
    }
    
    /* Titres en mobile */
    h1, .h1 {
        font-size: 1.5rem;
    }
    
    h2, .h2 {
        font-size: 1.25rem;
    }
    
    h3, .h3 {
        font-size: 1.1rem;
    }
}

/* Améliorations supplémentaires pour un look plus professionnel */
.text-muted {
    color: var(--text-secondary) !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
