/* ===== CORRECTIONS SPÉCIFIQUES POUR MOBILE ===== */

/* Correction du header mobile */
@media (max-width: 768px) {
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        padding: 8px 0;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .header .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    .header h1 {
        font-size: 1.3rem;
        margin: 0;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .mobile-menu-toggle {
        background: none;
        border: none;
        color: white;
        font-size: 1.4rem;
        cursor: pointer;
        padding: 8px;
        border-radius: 4px;
        transition: background-color 0.3s;
        flex-shrink: 0;
        margin-left: 10px;
    }
    
    .mobile-menu-toggle:hover {
        background-color: rgba(255,255,255,0.2);
    }
    
    .mobile-menu-toggle:active {
        background-color: rgba(255,255,255,0.3);
        transform: scale(0.95);
    }
    
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
        border-radius: 0 0 15px 15px;
        z-index: 999;
    }
    
    .nav.active {
        display: flex;
        animation: slideDown 0.3s ease-out;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .nav-link {
        padding: 15px 20px;
        margin: 5px 0;
        border-radius: 8px;
        text-align: center;
        font-size: 16px;
        font-weight: 500;
        transition: all 0.3s ease;
        border: 1px solid rgba(255,255,255,0.2);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
    
    .nav-link:hover {
        background-color: rgba(255,255,255,0.3);
        transform: translateX(5px);
    }
    
    .nav-link:active {
        transform: scale(0.98);
    }
    
    .nav-link i {
        font-size: 1.1rem;
    }
}

/* Correction du contenu principal */
@media (max-width: 768px) {
    .main {
        margin-top: 70px;
        padding: 15px 0;
        min-height: calc(100vh - 70px);
    }
    
    .container {
        padding: 0 15px;
    }
}

/* Amélioration des cartes d'animaux sur mobile */
@media (max-width: 768px) {
    .animal-card {
        margin-bottom: 15px;
        transition: all 0.3s ease;
    }
    
    .animal-card:active {
        transform: scale(0.98);
    }
    
    .animal-card .animal-photo-section {
        margin-bottom: 15px;
        padding: 15px;
        background: #f8f9fa;
        border-radius: 8px 8px 0 0;
    }
    
    .animal-card-photo {
        width: 100%;
        height: 180px;
        object-fit: cover;
        border-radius: 6px;
    }
    
    .animal-card .animal-photo-placeholder {
        width: 100%;
        height: 180px;
        border-radius: 6px;
        margin: 0;
    }
    
    .animal-card .animal-photo-placeholder i {
        font-size: 2rem;
    }
    
    .animal-header h3 {
        font-size: 1.2rem;
        margin-bottom: 5px;
        color: #2c3e50;
    }
    
    .animal-species {
        font-size: 0.9rem;
        color: #6c757d;
        margin-bottom: 10px;
    }
    
    .animal-details {
        margin-bottom: 15px;
    }
    
    .animal-details p {
        font-size: 0.85rem;
        margin-bottom: 8px;
        color: #555;
    }
    
    .animal-info-row {
        flex-direction: column;
        gap: 5px;
        margin-bottom: 10px;
    }
    
    .animal-physical {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .animal-color,
    .animal-size,
    .animal-weight {
        font-size: 0.75rem;
        padding: 4px 8px;
        border-radius: 12px;
        background: #e9ecef;
        color: #495057;
    }
    
    .animal-actions {
        justify-content: center;
        margin-top: 15px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .animal-actions .btn {
        flex: 1;
        min-width: 100px;
        padding: 10px 15px;
        font-size: 14px;
        font-weight: 500;
    }
}

@media (max-width: 480px) {
    .animal-card {
        padding: 15px;
    }
    
    .animal-card-photo {
        height: 150px;
    }
    
    .animal-card .animal-photo-placeholder {
        height: 150px;
    }
    
    .animal-actions {
        flex-direction: column;
    }
    
    .animal-actions .btn {
        width: 100%;
        min-width: auto;
    }
}

/* Amélioration des formulaires sur mobile */
@media (max-width: 768px) {
    .form-page {
        padding: 10px;
    }
    
    .form-card {
        padding: 20px;
        margin: 0;
        border-radius: 10px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        font-size: 16px;
        margin-bottom: 8px;
        font-weight: 600;
        color: #2c3e50;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 12px 15px;
        border-radius: 8px;
        border: 2px solid #e9ecef;
        transition: all 0.3s ease;
        width: 100%;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        border-color: #007bff;
        box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
        outline: none;
    }
    
    .form-group select {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 16px;
        padding-right: 40px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: 25px;
    }
    
    .form-actions .btn {
        width: 100%;
        padding: 15px 20px;
        font-size: 16px;
        justify-content: center;
        min-height: 50px;
    }
}

/* Amélioration des boutons sur mobile */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 8px;
        transition: all 0.2s ease;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        cursor: pointer;
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .btn:focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
    }
}

/* Amélioration des modales sur mobile */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 10px;
    }
    
    .modal-header {
        padding: 15px 20px;
        border-bottom: 1px solid #dee2e6;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
        margin: 0;
    }
    
    .close {
        font-size: 24px;
        padding: 5px;
        line-height: 1;
    }
    
    .modal form {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        border-top: 1px solid #dee2e6;
        text-align: center;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 5px 0;
    }
}

