/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Variables CSS */
:root {
    --primary-color: #618ac8;
    --secondary-color: #be1818;
    --text-on-primary: white;
    --text-color: #333;
    --border-color: #dee2e6;
    --bg-light: #f8f9fa;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Layout de base - Mobile First */
.wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout pour header horizontal */
.wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header par défaut (ancien style) */
header {
    background: var(--primary-color);
    color: var(--text-on-primary);
    padding: 1rem;
    position: relative;
    box-shadow: var(--shadow);
}

/* Header moderne */
.header-horizontal {
    background: linear-gradient(135deg, rgba(97,138,200,0.95), rgba(74,107,168,0.95));
    backdrop-filter: saturate(120%) blur(6px);
    -webkit-backdrop-filter: saturate(120%) blur(6px);
}

/* Avatar utilisateur + menu */
.user-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: var(--text-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    cursor: pointer;
    margin-left: .75rem;
}
.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--primary-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 180px;
    display: none;
    overflow: hidden;
    z-index: 1002;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
    display: block;
    padding: .65rem .9rem;
    color: var(--text-on-primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.user-dropdown a:last-child { border-bottom: none; }
.user-dropdown a:hover { background: rgba(255,255,255,0.1); }

/* Effet soulignement animé sur liens desktop */
.nav-menu-desktop a {
    position: relative;
}
.nav-menu-desktop a::after {
    content: '';
    position: absolute;
    left: 10%;
    bottom: 6px;
    width: 0;
    height: 2px;
    background: rgba(255,255,255,0.7);
    transition: width .25s ease;
}
.nav-menu-desktop a:hover::after { width: 80%; }

/* Menu hamburger pour header horizontal (mobile uniquement) */
.header-horizontal .menu-toggle {
    display: block;
    background: none;
    border: none;
    color: var(--text-on-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Menu horizontal pour PC avec sous-menus */
.nav-menu-desktop {
    display: none;
    align-items: center;
    gap: 1rem;
}

.nav-menu-desktop a {
    color: var(--text-on-primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-size: 0.9rem;
}

.nav-menu-desktop a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Sous-menus pour desktop */
.nav-item-with-submenu-desktop {
    position: relative;
}

.nav-link-with-submenu-desktop {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.nav-link-with-submenu-desktop::after {
    content: '▼';
    font-size: 0.7rem;
    transition: transform 0.3s;
}

.nav-item-with-submenu-desktop:hover .nav-link-with-submenu-desktop::after {
    transform: rotate(180deg);
}

.submenu-desktop {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--primary-color);
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
    padding: 0.5rem 0;
}

.nav-item-with-submenu-desktop:hover .submenu-desktop {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.submenu-desktop a {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    white-space: nowrap;
}

.submenu-desktop a:last-child {
    border-bottom: none;
}

.submenu-desktop a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-user-desktop {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.user-email {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-right: 0.5rem;
}

.nav-user-desktop a {
    padding: 0.25rem 0.5rem;
    font-size: 1.2rem;
}

/* Navigation pour header horizontal (mobile) */
.header-horizontal .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-color);
    display: none;
    flex-direction: column;
    box-shadow: var(--shadow);
    z-index: 1000;
    max-height: 80vh;
    overflow-y: auto;
}

.header-horizontal .nav-menu.active {
    display: flex;
}

/* Cacher le menu desktop sur mobile */
.nav-menu-desktop {
    display: none;
}

/* Sous-menus pour mobile (accordéon) */
.nav-item-with-submenu {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link-with-submenu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 1rem;
    color: var(--text-on-primary);
    text-decoration: none;
    transition: background-color 0.3s;
}

.nav-link-with-submenu::after {
    content: '▼';
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.nav-item-with-submenu.active .nav-link-with-submenu::after {
    transform: rotate(180deg);
}

.nav-link-with-submenu:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.submenu {
    display: none;
    background-color: rgba(0, 0, 0, 0.1);
    padding-left: 1rem;
}

.nav-item-with-submenu.active .submenu {
    display: block;
}

.submenu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-on-primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.submenu a:last-child {
    border-bottom: none;
}

.submenu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 1rem; /* Utilise toute la largeur avec marges */
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.logo img {
    height: 40px;
    margin-right: 0.5rem;
}

/* Menu hamburger - Mobile */
.menu-toggle {
    display: block;
    background: none;
    border: none;
    color: var(--text-on-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-color);
    display: none;
    flex-direction: column;
    box-shadow: var(--shadow);
    z-index: 1000;
}

.nav-menu.active {
    display: flex;
}

.nav-menu a {
    color: var(--text-on-primary);
    text-decoration: none;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.3s;
}

.nav-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Navigation sections pour header horizontal */
.nav-section {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-weight: bold;
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    margin-bottom: 0.75rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-section-user {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1.5rem;
}

.user-info {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.logout-link {
    color: #ffcccc !important;
    font-weight: 500;
}

.logout-link:hover {
    background-color: rgba(255, 204, 204, 0.2) !important;
    color: #ffdddd !important;
}

/* Amélioration des liens de navigation */
.nav-menu a {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.nav-menu a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateX(3px);
}

/* Contenu principal */
main {
    flex: 1;
    padding: 1rem;
    margin: 0 1rem; /* Petites marges sur les côtés */
    width: calc(100% - 2rem); /* Largeur adaptée avec marges */
}

/* Main pour header horizontal */
.header-horizontal + main {
    margin-left: 0;
    width: 100%;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Footer */
footer {
    background: var(--primary-color);
    color: var(--text-on-primary);
    text-align: center;
    padding: 1rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-content p {
    margin: 0;
}

.footer-content a {
    color: var(--text-on-primary);
    text-decoration: none;
}

.footer-content a:hover {
    text-decoration: underline;
}

/* Formulaires */
.form-container {
    max-width: 400px;
    margin: 2rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Boutons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
}

.btn-primary:hover {
    background-color: #4a6b9a;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-on-primary);
}

.btn-secondary:hover {
    background-color: #a01515;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
}

.btn-block {
    width: 100%;
}

/* Boutons de petite taille pour les tableaux */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    min-width: auto;
}

/* Styles spécifiques pour les boutons d'action dans les tableaux */
.table-actions {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

.table-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    min-width: auto;
}

/* Messages d'alerte */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left-color: var(--secondary-color);
}

.alert-info {
    background-color: #cce7ff;
    color: #004085;
    border-left-color: var(--primary-color);
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.card-header {
    background: var(--primary-color);
    color: var(--text-on-primary);
    padding: 1rem;
    border-radius: 8px 8px 0 0;
    font-weight: bold;
}

.card-body {
    padding: 1rem;
}

/* Utilitaires */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Media Queries - Tablettes et plus */
@media (min-width: 768px) {
    main {
        padding: 2rem;
        margin: 0 2rem; /* Marges plus grandes sur tablette */
        width: calc(100% - 4rem);
    }
    
    .header-content {
        margin: 0 2rem; /* Cohérence avec le main */
    }
    
    .form-container {
        margin: 3rem auto;
    }
}

/* Media Queries - Desktop */
@media (min-width: 1024px) {
    body {
        margin-left: 0;
    }
    
    /* Header horizontal sur desktop */
    .header-horizontal {
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .header-horizontal .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 2rem;
    }

    /* Cacher le menu hamburger sur desktop */
    .header-horizontal .menu-toggle {
        display: none;
    }

    /* Cacher le menu mobile sur desktop */
    .header-horizontal .nav-menu {
        display: none !important;
    }

    /* Afficher le menu horizontal sur desktop */
    .nav-menu-desktop {
        display: flex !important;
    }

    main {
        flex: 1;
        padding: 2rem;
        max-width: 1400px;
        margin: 0 auto;
        width: 100%;
    }

    footer {
        margin-left: 0;
    }
    
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
    }

    /* plus de barre de recherche */
}

/* Responsive pour très grands écrans */
@media (min-width: 1400px) {
    main {
        padding: 2rem 4rem;
        margin-right: 3rem; /* Marges plus importantes sur très grands écrans */
        width: calc(100% - 3rem);
    }
}

/* Styles pour les modals */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
    background-color: #f8f9fa;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 1rem;
}

/* Styles spécifiques pour les modals (évite les conflits avec les styles existants) */
.modal .form-group {
    margin-bottom: 1rem;
}

.modal .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.modal .form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
}

.modal .form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.modal .form-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.modal .btn {
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-right: 0.5rem;
}

.modal .btn-primary {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.modal .btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.modal .btn-outline {
    background-color: transparent;
    color: #6c757d;
    border-color: #6c757d;
}

.modal .btn-outline:hover {
    background-color: #6c757d;
    color: white;
} 

/* Footer moderne (harmonisé avec header) */
.footer-modern {
  background: linear-gradient(135deg, rgba(97,138,200,0.95), rgba(74,107,168,0.95));
  color: var(--text-on-primary);
  backdrop-filter: saturate(120%) blur(6px);
  -webkit-backdrop-filter: saturate(120%) blur(6px);
  text-align: center;
  padding: 1.5rem 1rem;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-modern .footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.footer-modern .footer-content p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
  line-height: 1.4;
  text-align: center;
  width: 100%;
}

.footer-modern .footer-content p:first-child {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.footer-modern .footer-content strong {
  color: rgba(255,255,255,0.95);
  font-weight: 600;
}

.footer-modern .footer-content a { 
  color: var(--text-on-primary); 
  text-decoration: none;
  transition: all 0.3s ease;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.footer-modern .footer-content a:hover { 
  background: rgba(255,255,255,0.1);
  text-decoration: none;
  transform: translateY(-1px);
} 