/* 
═══════════════════════════════════════════════════════════════════
RDCONNECT DASHBOARD - MOBILE FIXES
Version 1.0 - 27 janvier 2026
═══════════════════════════════════════════════════════════════════
Corrections pour:
1. Contenu non masqué par la navbar fixe
2. Marges uniformes dans les cartes
3. Titres sur une seule ligne (text-ellipsis)
4. Hiérarchie visuelle cohérente
5. Adaptation mobile pour tous les dashboards
═══════════════════════════════════════════════════════════════════
*/

/* ═══════════════════════════════════════
   1. CORRECTION NAVBAR - CONTENU NON MASQUÉ
   Le contenu doit commencer SOUS la navbar
═══════════════════════════════════════ */

/* Variable pour la hauteur de la navbar */
:root {
  --navbar-height-desktop: 64px;
  --navbar-height-mobile: 56px;
  --navbar-height-small: 52px;
  --bottom-nav-height: 64px;
  --card-padding: 1rem;
  --card-padding-mobile: 0.875rem;
  --card-border-radius: 12px;
}

/* Desktop: décaler le contenu sous la navbar */
@media (min-width: 992px) {
  .main-content.app-content {
    padding-top: calc(var(--navbar-height-desktop) + 1rem) !important;
  }
}

/* Tablette */
@media (min-width: 768px) and (max-width: 991.98px) {
  .main-content.app-content {
    padding-top: calc(var(--navbar-height-mobile) + 1rem) !important;
    margin-left: 0 !important;
  }
}

/* Mobile */
@media (max-width: 767.98px) {
  .main-content.app-content {
    padding-top: calc(var(--navbar-height-mobile) + 0.75rem) !important;
    padding-bottom: calc(var(--bottom-nav-height) + 1.5rem) !important;
    margin-left: 0 !important;
  }
}

