/* ========================================
   MOBILE OPTIMIZATION - Mobile First Styles
   ======================================== */

/* Optimisations pour tous les appareils tactiles */
.touch-device button,
.touch-device a,
.touch-device input[type="submit"],
.touch-device input[type="button"] {
    -webkit-user-select: none;
    user-select: none;
}

/* Optimisation des formulaires mobiles */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
    /* Prévenir le zoom au focus sur iOS */
    font-size: 16px !important;
    line-height: 1.5;
    border-radius: 4px;
    border: 1px solid #ccc;
}

/* Focus visible pour accessibilité */
input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Améliorer les tableaux responsives */
table {
    border-collapse: collapse;
    width: 100%;
}

table thead {
    background-color: #f5f5f5;
}

table th,
table td {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid #ddd;
}

/* Rendre les tableaux scrollables sur mobile si nécessaire */
@media (max-width: 768px) {
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 15px;
    }
    
    table {
        min-width: 100%;
    }
}

/* Optimisations des éléments de formulaire */
.form-group,
.form-field {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
}

/* Boutons optimisés */
button,
.button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 10px 15px;
    font-size: 1em;
}

button:hover,
.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button:active,
.button:active {
    transform: translateY(0);
}

/* Listes optimisées */
ul, ol {
    padding-left: 20px;
}

li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* Liens optimisés */
a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
    color: #0056b3;
}

/* Espacement et typographie */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-top: 15px;
    margin-bottom: 10px;
    font-weight: 700;
}

p {
    line-height: 1.6;
    margin-bottom: 15px;
}

/* Boîtes de contenu */
.box,
.card,
.section {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

/* Alertes et messages */
.alert,
.message,
.error,
.success {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left-color: #f5c6cb;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border-left-color: #c3e6cb;
}

.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left-color: #bee5eb;
}

.warning {
    background-color: #fff3cd;
    color: #856404;
    border-left-color: #ffeaa7;
}

/* Images responsives */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Videos responsives */
iframe,
video {
    max-width: 100%;
    height: auto;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Ratio 16:9 */
    height: 0;
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Grid responsive */
.grid {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

/* Flex responsive */
.flex,
.flex-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .flex,
    .flex-container {
        flex-direction: column;
        gap: 10px;
    }
}

/* Badges */
.badge,
.tag {
    display: inline-block;
    padding: 5px 10px;
    background-color: #007bff;
    color: white;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    margin: 2px;
}

.badge.secondary {
    background-color: #6c757d;
}

.badge.success {
    background-color: #28a745;
}

.badge.danger {
    background-color: #dc3545;
}

.badge.warning {
    background-color: #ffc107;
    color: #333;
}

/* Spinner/Loader */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, #f3f3f3 25%, #e3e3e3 50%, #f3f3f3 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Scroll bar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Selection */
::selection {
    background-color: #007bff;
    color: white;
}

::-moz-selection {
    background-color: #007bff;
    color: white;
}
