/* ===== RESPONSIVE GLOBAL CSS FOR LARAVEL PROJECT ===== */

/* === BREAKPOINTS BOOTSTRAP === */
/* xs: <576px */
/* sm: ≥576px */
/* md: ≥768px */
/* lg: ≥992px */
/* xl: ≥1200px */
/* xxl: ≥1400px */

/* ===== CONTAINER & LAYOUT ===== */
.container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

@media (max-width: 575.98px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* ===== CARDS RESPONSIVE ===== */
.card {
    margin-bottom: 1.5rem;
}

@media (max-width: 767.98px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 575.98px) {
    .card-body {
        padding: 0.75rem;
    }
    
    .card-header {
        padding: 0.5rem 0.75rem;
    }
}

/* ===== TABLEAUX RESPONSIVE ===== */
.table-responsive {
    border: none;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
}

.table th, .table td {
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
}

/* Responsive tables - Mobile First */
@media (max-width: 767.98px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table th, .table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.875rem;
    }
    
    .table thead th {
        font-size: 0.8rem;
        font-weight: 600;
    }
    
    /* Masquer certaines colonnes sur mobile */
    .table .d-none.d-md-table-cell {
        display: none !important;
    }
    
    /* Informations supplémentaires visibles sur mobile */
    .mobile-info {
        display: block !important;
        margin-top: 0.25rem;
    }
    
    .mobile-info small {
        color: #6c757d;
        font-size: 0.75rem;
        line-height: 1.2;
    }
}

@media (min-width: 768px) {
    .mobile-info {
        display: none !important;
    }
}

/* Scrollbar personnalisée pour les tableaux */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #6c757d;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #495057;
}

/* ===== BOUTONS RESPONSIVE ===== */
.btn {
    border-radius: 0.375rem;
    transition: all 0.2s ease-in-out;
}

@media (max-width: 767.98px) {
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.775rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
}

@media (max-width: 575.98px) {
    .btn {
        padding: 0.375rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.7rem;
    }
    
    /* Boutons en pleine largeur sur très petits écrans */
    .btn-mobile-full {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Groupes de boutons */
@media (max-width: 575.98px) {
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        margin-bottom: 0.5rem;
        border-radius: 0.375rem !important;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

/* ===== FORMULAIRES RESPONSIVE ===== */
.form-control, .form-select {
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

@media (max-width: 767.98px) {
    .form-control, .form-select {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .form-control-sm, .form-select-sm {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .form-label {
        font-size: 0.875rem;
        font-weight: 500;
    }
}

@media (max-width: 575.98px) {
    .form-control, .form-select {
        padding: 0.45rem 0.65rem;
        font-size: 0.85rem;
    }
    
    .form-label {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }
}

/* ===== MODALES RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .modal-lg {
        max-width: calc(100% - 2rem);
    }
}

@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.25rem;
        max-width: calc(100% - 0.5rem);
    }
    
    .modal-header {
        padding: 0.75rem;
    }
    
    .modal-body {
        padding: 0.75rem;
    }
    
    .modal-footer {
        padding: 0.5rem 0.75rem;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .modal-footer .btn:last-child {
        margin-bottom: 0;
    }
}

/* ===== TYPOGRAPHIE RESPONSIVE ===== */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-bottom: 0.8rem;
}

@media (max-width: 767.98px) {
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.3rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.9rem; }
}

@media (max-width: 575.98px) {
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }
    h4 { font-size: 1rem; }
    h5 { font-size: 0.95rem; }
    h6 { font-size: 0.85rem; }
}

/* ===== BADGES & ALERTS ===== */
.badge {
    font-size: 0.75em;
    font-weight: 500;
    padding: 0.375em 0.75em;
    border-radius: 0.375rem;
}

@media (max-width: 575.98px) {
    .badge {
        font-size: 0.7em;
        padding: 0.3em 0.6em;
    }
}

.alert {
    border-radius: 0.5rem;
    padding: 1rem;
}

@media (max-width: 767.98px) {
    .alert {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
}

/* ===== NAVIGATION & BREADCRUMB ===== */
.breadcrumb {
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

@media (max-width: 767.98px) {
    .breadcrumb {
        font-size: 0.875rem;
        padding: 0.4rem 0;
    }
    
    .breadcrumb-item {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ===== PAGINATION RESPONSIVE ===== */
.pagination {
    margin-bottom: 1rem;
}

@media (max-width: 767.98px) {
    .pagination {
        font-size: 0.875rem;
    }
    
    .page-link {
        padding: 0.5rem 0.75rem;
    }
    
    .pagination-sm .page-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 575.98px) {
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .page-item {
        margin: 0 0.1rem 0.2rem 0;
    }
    
    .page-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    /* Masquer certains éléments de pagination sur mobile */
    .page-item:not(.active):not(.disabled) .page-link {
        display: none;
    }
    
    /* Garder visible: précédent, suivant, actuel et les 2 adjacents */
    .page-item.active .page-link,
    .page-item.disabled .page-link,
    .page-item:first-child .page-link,
    .page-item:last-child .page-link,
    .page-item.active + .page-item .page-link,
    .page-item.active - .page-item .page-link {
        display: block;
    }
}

/* ===== UTILITAIRES RESPONSIVE ===== */
/* Texte responsive */
.text-responsive {
    font-size: 1rem;
    line-height: 1.5;
}

@media (max-width: 767.98px) {
    .text-responsive {
        font-size: 0.875rem;
        line-height: 1.4;
    }
}

@media (max-width: 575.98px) {
    .text-responsive {
        font-size: 0.8rem;
        line-height: 1.3;
    }
}

/* Espacement responsive */
@media (max-width: 767.98px) {
    .py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
    .my-5 { margin-top: 2rem !important; margin-bottom: 2rem !important; }
    .my-4 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
    .my-3 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
}

@media (max-width: 575.98px) {
    .py-5 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
    .py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
    .my-5 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
    .my-4 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
    .my-3 { margin-top: 0.75rem !important; margin-bottom: 0.75rem !important; }
}

/* ===== HELPERS RESPONSIVE ===== */
/* Largeur responsive */
@media (max-width: 575.98px) {
    .w-auto-mobile { width: auto !important; }
    .w-100-mobile { width: 100% !important; }
}

/* Flex responsive */
@media (max-width: 575.98px) {
    .flex-column-mobile { flex-direction: column !important; }
    .flex-row-mobile { flex-direction: row !important; }
}

/* Affichage responsive */
@media (max-width: 575.98px) {
    .d-block-mobile { display: block !important; }
    .d-none-mobile { display: none !important; }
    .d-flex-mobile { display: flex !important; }
}

/* Texte responsive */
@media (max-width: 575.98px) {
    .text-center-mobile { text-align: center !important; }
    .text-left-mobile { text-align: left !important; }
    .text-right-mobile { text-align: right !important; }
}

/* ===== SIDEBAR & NAVIGATION RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
        transition: margin-left 0.3s ease-in-out;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .d-print-none {
        display: none !important;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .btn {
        display: none;
    }
    
    .modal {
        display: none;
    }
    
    .card {
        border: 1px solid #dee2e6;
        page-break-inside: avoid;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible pour l'accessibilité */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* ===== DARK MODE READY ===== */
@media (prefers-color-scheme: dark) {
    .table-responsive::-webkit-scrollbar-track {
        background: #343a40;
    }
    
    .table-responsive::-webkit-scrollbar-thumb {
        background: #6c757d;
    }
    
    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: #adb5bd;
    }
}