/* Petit mobile */
@media (max-width: 575.98px) {
  .main-content.app-content {
    padding-top: calc(var(--navbar-height-small) + 0.5rem) !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  .container-fluid {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
}

/* ═══════════════════════════════════════
   2. MARGES UNIFORMES DANS LES CARTES
   Padding cohérent gauche/droite/haut/bas
═══════════════════════════════════════ */

/* Cartes standard */
.card {
  border-radius: var(--card-border-radius);
  overflow: hidden;
  margin-bottom: 1rem;
}

.card .card-body {
  padding: var(--card-padding);
}

.card .card-header {
  padding: 0.875rem var(--card-padding);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.card .card-footer {
  padding: 0.75rem var(--card-padding);
  border-top: 1px solid rgba(0,0,0,0.08);
}

/* Cartes custom (dashboard) */
.card.custom-card .card-body {
  padding: var(--card-padding);
}

/* Mobile - padding réduit mais cohérent */
@media (max-width: 767.98px) {
  .card .card-body,
  .card.custom-card .card-body {
    padding: var(--card-padding-mobile);
  }
  
  .card .card-header,
  .card.custom-card .card-header {
    padding: 0.75rem var(--card-padding-mobile);
  }
  
  .card .card-footer,
  .card.custom-card .card-footer {
    padding: 0.625rem var(--card-padding-mobile);
  }
}

/* Petit mobile - encore plus compact */
@media (max-width: 575.98px) {
  :root {
    --card-padding-mobile: 0.75rem;
  }
}

/* ═══════════════════════════════════════
   3. TITRES SUR UNE SEULE LIGNE
   Ellipsis au lieu de wrap
═══════════════════════════════════════ */

/* Titres principaux - une seule ligne */
.page-title,
.page-header-breadcrumb p,
.page-header-breadcrumb .fw-semibold,
.card-title,
.modal-title,
h1.card-title,
h2.card-title,
h3.card-title,
h4.card-title,
h5.card-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Titres dans les cartes stats */
.card.custom-card .fs-13,
.card.custom-card span.d-block {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sur mobile - réduire la taille des titres */
@media (max-width: 767.98px) {
  .page-header-breadcrumb p,
  .page-header-breadcrumb .fw-semibold {
    font-size: 1rem !important;
  }
  
  .card-title {
    font-size: 0.9375rem !important;
  }
  
  h1 { font-size: 1.5rem !important; }
  h2 { font-size: 1.25rem !important; }
  h3 { font-size: 1.125rem !important; }
  h4 { font-size: 1rem !important; }
  h5 { font-size: 0.9375rem !important; }
  h6 { font-size: 0.875rem !important; }
}

/* Petit mobile - tailles encore plus réduites */
@media (max-width: 575.98px) {
  .page-header-breadcrumb p,
  .page-header-breadcrumb .fw-semibold {
    font-size: 0.9375rem !important;
  }
  
  .card-title {
    font-size: 0.875rem !important;
  }
  
  h1 { font-size: 1.25rem !important; }
  h2 { font-size: 1.125rem !important; }
  h3 { font-size: 1rem !important; }
  h4 { font-size: 0.9375rem !important; }
  h5 { font-size: 0.875rem !important; }
  h6 { font-size: 0.8125rem !important; }
}

/* ═══════════════════════════════════════
   4. HIÉRARCHIE VISUELLE COHÉRENTE
   Titre → Sous-titre → Image → Texte
═══════════════════════════════════════ */

/* Section standard */
.section-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.section-content .section-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.section-content .section-subtitle {
  font-size: 0.875rem;
  color: #6c757d;
  margin-bottom: 0.5rem;
}

.section-content .section-image {
  margin: 0.5rem 0;
}

.section-content .section-text {
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ═══════════════════════════════════════
   5. DASHBOARD CARDS - GRILLE MOBILE
   Adaptation 2 colonnes sur mobile
═══════════════════════════════════════ */

/* Stats cards - 2 colonnes sur mobile */
@media (max-width: 767.98px) {
  /* Forcer 2 colonnes pour les cartes stats */
  .row > .col-md-3,
  .row > .col-lg-3,
  .row > .col-xl-3,
  .row > [class*="col-md-3"],
  .row > [class*="col-lg-3"],
  .row > [class*="col-xl-3"] {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    padding-left: 0.375rem !important;
    padding-right: 0.375rem !important;
  }
  
  /* Espacement vertical entre les cartes */
  .row > [class*="col-"] {
    margin-bottom: 0.75rem;
  }
  
  /* Supprimer le margin-bottom de la dernière rangée */
  .row:last-child > [class*="col-"]:nth-last-child(-n+2) {
    margin-bottom: 0;
  }
}

/* Petit mobile - 1 colonne si nécessaire */
@media (max-width: 374.98px) {
  .row > .col-md-3,
  .row > .col-lg-3,
  .row > .col-xl-3,
  .row > [class*="col-md-3"],
  .row > [class*="col-lg-3"],
  .row > [class*="col-xl-3"] {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

/* ═══════════════════════════════════════
   6. DASHBOARD RECRUTEUR - FIXES SPÉCIFIQUES
═══════════════════════════════════════ */

/* Header avec info entreprise */
@media (max-width: 767.98px) {
  .card.bg-primary .card-body {
    padding: 1rem !important;
  }
  
  .card.bg-primary .card-body h1 {
    font-size: 1.125rem !important;
    margin-bottom: 0.25rem !important;
  }
  
  .card.bg-primary .card-body p {
    font-size: 0.8125rem !important;
    margin-bottom: 0.75rem !important;
  }
  
  /* Bouton "Publier une Offre" pleine largeur */
  .card.bg-primary .btn-light {
    width: 100%;
    margin-top: 0.5rem;
  }
  
  .card.bg-primary .text-md-end {
    text-align: center !important;
  }
}

/* Actions rapides - grille 2x3 */
@media (max-width: 767.98px) {
  .card .row > .col-md-2 {
    flex: 0 0 33.333% !important;
    max-width: 33.333% !important;
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
    margin-bottom: 0.5rem;
  }
  
  /* Boutons actions rapides compacts */
  .card .row > .col-md-2 .btn {
    padding: 0.5rem 0.25rem !important;
    font-size: 0.6875rem !important;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  .card .row > .col-md-2 .btn i {
    font-size: 1.25rem !important;
    margin-bottom: 0.25rem !important;
  }
  
  .card .row > .col-md-2 .btn small {
    font-size: 0.625rem !important;
    line-height: 1.2 !important;
    text-align: center;
  }
}

/* Petit mobile - actions en 2 colonnes */
@media (max-width: 374.98px) {
  .card .row > .col-md-2 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
}

/* ═══════════════════════════════════════
   7. TABLES MOBILES - SCROLL HORIZONTAL
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  .table-responsive {
    margin: 0 calc(var(--card-padding-mobile) * -1);
    padding: 0 var(--card-padding-mobile);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    min-width: 600px;
    font-size: 0.8125rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem 0.625rem;
    white-space: nowrap;
  }
  
  /* Première colonne sticky */
  .table th:first-child,
  .table td:first-child {
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
  }
}

/* ═══════════════════════════════════════
   8. BOUTONS MOBILES
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Boutons de base plus grands pour touch */
  .btn {
    min-height: 42px;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
  }
  
  .btn-sm {
    min-height: 34px;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }
  
  .btn-lg {
    min-height: 50px;
    font-size: 1rem;
  }
  
  /* Groupe de boutons en colonne */
  .btn-group-vertical-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .btn-group-vertical-mobile .btn {
    width: 100%;
  }
  
  /* Boutons d'action dans les cartes */
  .card-footer .btn,
  .card-body > .btn:last-child {
    width: 100%;
  }
}

/* ═══════════════════════════════════════
   9. FORMULAIRES MOBILES
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  .form-control,
  .form-select {
    font-size: 1rem !important; /* Évite le zoom iOS */
    min-height: 44px;
    padding: 0.625rem 0.875rem;
  }
  
  .form-label {
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
  }
  
  /* Groupes de formulaires */
  .mb-3 {
    margin-bottom: 1rem !important;
  }
  
  /* Input groups */
  .input-group .form-control {
    font-size: 0.9375rem !important;
  }
}

/* ═══════════════════════════════════════
   10. AVATARS ET IMAGES
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Avatars plus petits */
  .avatar-md {
    width: 38px !important;
    height: 38px !important;
  }
  
  .avatar-lg {
    width: 48px !important;
    height: 48px !important;
  }
  
  .avatar-xl {
    width: 64px !important;
    height: 64px !important;
  }
  
  /* Icons dans avatars */
  .avatar-md i {
    font-size: 1rem !important;
  }
  
  .avatar-lg i {
    font-size: 1.25rem !important;
  }
}

/* ═══════════════════════════════════════
   11. BADGES ET LABELS
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  .badge {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
  }
  
  /* Badges dans les titres */
  .card-title .badge,
  h1 .badge, h2 .badge, h3 .badge, h4 .badge, h5 .badge {
    font-size: 0.625rem;
    vertical-align: middle;
    margin-left: 0.25rem;
  }
}

/* ═══════════════════════════════════════
   12. LISTES ET ITEMS
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* List items */
  .list-group-item {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  /* List dans cartes */
  .card-body .list-group {
    margin-left: calc(var(--card-padding-mobile) * -1);
    margin-right: calc(var(--card-padding-mobile) * -1);
  }
  
  .card-body .list-group-flush .list-group-item:first-child {
    border-top: 0;
  }
}

/* ═══════════════════════════════════════
   13. EMPTY STATES
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  .empty-state,
  .text-center.py-5 {
    padding: 2rem 1rem !important;
  }
  
  .empty-state i,
  .text-center.py-5 i.display-1 {
    font-size: 3rem !important;
  }
  
  .empty-state h4,
  .empty-state h5 {
    font-size: 1rem !important;
  }
  
  .empty-state p {
    font-size: 0.875rem !important;
  }
}

/* ═══════════════════════════════════════
   14. MODALS MOBILES - FULL SCREEN
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  .modal-dialog {
    margin: 0;
    max-width: 100%;
    min-height: 100vh;
  }
  
  .modal-content {
    border-radius: 0;
    min-height: 100vh;
  }
  
  .modal-header {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    padding: 1rem;
    border-bottom: 1px solid #e8e8e8;
  }
  
  .modal-body {
    padding: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .modal-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0));
    border-top: 1px solid #e8e8e8;
  }
  
  .modal-footer .btn {
    flex: 1;
  }
}

/* ═══════════════════════════════════════
   15. ALERTES ET NOTIFICATIONS
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  .alert {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-radius: 10px;
  }
  
  .alert-heading {
    font-size: 1rem;
  }
  
  /* Toast notifications */
  .toast {
    max-width: calc(100vw - 2rem);
  }
}

/* ═══════════════════════════════════════
   16. PAGE HEADER BREADCRUMB FIXES
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  .page-header-breadcrumb {
    padding: 0.5rem 0 !important;
    margin-bottom: 0.75rem !important;
  }
  
  .page-header-breadcrumb .fs-semibold {
    font-size: 0.75rem !important;
  }
  
  /* Cacher le breadcrumb sur très petit mobile */
  @media (max-width: 374.98px) {
    .page-header-breadcrumb span.text-muted {
      display: none;
    }
  }
}

