/* responsive.css - Styles supplémentaires pour assurer la responsivité */

/* Assure que les conteneurs s'adaptent aux écrans de toutes tailles */
.container {
    width: 100%;
    max-width: 1400px;
    padding: 0 15px;
    margin: 0 auto;
}

/* Styles généraux pour l'adaptabilité des éléments */
html {
    box-sizing: border-box;
    font-size: 16px;
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
}

/* Grilles responsives */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Adaptations pour tablette */
@media screen and (max-width: 992px) {
    html {
        font-size: 15px;
    }
    
    .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .card-value {
        font-size: 1.8rem;
    }
    
    .header-top {
        flex-direction: column;
        text-align: center;
        padding: 10px 0;
    }
    
    .header-top h1 {
        margin-bottom: 10px;
        font-size: 1.4rem;
    }
    
    .user-info {
        margin-top: 10px;
    }
    
    .form-tabs ul {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
    }
}

/* Adaptations pour mobile */
@media screen and (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .main-nav li {
        margin: 5px 10px;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions button {
        width: 100%;
    }
    
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
    
    .filter-section .form-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .tab-content {
        padding: 15px 10px;
    }
    
    .actions {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .btn-sm {
        padding: 5px 8px;
        font-size: 0.8rem;
    }
}

/* Adaptations pour petits mobiles */
@media screen and (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .header-top h1 {
        font-size: 1.2rem;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 8px;
    }
    
    .tab-content h3 {
        font-size: 1rem;
    }
    
    .login-container {
        width: 95%;
        padding: 15px;
    }
    
    .form-tabs ul li a {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* Classes d'utilitaires pour la responsivité */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media screen and (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-center {
        text-align: center;
    }
    
    .mobile-stack {
        display: flex;
        flex-direction: column;
    }
    
    .mobile-small-text {
        font-size: 0.9rem;
    }
    
    .mobile-hide {
        display: none;
    }
}

/* Navigation responsive avec menu hamburger */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px 0;
    background-color: white;
    transition: all 0.3s;
}

@media screen and (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    
    .main-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        padding: 0;
    }
    
    .main-nav.active {
        display: flex;
    }
    
    .main-nav li {
        width: 100%;
        margin: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .main-nav li a {
        display: block;
        padding: 12px 15px;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
}

/* Tables responsives pour mobile */
@media screen and (max-width: 768px) {
    .responsive-table {
        border: 0;
    }
    
    .responsive-table thead {
        display: none;
    }
    
    .responsive-table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 4px;
        overflow: hidden;
    }
    
    .responsive-table td {
        display: block;
        text-align: right;
        padding: 10px;
        position: relative;
        border-bottom: 1px solid #eee;
    }
    
    .responsive-table td:last-child {
        border-bottom: 0;
    }
    
    .responsive-table td:before {
        content: attr(data-label);
        float: left;
        font-weight: bold;
        text-transform: uppercase;
        font-size: 0.85em;
        color: #666;
    }
    
    /* Style spécial pour la colonne d'actions */
    .responsive-table td.actions {
        display: flex;
        justify-content: center;
        text-align: center;
        padding: 10px;
        background-color: #f8f9fa;
    }
    
    .responsive-table td.actions:before {
        display: none;
    }
}

/* Formulaires responsives */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px; /* Pour éviter le zoom sur mobile */
        padding: 12px 10px; /* Boutons plus grands pour faciliter le toucher */
    }
    
    label {
        margin-bottom: 8px;
        font-size: 0.95rem;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    button, .btn {
        padding: 12px 16px;
        font-size: 16px;
        min-height: 44px; /* Hauteur minimale pour les boutons sur mobile */
    }
}

/* Impression */
@media print {
    body {
        background: white;
        font-size: 12pt;
    }
    
    .container {
        width: 100%;
        max-width: none;
    }
    
    header, footer, .form-actions, .filter-section, .main-nav, .no-print {
        display: none !important;
    }
    
    .data-table {
        width: 100%;
        border-collapse: collapse;
    }
    
    .data-table th,
    .data-table td {
        border: 1px solid #ddd;
    }
    
    .page-header {
        border-bottom: 2px solid #000;
        margin-bottom: 20px;
    }
    
    .page-header h2 {
        font-size: 18pt;
    }
    
    a {
        text-decoration: none;
        color: #000;
    }
    
    @page {
        margin: 2cm;
    }
}