/**
 * MyFleet - Styles personnalisés
 * Styles complémentaires à Bootstrap 5
 */

/* ============================================================
   VARIABLES CSS
   ============================================================ */
:root {
    --primary-color: #0066cc;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --navbar-height: 60px;
}

/* ============================================================
   RESET ET CONFIGURATION GÉNÉRALE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
    min-height: 100vh;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color) !important;
}

.navbar-brand .brand-icon {
    font-size: 1.8rem;
    margin-right: 0.5rem;
}

.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: white !important;
}

/* Barre de recherche dans la navbar */
.navbar .search-form {
    margin: 0;
}

.navbar .search-form .form-control {
    border-radius: 20px 0 0 20px;
}

.navbar .search-form .btn {
    border-radius: 0 20px 20px 0;
}

/* ============================================================
   CONTENEUR PRINCIPAL
   ============================================================ */
.main-container {
    padding-top: 2rem;
    padding-bottom: 2rem;
    min-height: calc(100vh - var(--navbar-height));
}

/* ============================================================
   CARTES (CARDS)
   ============================================================ */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1.5rem;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0052a3 100%);
    color: white;
    font-weight: 600;
    border-radius: 10px 10px 0 0 !important;
    padding: 1rem 1.25rem;
}

/* ============================================================
   DASHBOARD - STATISTIQUES
   ============================================================ */
.stat-card {
    text-align: center;
    padding: 1.5rem;
}

.stat-card .stat-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card-primary { border-left: 4px solid var(--primary-color); }
.stat-card-success { border-left: 4px solid var(--success-color); }
.stat-card-info { border-left: 4px solid var(--info-color); }
.stat-card-warning { border-left: 4px solid var(--warning-color); }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
    border-radius: 6px;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0052a3 100%);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,102,204,0.3);
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

.btn-icon {
    margin-right: 0.5rem;
}

/* ============================================================
   FORMULAIRES
   ============================================================ */
.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #dee2e6;
    padding: 0.625rem 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0,102,204,0.15);
}