/* ═══════════════════════════════════════
   17. DASHBOARD CANDIDAT STATS CARDS
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Wrapper des stats */
  .row.mb-4 > [class*="col-6"] {
    padding-left: 0.375rem !important;
    padding-right: 0.375rem !important;
  }
  
  /* Stats cards compactes */
  .card.custom-card {
    margin-bottom: 0.75rem;
  }
  
  .card.custom-card .d-flex {
    gap: 0.5rem;
  }
  
  /* Valeurs stats */
  .card.custom-card h2,
  .card.custom-card .fw-semibold.mb-0 {
    font-size: 1.25rem !important;
    line-height: 1.2;
  }
  
  /* Labels stats */
  .card.custom-card .text-muted.fs-13,
  .card.custom-card span.d-block.fs-13 {
    font-size: 0.6875rem !important;
    line-height: 1.3;
  }
  
  /* Sous-texte */
  .card.custom-card .fs-12 {
    font-size: 0.625rem !important;
  }
}

/* ═══════════════════════════════════════
   18. Z-INDEX HIERARCHY FIX
═══════════════════════════════════════ */

/* Assurer que le contenu ne passe jamais AU-DESSUS de la navbar */
.main-content.app-content {
  position: relative;
  z-index: 1;
}

.app-header {
  position: fixed !important;
  z-index: 1030 !important;
}