/* Amélioration des alertes sur mobile */
@media (max-width: 768px) {
    .alert {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 8px;
        font-size: 14px;
    }
    
    .alert i {
        font-size: 1.1rem;
        margin-right: 10px;
    }
}

/* Amélioration des statistiques sur mobile */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-item {
        padding: 15px;
        text-align: center;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .stat-number {
        font-size: 1.8rem;
        font-weight: bold;
        color: #007bff;
        margin-bottom: 5px;
    }
    
    .stat-label {
        font-size: 0.8rem;
        color: #6c757d;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Amélioration des listes sur mobile */
@media (max-width: 768px) {
    .animals-list,
    .rappels-list,
    .vaccins-list,
    .traitements-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .animal-item,
    .rappel-item,
    .vaccin-item,
    .traitement-item {
        padding: 15px;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        border: 1px solid #e9ecef;
        transition: all 0.3s ease;
    }
    
    .animal-item:active,
    .rappel-item:active,
    .vaccin-item:active,
    .traitement-item:active {
        transform: scale(0.98);
    }
    
    .animal-actions,
    .rappel-actions,
    .item-actions {
        justify-content: center;
        margin-top: 10px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .animal-actions .btn,
    .rappel-actions .btn,
    .item-actions .btn {
        flex: 1;
        min-width: 80px;
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* Amélioration des pages de détail sur mobile */
@media (max-width: 768px) {
    .animal-detail-page {
        padding: 10px;
    }
    
    .animal-header-section {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 20px;
        padding: 20px;
    }
    
    .animal-photo-section {
        order: 1;
    }
    
    .animal-basic-info {
        order: 2;
    }
    
    .animal-actions {
        order: 3;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .animal-title {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .animal-title h1 {
        font-size: 1.8rem;
    }
    
    .animal-quick-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .animal-quick-info .info-item {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* Amélioration des uploads de photos sur mobile */
@media (max-width: 768px) {
    .photo-upload-container {
        padding: 15px;
        border-radius: 8px;
    }
    
    .photo-tabs {
        flex-direction: column;
        gap: 5px;
        margin-bottom: 15px;
    }
    
    .photo-tab {
        padding: 12px 15px;
        font-size: 14px;
        text-align: center;
        border-radius: 8px;
        border: 1px solid #ddd;
        background: white;
        transition: all 0.3s ease;
    }
    
    .photo-tab.active {
        background: #007bff;
        color: white;
        border-color: #007bff;
    }
    
    .file-upload-box {
        padding: 30px 15px;
        border-radius: 8px;
    }
    
    .file-upload-box i {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }
    
    .file-upload-box p {
        font-size: 14px;
        margin: 10px 0;
    }
    
    .file-upload-box small {
        font-size: 11px;
        color: #666;
    }
    
    .webcam-container video {
        max-height: 250px;
        width: 100%;
        border-radius: 8px;
    }
    
    .webcam-controls {
        flex-direction: column;
        gap: 10px;
        margin: 15px 0;
    }
    
    .webcam-controls .btn {
        width: 100%;
        padding: 12px 20px;
    }
    
    .file-preview img,
    .webcam-preview img,
    .url-preview img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }
}

/* Amélioration des messages d'erreur sur mobile */
@media (max-width: 768px) {
    .field-error {
        color: #dc3545;
        font-size: 12px;
        margin-top: 4px;
        display: block;
    }
    
    .form-group input.error,
    .form-group select.error,
    .form-group textarea.error {
        border-color: #dc3545;
        box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
    }
    
    .form-group input.success,
    .form-group select.success,
    .form-group textarea.success {
        border-color: #28a745;
        box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
    }
}

/* Amélioration de l'accessibilité sur mobile */
@media (max-width: 768px) {
    /* Améliorer le contraste pour les petits écrans */
    .animal-species,
    .animal-details p,
    .rappel-date,
    .vaccin-date {
        color: #555;
    }
    
    .status-badge {
        font-weight: 600;
    }
    
    /* Améliorer la lisibilité des textes */
    .animal-header h3,
    .animal-title h1 {
        line-height: 1.2;
    }
    
    /* Améliorer l'espacement des éléments interactifs */
    .btn,
    .nav-link,
    .animal-card {
        margin: 2px;
    }
}

/* Correction pour les très petits écrans */
@media (max-width: 360px) {
    .container {
        padding: 0 10px;
    }
    
    .header h1 {
        font-size: 1.1rem;
    }
    
    .animal-card {
        padding: 12px;
    }
    
    .form-card {
        padding: 15px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 14px;
    }
}
