/* Styles personnalisés pour GestIT - VERSION MOBILE OPTIMISÉ */

/* Variables CSS */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --light-gray: #f8fafc;
    --border-color: #e5e7eb;
    --mobile-nav-height: 80px;
}

/* Styles de base */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%; /* Empêche le zoom automatique sur iOS */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Optimisations tactiles */
button, a, [role="button"] {
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.1);
    tap-highlight-color: rgba(59, 130, 246, 0.1);
}

/* Zones tactiles minimales (44px recommandé) */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Navigation active */
.nav-link.active {
    border-bottom-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

/* Boutons personnalisés */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transition: all 0.2s ease-in-out;
    min-height: 44px; /* Zone tactile suffisante */
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.25);
}

/* Navigation mobile bottom fixe */
.mobile-nav-bottom {
    height: var(--mobile-nav-height);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-nav-bottom a, .mobile-nav-bottom button {
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
}

/* Tables responsives */
.table-responsive {
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Scroll fluide sur iOS */
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background-color: var(--light-gray);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap; /* Empêche le retour à la ligne des en-têtes */
}

.table td {
    vertical-align: middle;
    padding: 1rem 0.75rem;
}

.table tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

/* Tables mobiles - Stack layout */
@media (max-width: 768px) {
    .table-mobile-stack {
        display: block;
    }
    
    .table-mobile-stack thead {
        display: none;
    }
    
    .table-mobile-stack tbody {
        display: block;
    }
    
    .table-mobile-stack tr {
        display: block;
        margin-bottom: 1rem;
        background: white;
        border-radius: 0.75rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        padding: 1rem;
    }
    
    .table-mobile-stack td {
        display: block;
        padding: 0.5rem 0;
        border: none;
    }
    
    .table-mobile-stack td:before {
        content: attr(data-label) ": ";
        font-weight: bold;
        color: #6b7280;
        display: inline-block;
        min-width: 100px;
    }
}

/* Badges personnalisés */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    min-height: 28px; /* Zone tactile suffisante */
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #cffafe;
    color: #155e75;
}

.badge-primary {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background-color: #f3f4f6;
    color: #374151;
}

/* Cards et conteneurs */
.card {
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
    overflow: hidden; /* Évite les débordements sur mobile */
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: var(--light-gray);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 1rem;
}

.card-body {
    padding: 1rem;
}

/* Formulaires optimisés mobile */
.form-control {
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease-in-out;
    min-height: 44px; /* Zone tactile suffisante */
    font-size: 16px; /* Évite le zoom sur iOS */
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.form-select {
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    min-height: 44px;
    font-size: 16px;
}

.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    display: block;
}