/* Bottom nav toujours visible */
.mobile-bottom-nav {
  z-index: 1050 !important;
}

/* Sidebar au-dessus quand ouverte */
.app-sidebar.open,
[data-toggled="open"] .app-sidebar {
  z-index: 1040 !important;
}

/* Overlay entre contenu et sidebar */
#responsive-overlay.active {
  z-index: 1035 !important;
}

/* ═══════════════════════════════════════
   19. FIXES SUPPLÉMENTAIRES POUR RECRUTEUR
═══════════════════════════════════════ */

/* Cards avec couleur de fond (stats) */
@media (max-width: 767.98px) {
  .card.bg-primary .card-body,
  .card.bg-warning .card-body,
  .card.bg-info .card-body,
  .card.bg-success .card-body,
  .card.bg-danger .card-body,
  .card.bg-secondary .card-body {
    padding: var(--card-padding-mobile) !important;
  }
  
  .card.bg-primary h2,
  .card.bg-warning h2,
  .card.bg-info h2,
  .card.bg-success h2,
  .card.bg-danger h2,
  .card.bg-secondary h2 {
    font-size: 1.25rem !important;
  }
  
  .card.bg-primary h6,
  .card.bg-warning h6,
  .card.bg-info h6,
  .card.bg-success h6,
  .card.bg-danger h6,
  .card.bg-secondary h6 {
    font-size: 0.75rem !important;
    margin-bottom: 0.25rem !important;
  }
  
  .card.bg-primary i,
  .card.bg-warning i,
  .card.bg-info i,
  .card.bg-success i,
  .card.bg-danger i,
  .card.bg-secondary i {
    font-size: 1.5rem !important;
  }
}

/* Text truncate helper pour les titres longs */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-truncate-1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Min width pour flex items */
.min-width-0 {
  min-width: 0;
}

/* Utility class pour forcer le padding sur mobile */
@media (max-width: 767.98px) {
  .py-mobile-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }
  
  .px-mobile-2 {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  .p-mobile-2 {
    padding: 0.5rem !important;
  }
  
  .p-mobile-3 {
    padding: 0.75rem !important;
  }
}

/* ═══════════════════════════════════════
   20. SPACING MOBILE - GARANTIE NO OVERLAP
═══════════════════════════════════════ */

/* S'assurer que le premier élément dans le contenu a assez d'espace */
@media (max-width: 991.98px) {
  .main-content.app-content .container-fluid > .row:first-child,
  .main-content.app-content .container-fluid > div:first-child {
    margin-top: 0 !important;
  }
  
  /* Page header breadcrumb ne doit pas être collé */
  .page-header-breadcrumb {
    margin-top: 0 !important;
    padding-top: 0.5rem !important;
  }
}

/* ═══════════════════════════════════════
   21. CARTES AVEC SCROLL INTERNE
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Limite la hauteur des listes dans les cartes */
  .card-body-scroll {
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Indicateur de scroll */
  .card-body-scroll::after {
    content: '';
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(transparent, white);
    pointer-events: none;
  }
}

/* ═══════════════════════════════════════
   22. OPTIMISATION PERFORMANCE MOBILE
═══════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Reduce repaints */
  .card,
  .btn,
  .form-control {
    will-change: auto;
  }
  
  /* Smooth scrolling dans les containers */
  .app-content,
  .main-content,
  .container-fluid {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Disable hover effects on touch devices for better performance */
  @media (hover: none) {
    .card:hover,
    .btn:hover {
      transform: none !important;
      box-shadow: inherit !important;
    }
  }
}