.form-label {
    font-weight: 500;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.required::after {
    content: " *";
    color: var(--danger-color);
}

/* ============================================================
   MESSAGES FLASH
   ============================================================ */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.alert-dismissible .btn-close {
    padding: 1.25rem;
}

/* ============================================================
   TABLEAU DES VOLS
   ============================================================ */
.flights-table {
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--light-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
    padding: 1rem 0.75rem;
}

.table tbody tr {
    transition: background-color 0.2s;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table td {
    vertical-align: middle;
    padding: 0.875rem 0.75rem;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    padding: 0.4rem 0.75rem;
    font-weight: 500;
    border-radius: 20px;
}

/* Codes couleur harmonisés avec les graphiques */
.badge-vfr_day,
.badge-vfr-day {
    background-color: #ffc107;
    color: #000;
}

.badge-vfr_night,
.badge-vfr-night {
    background-color: #0d6efd;
    color: #fff;
}

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

.badge-pic { background-color: #0066cc; }
.badge-student { background-color: #17a2b8; }
.badge-instructor { background-color: #6c757d; }

/* ============================================================
   BREADCRUMB (FIL D'ARIANE)
   ============================================================ */
.breadcrumb {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: #6c757d;
    font-size: 1.2rem;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    color: #0052a3;
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #6c757d;
    font-weight: 500;
}

/* ============================================================
   PAGE D'AUTHENTIFICATION
   ============================================================ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem 0;
}

.auth-card {
    max-width: 450px;
    width: 100%;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.auth-header {
    text-align: center;
    padding: 2rem 2rem 1rem;
    background: white;
    border-radius: 15px 15px 0 0;
}

.auth-header .logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.auth-header h2 {
    color: var(--dark-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--secondary-color);
}

.auth-body {
    padding: 2rem;
    background: white;
    border-radius: 0 0 15px 15px;
}

/* ============================================================
   PASSWORD STRENGTH INDICATOR
   ============================================================ */
.password-strength {
    margin-top: 0.5rem;
    height: 4px;
    border-radius: 2px;
    background: #e9ecef;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    transition: width 0.3s, background-color 0.3s;
    width: 0%;
}

.password-strength-weak { background-color: #dc3545; width: 25%; }
.password-strength-fair { background-color: #ffc107; width: 50%; }
.password-strength-good { background-color: #17a2b8; width: 75%; }
.password-strength-strong { background-color: #28a745; width: 100%; }

/* ============================================================
   AUTOCOMPLÉTION OACI
   ============================================================ */
.autocomplete-container {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: none;
}

.autocomplete-results.show {
    display: block;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: #f8f9fa;
}

.autocomplete-item .icao-code {
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.autocomplete-item .airport-name {
    color: var(--dark-color);
}

.autocomplete-item .airport-city {
    font-size: 0.85rem;
    color: var(--secondary-color);
}

/* ============================================================
   OFFLINE INDICATOR
   ============================================================ */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--warning-color);
    color: var(--dark-color);
    padding: 0.75rem 1.25rem;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-weight: 600;
    z-index: 9999;
    display: none;
}

.offline-indicator.show {
    display: block;
    animation: slideInUp 0.3s;
}

.online-indicator {
    background: var(--success-color);
    color: white;
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================================
   LOADER / SPINNER
   ============================================================ */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}

.loader-overlay.show {
    display: flex;
}

/* ============================================================
   RESPONSIVE - AMÉLIORATION MOBILE v1.6.0
   ============================================================ */

/* Mobile - Smartphones en portrait (< 576px) */
@media (max-width: 575.98px) {
    /* Conteneur principal */
    .main-container {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Titres */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }

    /* Cartes */
    .card {
        border-radius: 8px;
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Breadcrumb - Compact sur mobile */
    .breadcrumb {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }

    .breadcrumb-item + .breadcrumb-item::before {
        font-size: 1rem;
    }

    /* Statistiques du dashboard - Optimisé 2x2 sur mobile */
    .stat-card {
        padding: 0.75rem 0.5rem;
        margin-bottom: 0.75rem;
    }

    .stat-card .stat-icon {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .stat-card .stat-value {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
        line-height: 1.2;
    }

    .stat-card .stat-label {
        font-size: 0.65rem;
        line-height: 1.3;
    }

    /* Réduire l'épaisseur de la bordure gauche sur mobile */
    .stat-card-primary,
    .stat-card-success,
    .stat-card-info,
    .stat-card-warning {
        border-left-width: 3px;
    }

    /* Tableaux - Version mobile optimisée */
    .table-responsive {
        border-radius: 8px;
        margin-bottom: 1rem;
    }

    .table {
        font-size: 0.8rem;
    }

    .table thead th {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }

    .table tbody td {
        padding: 0.5rem 0.25rem;
    }

    /* Masquer certaines colonnes sur mobile */
    .table .d-none-mobile {
        display: none !important;
    }

    /* Boutons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 0.625rem 1.5rem;
        font-size: 1rem;
    }

    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Groupes de boutons - Stack vertical sur mobile */
    .btn-group-mobile-stack {
        flex-direction: column !important;
        width: 100%;
    }

    .btn-group-mobile-stack .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.75rem;
    }

    .d-flex.justify-content-between .btn,
    .d-flex.justify-content-between a {
        width: 100%;
    }

    /* Formulaires */
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.375rem;
    }

    .form-control,
    .form-select {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }

    /* Grilles - Une seule colonne sur mobile */
    .row.mb-3 > [class*="col-"] {
        margin-bottom: 0.75rem !important;
    }

    /* Navigation Navbar */
    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }

    .navbar-brand .brand-icon {
        font-size: 1.4rem;
        margin-right: 0.25rem;
    }

    .navbar-nav .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    /* Barre de recherche navbar - Empiler sur mobile */
    .navbar .search-form {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .navbar .search-form .input-group {
        width: 100%;
    }

    .navbar .search-form .form-control {
        min-width: auto !important;
    }

    /* Avatar profil */
    .profile-avatar,
    .profile-avatar-placeholder {
        width: 100px;
        height: 100px;
    }

    /* Cartes d'avion */
    .card-img-top {
        height: 150px !important;
    }

    /* Alertes */
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Badges */
    .badge {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    /* Footer */
    footer {
        padding: 1.5rem 0;
        font-size: 0.85rem;
    }

    footer .row > div {
        text-align: center !important;
        margin-bottom: 0.5rem;
    }

    /* Modales */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 8px;
    }

    /* Autocomplete OACI */
    .autocomplete-results {
        max-height: 200px;
    }

    .autocomplete-item {
        padding: 0.5rem 0.75rem;
    }

    .autocomplete-item .icao-code {
        font-size: 0.85rem;
    }

    .autocomplete-item .airport-name {
        font-size: 0.8rem;
    }

    .autocomplete-item .airport-city {
        font-size: 0.75rem;
    }

    /* Graphiques Chart.js */
    canvas {
        max-height: 250px !important;
    }

    /* Indicateur offline */
    .offline-indicator {
        bottom: 10px;
        right: 10px;
        left: 10px;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        text-align: center;
    }

    /* Escales */
    .stopover-item {
        margin-bottom: 0.75rem;
    }

    .stopover-item .input-group-text {
        min-width: 90px;
        font-size: 0.85rem;
    }

    /* Page d'authentification */
    .auth-container {
        padding: 1rem;
    }

    .auth-card {
        margin: 0;
    }

    .auth-header {
        padding: 1.5rem 1rem 0.75rem;
    }

    .auth-header .logo {
        font-size: 2.5rem;
    }

    .auth-header h2 {
        font-size: 1.5rem;
    }

    .auth-body {
        padding: 1rem;
    }

    /* Masquer texte sur petits écrans */
    .hide-text-mobile {
        font-size: 0 !important;
    }

    .hide-text-mobile i {
        font-size: 1rem !important;
    }
}

/* Tablettes en portrait (576px - 767.98px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .stat-card .stat-value {
        font-size: 1.75rem;
    }

    .table {
        font-size: 0.9rem;
    }

    .card-img-top {
        height: 180px !important;
    }

    canvas {
        max-height: 300px !important;
    }
}

/* Tablettes en paysage (768px - 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .stat-card .stat-value {
        font-size: 1.85rem;
    }

    .card-img-top {
        height: 200px !important;
    }
}

/* Touch devices - Amélioration des zones tactiles */
@media (hover: none) and (pointer: coarse) {
    /* Augmenter la taille des éléments cliquables */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .form-control,
    .form-select {
        min-height: 44px;
    }

    .table tbody tr {
        cursor: pointer;
    }

    /* Retirer les effets hover sur touch */
    .card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }

    .btn:hover {
        transform: none;
    }

    /* Améliorer le feedback tactile */
    .btn:active {
        transform: scale(0.98);
    }

    .card:active {
        opacity: 0.95;
    }
}

/* Landscape orientation - Optimisations */
@media (orientation: landscape) and (max-height: 500px) {
    .main-container {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-card .stat-icon {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .stat-card .stat-value {
        font-size: 1.25rem;
    }
}

/* Classes utilitaires responsive */
.mobile-center {
    text-align: center;
}

@media (min-width: 768px) {
    .mobile-center {
        text-align: inherit;
    }
}

.mobile-mb-2 {
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .mobile-mb-2 {
        margin-bottom: 0;
    }
}

/* ============================================================
   RECHERCHE
   ============================================================ */
/* Highlight des termes recherchés */
mark {
    background-color: #fff3cd;
    color: #000;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
    font-weight: 500;
}

/* ============================================================
   UTILITAIRES
   ============================================================ */
.text-muted-light {
    color: #adb5bd;
}

.divider {
    height: 1px;
    background: #e9ecef;
    margin: 1.5rem 0;
}

.icon-lg {
    font-size: 1.5rem;
}

.icon-xl {
    font-size: 2rem;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s;
}

/* ============================================================
   PROFILE AVATAR
   ============================================================ */
.profile-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.profile-avatar-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: var(--light-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #dee2e6;
}

.avatar-container {
    display: inline-block;
}

/* ============================================================
   STOPOVERS (Escales multiples)
   ============================================================ */
.stopover-item {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stopover-item .input-group-text {
    background-color: var(--info-color);
    color: white;
    font-weight: 600;
    min-width: 110px;
}

.stopover-item .autocomplete-container {
    position: relative;
}

.remove-stopover-btn {
    border-color: var(--danger-color);
}

.remove-stopover-btn:hover {
    background-color: var(--danger-color);
    color: white;
}

#stopoversContainer:empty + small {
    color: #6c757d;
}

/* ============================================================
   ALERT ITEMS (Alertes permanentes dashboard)
   ============================================================ */
.alert-item {
    transition: all 0.3s ease;
}

.alert-item.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-item.alert-danger-orange {
    background-color: #ffe5d0;
    color: #c54d00;
    border-color: #ff6b35 !important;
}

.alert-item.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

/* Classes pour les textes et backgrounds */
.text-danger-orange {
    color: #ff6b35 !important;
}

.bg-danger-orange {
    background-color: #ff6b35 !important;
}

.border-danger-orange {
    border-color: #ff6b35 !important;
}

.btn-outline-danger-orange {
    color: #ff6b35;
    border-color: #ff6b35;
}

.btn-outline-danger-orange:hover {
    background-color: #ff6b35;
    border-color: #ff6b35;
    color: white;
}

.alert-item.alert-primary {
    background-color: #cfe2ff;
    color: #084298;
}

.alert-item.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

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

/* ============================================================
   WIDGETS DASHBOARD v1.6
   ============================================================ */

/* Widget météo */
.weather-details {
    font-size: 0.95rem;
}

.weather-details .d-flex {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.weather-details .d-flex:last-child {
    border-bottom: none;
}

/* Comparaison statistiques année par année */
.stat-comparison {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    height: 100%;
}

.stat-comparison .stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.stat-comparison .stat-values {
    margin: 0.75rem 0;
}

.stat-comparison .current-year {
    font-size: 1.1rem;
}

.stat-comparison .last-year {
    font-size: 0.95rem;
    color: #6c757d;
}

.stat-comparison .trend {
    font-size: 0.85rem;
    font-weight: 600;
}

.stat-comparison .trend i {
    font-size: 1rem;
}

/* Graphiques Chart.js */
canvas {
    max-height: 400px;
}

/* Widgets hauteur égale */
.card.h-100 {
    min-height: 350px;
}

/* Objectifs - barre de progression */
.progress {
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.progress-bar {
    font-weight: 600;
    font-size: 0.875rem;
}

/* Print styles for PDF export */
@media print {
    .no-print {
        display: none !important;
    }
}