/* Alertes */
.alert {
    border-radius: 0.75rem;
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-info {
    background-color: #cffafe;
    color: #155e75;
    border-left: 4px solid var(--info-color);
}

/* Pagination mobile-friendly */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pagination .page-link {
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    color: #6b7280;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.pagination .page-link:hover {
    background-color: var(--light-gray);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Dropdowns mobiles */
.dropdown-menu {
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    max-height: 80vh; /* Limite la hauteur sur mobile */
    overflow-y: auto;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    transition: all 0.15s ease-in-out;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.dropdown-item:hover {
    background-color: var(--light-gray);
    color: var(--primary-color);
}

/* Modals mobiles */
.modal-content {
    border-radius: 1rem;
    border: none;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    margin: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 1.5rem 1rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.modal-footer .btn {
    flex: 1;
    min-width: 120px;
}

/* Notifications toast mobiles */
.toast {
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 0.5rem;
    max-width: calc(100vw - 1rem);
}

/* Spinners et loaders */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Progress bars */
.progress {
    border-radius: 9999px;
    background-color: #f3f4f6;
    height: 8px;
}

.progress-bar {
    border-radius: 9999px;
}

/* Animations personnalisées */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-bottom {
    animation: slideInFromBottom 0.3s ease-out;
}

/* Utilitaires mobiles */
.shadow-soft {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.border-radius-lg {
    border-radius: 1rem;
}

.cursor-pointer {
    cursor: pointer;
}

.text-muted-light {
    color: #9ca3af;
}

/* Scroll personnalisé */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 3px;
}

/* States des éléments */
.equipment-status-active {
    background-color: #d1fae5;
    color: #065f46;
}

.equipment-status-maintenance {
    background-color: #fef3c7;
    color: #92400e;
}

.equipment-status-repair {
    background-color: #fee2e2;
    color: #991b1b;
}

.ticket-priority-low {
    background-color: #f3f4f6;
    color: #374151;
}

.ticket-priority-normal {
    background-color: #dbeafe;
    color: #1e40af;
}

.ticket-priority-high {
    background-color: #fef3c7;
    color: #92400e;
}

.ticket-priority-urgent {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Menu mobile sidebar */
.mobile-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
}

.mobile-sidebar.open {
    transform: translateX(0);
}

/* Responsive design optimisé */
@media (max-width: 1024px) {
    body {
        padding-bottom: 80px; /* Espace pour la navigation bottom */
    }
}

/* Corrections spécifiques pour les notifications */
.notification-dropdown {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.notification-dropdown .custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
}

.notification-dropdown .custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.notification-dropdown .custom-scrollbar::-webkit-scrollbar-track {
    background: #f7fafc;
}

.notification-dropdown .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

.notification-dropdown .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Mobile specific adjustments */
@media (max-width: 640px) {
    .notification-dropdown {
        position: fixed !important;
        top: 70px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: none !important;
        z-index: 9999 !important;
    }
}

/* Dark mode support préparation */
@media (prefers-color-scheme: dark) {
    :root {
        --light-gray: #1f2937;
        --border-color: #374151;
    }
    
    .dark .mobile-nav-bottom {
        background-color: rgba(31, 41, 55, 0.95);
        border-top-color: #374151;
    }
    
    .dark .card {
        background-color: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .dark .form-control {
        background-color: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .dark .form-control::placeholder {
        color: #9ca3af;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-break {
        page-break-after: always;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        padding-bottom: 0 !important;
    }
    
    .mobile-nav-bottom {
        display: none !important;
    }
    
    .card, .table {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .btn {
        border: 1px solid #000;
        background: transparent !important;
        color: #000 !important;
    }
}

/* Styles pour PWA */
@media all and (display-mode: standalone) {
    /* Styles spécifiques quand l'app est installée */
    .pwa-only {
        display: block;
    }
    
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: calc(env(safe-area-inset-bottom) + var(--mobile-nav-height));
    }
    
    .mobile-nav-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Accessibilité */
@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é */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Styles pour les notifications système */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #ef4444;
    color: white;
    border-radius: 9999px;
    min-width: 18px;
    height: 18px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.notification-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    transition: all 0.2s ease-in-out;
}

.notification-button:hover {
    background-color: rgba(59, 130, 246, 0.1);
    transform: scale(1.05);
}

.notification-dropdown {
    max-height: 80vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.notification-dropdown::-webkit-scrollbar {
    width: 6px;
}

.notification-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.notification-dropdown::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

.notification-dropdown::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* Améliorations pour le dropdown de notifications */
.notification-dropdown {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.notification-item {
    transition: all 0.15s ease-in-out;
    border-radius: 0.5rem;
    margin: 0.25rem 0;
}

.notification-item:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.notification-item:active {
    transform: translateX(0);
}

/* Scroll personnalisé pour le contenu des notifications - masqué sur desktop */
.notification-content {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.notification-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

/* Afficher le scrollbar seulement sur mobile si nécessaire */
@media (max-width: 768px) {
    .notification-content {
        scrollbar-width: thin;
        -ms-overflow-style: auto;
    }
    
    .notification-content::-webkit-scrollbar {
        display: block;
        width: 4px;
    }
    
    .notification-content::-webkit-scrollbar-track {
        background: #f7fafc;
        border-radius: 2px;
    }
    
    .notification-content::-webkit-scrollbar-thumb {
        background: #cbd5e0;
        border-radius: 2px;
    }
    
    .notification-content::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }
}

/* Améliorations pour mobile */
@media (max-width: 640px) {
    .notification-dropdown {
        position: fixed !important;
        top: 70px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: none !important;
        z-index: 9999 !important;
        max-height: calc(100vh - 80px) !important;
    }
    
    .notification-item {
        padding: 0.75rem;
        margin: 0.125rem 0;
    }
}