/* ═══════════════════════════════════════════════════════════════════
   23. RÈGLE UNIVERSELLE COL-6 MOBILE
   ═══════════════════════════════════════════════════════════════════
   PRINCIPE: Sur mobile, TOUTES les cartes = col-6 (50% largeur)
   12 colonnes Bootstrap / 2 = 6 colonnes par carte
   Cela assure une mise en forme uniforme sur tous les écrans mobiles
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* ═══ RESET: Forcer col-6 pour tous les conteneurs de cartes ═══ */
  
  /* Colonnes contenant des cartes stats/dashboard - TOUJOURS col-6 */
  .row > [class*="col-md-3"],
  .row > [class*="col-md-4"],
  .row > [class*="col-lg-3"],
  .row > [class*="col-lg-4"],
  .row > [class*="col-xl-3"],
  .row > [class*="col-xl-4"] {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    width: 50% !important;
  }
  
  /* Exception: col-12 reste col-12 (cartes pleine largeur) */
  .row > .col-12:not(.col-md-3):not(.col-md-4):not(.col-lg-3):not(.col-lg-4) {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  
  /* Exception: col-6 explicite reste col-6 */
  .row > .col-6 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
  
  /* Petites colonnes (col-md-2) = col-4 sur mobile (3 par ligne) */
  .row > [class*="col-md-2"],
  .row > [class*="col-lg-2"] {
    flex: 0 0 33.333% !important;
    max-width: 33.333% !important;
  }
  
  /* Colonnes moyennes (col-md-6) = col-12 sur mobile */
  .row > [class*="col-md-6"]:not(.col-6),
  .row > [class*="col-lg-6"]:not(.col-6) {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  
  /* Grandes colonnes (col-md-8, col-md-9) = col-12 sur mobile */
  .row > [class*="col-md-8"],
  .row > [class*="col-md-9"],
  .row > [class*="col-lg-8"],
  .row > [class*="col-lg-9"] {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}

/* Petit mobile: garder col-6 mais ajuster les gaps */
@media (max-width: 575.98px) {
  .row > [class*="col-md-3"],
  .row > [class*="col-md-4"],
  .row > [class*="col-lg-3"],
  .row > [class*="col-lg-4"],
  .row > [class*="col-xl-3"],
  .row > [class*="col-xl-4"] {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    padding-left: 0.375rem !important;
    padding-right: 0.375rem !important;
  }
  
  /* Réduire les gaps entre colonnes */
  .row.g-3,
  .row.g-4 {
    --bs-gutter-x: 0.5rem !important;
    --bs-gutter-y: 0.5rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   24. PAGE CONNEXION / INSCRIPTION - PLEINE LARGEUR MOBILE
   ═══════════════════════════════════════════════════════════════════
   Les formulaires d'auth doivent occuper toute la largeur sur mobile
═══════════════════════════════════════════════════════════════════ */

/* Page de connexion - Carte principale */
@media (max-width: 767.98px) {
  /* Formulaire de connexion - pleine largeur */
  .col-lg-5.col-md-7,
  .col-lg-6.col-md-8,
  [class*="col-lg-5"][class*="col-md-7"],
  [class*="col-lg-6"][class*="col-md-8"] {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  
  /* Réduire les marges sur la carte de connexion */
  section.py-5 > .container > .row > [class*="col-lg"] > .card {
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 16px !important;
  }
  
  /* Input groups - pleine largeur */
  .input-group,
  .form-control,
  .form-select {
    width: 100% !important;
  }
  
  /* Padding adapté pour les champs */
  .form-control,
  .form-select {
    padding: 12px 14px !important;
    font-size: 16px !important; /* Évite le zoom sur iOS */
  }
  
  /* Bouton de soumission - pleine largeur */
  form .btn[type="submit"],
  form button[type="submit"],
  .btn.w-100 {
    width: 100% !important;
    padding: 14px 20px !important;
    font-size: 1rem !important;
  }
}

/* Très petit mobile */
@media (max-width: 575.98px) {
  /* Carte de connexion - encore moins de padding */
  section.py-5 > .container > .row > [class*="col-lg"] > .card .card-body {
    padding: 1.25rem !important;
  }
  
  /* Icône de header - plus petite */
  section.py-5 .rounded-circle[style*="width: 70px"] {
    width: 56px !important;
    height: 56px !important;
  }
  
  /* Titres plus compacts */
  section.py-5 h2.fw-bold {
    font-size: 1.25rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   25. CHAMPS TÉLÉPHONE INTERNATIONAL - LARGEUR ADAPTÉE
   ═══════════════════════════════════════════════════════════════════
   Les champs téléphone doivent s'afficher correctement sur mobile
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Container du champ téléphone */
  .iti,
  .iti--allow-dropdown,
  .intl-tel-input {
    width: 100% !important;
    display: block !important;
  }
  
  /* Input du téléphone */
  .iti input,
  .iti__tel-input,
  input[type="tel"] {
    width: 100% !important;
    padding-left: 52px !important; /* Espace pour le drapeau */
    font-size: 16px !important; /* Évite le zoom sur iOS */
  }
  
  /* Dropdown des pays */
  .iti__country-list {
    width: calc(100vw - 2rem) !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
  }
  
  /* Drapeau sélectionné */
  .iti__flag-container {
    padding-left: 8px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   26. CARTES UNIFORMES - MÊME HAUTEUR DANS UNE LIGNE
   ═══════════════════════════════════════════════════════════════════
   Les cartes côte à côte doivent avoir la même hauteur
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Forcer même hauteur pour les cartes dans une row */
  .row.row-cols-2 > [class*="col"],
  .row > .col-6 {
    display: flex;
    flex-direction: column;
  }
  
  .row.row-cols-2 > [class*="col"] > .card,
  .row > .col-6 > .card {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  
  .row.row-cols-2 > [class*="col"] > .card > .card-body,
  .row > .col-6 > .card > .card-body {
    flex: 1;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   27. FORMULAIRES - LABELS ET INPUTS ADAPTÉS
   ═══════════════════════════════════════════════════════════════════
   Labels visibles, inputs pleine largeur
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Labels toujours visibles */
  .form-label {
    font-size: 0.875rem !important;
    margin-bottom: 0.375rem !important;
    display: block !important;
  }
  
  /* Inputs - hauteur confortable pour le toucher */
  .form-control,
  .form-select {
    min-height: 48px !important;
    font-size: 16px !important; /* Évite le zoom automatique iOS */
  }
  
  /* Select avec dropdown */
  .form-select {
    background-position: right 12px center !important;
    padding-right: 36px !important;
  }
  
  /* Textarea - hauteur minimum */
  textarea.form-control {
    min-height: 100px !important;
  }
  
  /* Checkboxes et radios - plus grands pour le toucher */
  .form-check-input {
    width: 20px !important;
    height: 20px !important;
    margin-top: 0.125rem !important;
  }
  
  .form-check-label {
    font-size: 0.875rem !important;
    padding-left: 0.5rem !important;
  }
  
  /* Form groups - espacement uniforme */
  .mb-3,
  .mb-4,
  .form-group {
    margin-bottom: 1rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   28. BOUTONS - TAILLE TACTILE MINIMUM 44px
   ═══════════════════════════════════════════════════════════════════
   Apple recommande 44px minimum pour les zones tactiles
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Boutons standard - hauteur minimum */
  .btn {
    min-height: 44px !important;
    padding: 10px 16px !important;
    font-size: 0.9375rem !important;
  }
  
  /* Petits boutons - quand même tactiles */
  .btn-sm {
    min-height: 36px !important;
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
  }
  
  /* Boutons icônes seules */
  .btn-icon,
  .btn[class*="btn-outline-"]:has(i:only-child) {
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 8px !important;
  }
  
  /* Groupe de boutons - espacement */
  .btn-group .btn,
  .btn-group-sm .btn {
    min-height: 36px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   29. MODALS - PLEINE LARGEUR SUR MOBILE
   ═══════════════════════════════════════════════════════════════════
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  .modal-dialog {
    margin: 0.5rem !important;
    max-width: calc(100% - 1rem) !important;
  }
  
  .modal-content {
    border-radius: 16px !important;
  }
  
  .modal-header {
    padding: 1rem !important;
  }
  
  .modal-body {
    padding: 1rem !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
  }
  
  .modal-footer {
    padding: 0.75rem 1rem !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }
  
  .modal-footer .btn {
    flex: 1 1 auto !important;
    min-width: 120px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   30. DASHBOARD CANDIDAT/RECRUTEUR - CARTES STATS UNIFORMES
   ═══════════════════════════════════════════════════════════════════
   Toutes les cartes de stats = col-6 avec même style
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Cartes stats - col-6 forcé */
  .row > [class*="col-"][class*="-3"]:has(.card.custom-card),
  .row > [class*="col-"][class*="-4"]:has(.card.custom-card) {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
  
  /* Style uniforme pour toutes les cartes stats */
  .card.custom-card {
    min-height: 100px !important;
    margin-bottom: 0.75rem !important;
  }
  
  /* Contenu des cartes stats - centré */
  .card.custom-card .card-body {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    padding: 0.875rem !important;
  }
  
  /* Chiffres stats - taille adaptée */
  .card.custom-card .fs-5,
  .card.custom-card .fw-bold[style*="font-size"] {
    font-size: 1.25rem !important;
  }
  
  /* Labels stats - compact */
  .card.custom-card .text-muted,
  .card.custom-card .fs-13 {
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  
  /* Icônes dans les cartes stats */
  .card.custom-card .avatar,
  .card.custom-card [class*="avatar-"] {
    width: 40px !important;
    height: 40px !important;
  }
  
  .card.custom-card .avatar i,
  .card.custom-card [class*="avatar-"] i {
    font-size: 1.125rem !important;
  }
}

/* Très petit mobile - cartes stats encore plus compactes */
@media (max-width: 375px) {
  .card.custom-card .card-body {
    padding: 0.625rem !important;
  }
  
  .card.custom-card .fs-5,
  .card.custom-card .fw-bold[style*="font-size"] {
    font-size: 1.125rem !important;
  }
  
  .card.custom-card .text-muted,
  .card.custom-card .fs-13 {
    font-size: 0.6875rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 31: Cartes Emplois Recommandés - Mobile
   Fix pour affichage liste d'emplois sur mobile
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Container des emplois - padding réduit */
  .card.custom-card .card-body > .d-flex.align-items-center {
    padding: 0.5rem 0 !important;
    flex-wrap: wrap !important;
  }
  
  /* Job title - truncation propre */
  .card.custom-card .card-body .fw-semibold.fs-13 {
    font-size: 0.8125rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: calc(100% - 60px) !important;
    display: block !important;
  }
  
  /* Company/Location info - compact */
  .card.custom-card .card-body .text-muted.fs-11 {
    font-size: 0.6875rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    max-width: 100% !important;
  }
  
  /* Bouton "Voir" - compact */
  .card.custom-card .card-body .btn-sm.btn-primary-light,
  .card.custom-card .card-body a.btn-sm[href*="jobs/view"] {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.6875rem !important;
    min-width: 45px !important;
    white-space: nowrap !important;
  }
  
  /* Card headers - titre tronqué */
  .card.custom-card .card-header .card-title {
    font-size: 0.875rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 60% !important;
  }
  
  /* Card header - bouton "Voir Plus" */
  .card.custom-card .card-header .btn-sm {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.6875rem !important;
  }
  
  /* Flex fill - éviter overflow */
  .card.custom-card .flex-fill {
    overflow: hidden !important;
    min-width: 0 !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 32: Profile Card - Mobile Text Overflow Fix
   Fix pour texte qui déborde sur page profil
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Profile info card - layout vertical sur mobile */
  .card.custom-card .d-flex.align-items-top {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 1rem !important;
  }
  
  /* Avatar - centré */
  .card.custom-card .d-flex.align-items-top .me-3 {
    margin-right: 0 !important;
    margin-bottom: 1rem !important;
  }
  
  /* Nom utilisateur - taille adaptée */
  .card.custom-card .d-flex.align-items-top h5.fw-semibold {
    font-size: 1rem !important;
    word-break: break-word !important;
  }
  
  /* Email - tronqué */
  .card.custom-card .d-flex.align-items-top p.fs-12 {
    font-size: 0.75rem !important;
    word-break: break-all !important;
    max-width: 100% !important;
  }
  
  /* Location info - retour à la ligne */
  .card.custom-card .d-flex.align-items-top .text-muted span {
    display: block !important;
    white-space: normal !important;
    line-height: 1.4 !important;
    margin-bottom: 0.25rem !important;
  }
  
  /* Badges experience/availability */
  .card.custom-card .d-flex.align-items-top .d-flex.mt-2 {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.25rem !important;
  }
  
  .card.custom-card .d-flex.align-items-top .badge {
    font-size: 0.65rem !important;
    padding: 0.2rem 0.4rem !important;
  }
  
  /* Biographie section */
  .card.custom-card .p-4.border-bottom {
    padding: 0.75rem !important;
  }
  
  .card.custom-card .p-4 p.text-muted {
    font-size: 0.8125rem !important;
    line-height: 1.5 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }
  
  /* Liens sociaux - boutons plus petits */
  .card.custom-card .btn-list .btn-sm {
    padding: 0.3rem 0.5rem !important;
    font-size: 0.75rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 33: Card Container Full Width Mobile
   Toutes les colonnes col-lg-4 = col-12 sur mobile
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 991.98px) {
  /* Colonnes sidebar (col-lg-4) = full width sur tablette/mobile */
  .row > .col-lg-4:not([class*="col-6"]):not([class*="col-md-"]) {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  
  /* Colonnes principales (col-lg-8) = full width sur tablette/mobile */
  .row > .col-lg-8:not([class*="col-6"]):not([class*="col-md-"]) {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 767.98px) {
  /* FORCE: toutes les cartes col-12 sur mobile */
  .row > [class*="col-lg-"]:not([class*="col-6"]):not(.col-md-6):not(.col-md-3) {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  
  /* Cards full width - meilleur padding */
  .card.custom-card {
    margin-bottom: 1rem !important;
  }
  
  .card.custom-card .card-body {
    padding: 0.875rem !important;
  }
  
  /* Banner Premium - compact */
  .alert[style*="gradient"] .d-flex {
    flex-wrap: wrap !important;
  }
  
  .alert[style*="gradient"] .flex-grow-1 {
    flex-basis: 100% !important;
    margin-bottom: 0.75rem !important;
  }
  
  .alert[style*="gradient"] h5.alert-heading {
    font-size: 1rem !important;
  }
  
  .alert[style*="gradient"] p {
    font-size: 0.8125rem !important;
  }
  
  /* Progress bar container */
  .progress-sm {
    height: 6px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 34: Très petit écran (< 400px) - Ultra compact
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 400px) {
  /* Profile card - encore plus compact */
  .card.custom-card .d-flex.align-items-top {
    padding: 0.75rem !important;
  }
  
  .card.custom-card .avatar-xl {
    width: 60px !important;
    height: 60px !important;
  }
  
  .card.custom-card .d-flex.align-items-top h5 {
    font-size: 0.9375rem !important;
  }
  
  /* Job items - super compact */
  .card.custom-card .card-body .fw-semibold.fs-13 {
    font-size: 0.75rem !important;
  }
  
  .card.custom-card .card-body .text-muted.fs-11 {
    font-size: 0.625rem !important;
  }
  
  /* Card headers - super compact */
  .card.custom-card .card-header {
    padding: 0.5rem 0.75rem !important;
  }
  
  .card.custom-card .card-header .card-title {
    font-size: 0.8125rem !important;
  }
  
  /* Buttons - minimum size */
  .btn-sm {
    padding: 0.2rem 0.4rem !important;
    font-size: 0.625rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION 35: Login/Auth Forms - Input Group Fix Mobile
   Fix pour champs de connexion qui se dédoublent sur mobile
═══════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
  /* Input groups - FORCER ligne horizontale */
  .input-group {
    flex-wrap: nowrap !important;
    display: flex !important;
    flex-direction: row !important;
  }
  
  /* Icon container - taille fixe */
  .input-group .input-group-text {
    flex-shrink: 0 !important;
    width: auto !important;
    min-width: 45px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.5rem 0.75rem !important;
  }
  
  /* Input field - prendre tout l'espace restant */
  .input-group .form-control {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    padding: 0.75rem 0.875rem !important;
  }
  
  /* Toggle password button */
  .input-group .btn {
    flex-shrink: 0 !important;
    width: auto !important;
    padding: 0.5rem 0.75rem !important;
  }
  
  /* Card login - padding réduit sur mobile */
  .card .card-body.p-4.p-md-5 {
    padding: 1.25rem !important;
  }
  
  /* Titre "Bienvenue" - taille adaptée */
  .card-body h2.fw-bold {
    font-size: 1.375rem !important;
  }
  
  /* Icône header - plus petite */
  .card-body .rounded-circle[style*="width: 70px"] {
    width: 55px !important;
    height: 55px !important;
  }
  
  .card-body .rounded-circle i[style*="font-size: 1.8rem"] {
    font-size: 1.4rem !important;
  }
  
  /* Labels des champs */
  .card-body .form-label {
    font-size: 0.875rem !important;
    margin-bottom: 0.375rem !important;
  }
  
  /* Checkbox "Se souvenir de moi" et lien "Mot de passe oublié" */
  .card-body .d-flex.justify-content-between {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }
  
  .card-body .form-check {
    gap: 6px !important;
  }
  
  .card-body .form-check-label {
    font-size: 0.8125rem !important;
  }
  
  .card-body a.small[href*="forgot-password"] {
    font-size: 0.8125rem !important;
  }
  
  /* Bouton "Se connecter" */
  .card-body button[type="submit"].w-100 {
    padding: 0.875rem !important;
    font-size: 0.9375rem !important;
  }
  
  /* Lien "Créer un compte" */
  .card-body .text-center p {
    font-size: 0.875rem !important;
  }
}

/* Très petit mobile - formulaires encore plus compacts */
@media (max-width: 375px) {
  .card .card-body.p-4.p-md-5 {
    padding: 1rem !important;
  }
  
  .input-group .input-group-text {
    min-width: 40px !important;
    padding: 0.4rem 0.6rem !important;
  }
  
  .input-group .form-control {
    padding: 0.625rem 0.75rem !important;
    font-size: 0.875rem !important;
  }
  
  .card-body h2.fw-bold {
    font-size: 1.25rem !important;
  }
  
  .card-body .rounded-circle[style*="width: 70px"] {
    width: 50px !important;
    height: 50px !important;
  }
}
