/* css/style.css - Thème Rotary complet avec menu déroulant */

:root {
    /* Couleurs Rotary officielles */
    --rotary-blue: #17458f;
    --rotary-gold: #f7a81b;
    --azure: #0067c8;
    --sky-blue: #00a2e0;
    --success: #009739;
    --danger: #e02927;
    --purple: #901f93;
    --charcoal: #54565a;
    --slate: #657f99;
    --silver: #d0cfcd;
    --cloud: #d6d1ca;
    
    /* Palette étendue */
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #ecf0f1;
    --shadow: 0 2px 8px rgba(23, 69, 143, 0.1);
    --shadow-hover: 0 4px 16px rgba(23, 69, 143, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.4;
    overflow-x: hidden;
    font-size: 14px;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, var(--rotary-blue) 0%, var(--azure) 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.6rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-circle {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-radius: 6px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    font-size: 0.9rem;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.nav-link:hover::before {
    left: 0;
}

.nav-link:hover {
    color: white;
    transform: translateY(-2px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.nav-link svg {
    width: 20px;
    height: 20px;
}

/* Sous-menu déroulant navigation */
.nav-dropdown {
    position: relative;
}

.nav-link-with-dropdown {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
    margin-left: 0.2rem;
}

.nav-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 2000;
    margin-top: 0.5rem;
    overflow: hidden;
}

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

.nav-submenu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

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

.nav-submenu-item:hover {
    background: linear-gradient(135deg, var(--rotary-blue), var(--azure));
    color: white;
}

.nav-submenu-item svg {
    flex-shrink: 0;
}

/* Contenu principal */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.page.active {
    display: block;
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    font-size: 1.6rem;
    color: var(--rotary-blue);
    font-weight: 700;
    margin: 0;
}

.page-header .header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
}

.page-header .header-content h2 {
    white-space: nowrap;
}

.page-header .header-content .subtitle {
    white-space: nowrap;
}

/* Radio buttons pour vue */
.view-toggle {
    display: flex;
    gap: 1rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.radio-label input[type="radio"] {
    cursor: pointer;
}

/* Vue agenda */
.agenda-view {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.agenda-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.agenda-table th {
    background: var(--rotary-blue);
    color: white;
    padding: 0.4rem 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    border-right: 2px solid white;
}

.agenda-table th:last-child {
    border-right: none;
}

.agenda-table td {
    padding: 0.03rem;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.75rem;
    vertical-align: top;
}

.agenda-table td.day-letter {
    text-align: center;
    color: var(--text-secondary);
    font-weight: 600;
    width: 10px;
    border-right: none;
    border-left: 2px solid #e0e0e0;
}

.agenda-table td.event-cell {
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100px;
    border-right: 2px solid #ccc;
}

.agenda-table td.weekend {
    background: #f5f5f5;
}

.agenda-table td.event-cell:hover {
    background: rgba(23, 69, 143, 0.1);
}

.agenda-table td.event-cell.has-event {
    color: var(--rotary-blue);
    font-weight: 500;
}

.agenda-table td.event-cell.has-event:hover {
    background: rgba(23, 69, 143, 0.15);
    color: var(--rotary-blue);
}

.agenda-table tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.agenda-month-header {
    font-size: 0.8rem;
    text-transform: uppercase;
}

.fade-in {
    animation: fadeInText 0.8s ease-out;
}

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

.subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
}

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--rotary-blue), var(--azure));
    color: white;
    box-shadow: 0 4px 12px rgba(23, 69, 143, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 69, 143, 0.4);
}

.btn-secondary {
    background: var(--slate);
    color: white;
}

.btn-secondary:hover {
    background: var(--charcoal);
}

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

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    padding: 0.8rem;
    box-shadow: var(--shadow);
    margin-bottom: 0.8rem;
    transition: var(--transition);
    animation: scaleIn 0.4s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

/* Barre de recherche */
.search-bar {
    position: relative;
    margin-bottom: 1rem;
}

.search-bar svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-bar input {
    width: 100%;
    padding: 0.65rem 0.875rem 0.65rem 2.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--rotary-blue);
    box-shadow: 0 0 0 3px rgba(23, 69, 143, 0.1);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.35rem 0.35rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--rotary-blue);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(23, 69, 143, 0.03);
    transform: translateX(4px);
}

.table tbody tr.present-row {
    background: rgba(0, 151, 57, 0.05);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.55rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.badge-success {
    background: rgba(0, 151, 57, 0.1);
    color: var(--success);
}

.badge-danger {
    background: rgba(224, 41, 39, 0.1);
    color: var(--danger);
}

.badge-warning {
    background: rgba(247, 168, 27, 0.1);
    color: var(--rotary-gold);
}

.badge-info {
    background: rgba(0, 162, 224, 0.1);
    color: var(--sky-blue);
}

/* Grille d'événements */
.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.4rem;
}

.event-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--rotary-blue);
    margin: 0;
}

.event-type {
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    background: rgba(0, 103, 200, 0.1);
    color: var(--azure);
}

.event-description {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    font-size: 0.9rem;
}

.event-info {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.event-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}


/* Menu déroulant des événements */
.event-card {
    position: relative;
    background: white;
    border-radius: 10px;
    padding: 0.6rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: visible; /* Changé de hidden à visible pour le menu */
}

.event-menu-trigger {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rotary-blue), var(--azure));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(23, 69, 143, 0.3);
    transition: all 0.3s ease;
    z-index: 10;
}

.event-menu-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(23, 69, 143, 0.4);
}

.event-menu-trigger svg {
    width: 16px;
    height: 16px;
    color: white;
    transition: transform 0.3s ease;
}

.event-menu-trigger.active svg {
    transform: rotate(180deg);
}

.event-actions-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 2500;
    overflow: hidden;
}

.event-actions-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Petite flèche pointant vers le bouton - sera positionnée dynamiquement */
.event-actions-menu::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    z-index: -1;
}

/* Flèche en bas quand menu au-dessus */
.event-actions-menu.position-top::after {
    bottom: -8px;
    right: 8px;
    transform: rotate(45deg);
}

/* Flèche en haut quand menu en-dessous */
.event-actions-menu.position-bottom::after {
    top: -8px;
    right: 8px;
    transform: rotate(225deg);
}

.event-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.event-menu-item:last-child {
    border-bottom: none;
}

.event-menu-item:hover {
    background: var(--bg-light);
}

.event-menu-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--rotary-blue);
}

.event-menu-item.danger svg {
    color: var(--danger);
}

.event-menu-item.danger:hover {
    background: rgba(224, 41, 39, 0.1);
    color: var(--danger);
}

.event-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

/* Animation d'entrée pour les items du menu */
.event-actions-menu.active .event-menu-item {
    animation: slideInMenuItem 0.3s ease-out forwards;
    opacity: 0;
}

.event-actions-menu.active .event-menu-item:nth-child(1) {
    animation-delay: 0.05s;
}

.event-actions-menu.active .event-menu-item:nth-child(2) {
    animation-delay: 0.1s;
}

.event-actions-menu.active .event-menu-item:nth-child(3) {
    animation-delay: 0.15s;
}

.event-actions-menu.active .event-menu-item:nth-child(4) {
    animation-delay: 0.2s;
}

.event-actions-menu.active .event-menu-item:nth-child(6) {
    animation-delay: 0.25s;
}

.event-actions-menu.active .event-menu-item:nth-child(7) {
    animation-delay: 0.3s;
}

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

/* ===== MENU DÉROULANT DANS LE MODAL DÉTAIL ===== */
.modal-footer {
    position: relative;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
}

.event-menu-trigger-modal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rotary-blue), var(--azure));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(23, 69, 143, 0.3);
    transition: all 0.3s ease;
    z-index: 10;
}

.event-menu-trigger-modal:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(23, 69, 143, 0.4);
}

.event-menu-trigger-modal svg {
    width: 18px;
    height: 18px;
    color: white;
    transition: transform 0.3s ease;
}

.event-menu-trigger-modal.active svg {
    transform: rotate(180deg);
}

.event-actions-menu-modal {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-width: 240px;
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 2500;
}

.event-actions-menu-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Petite flèche pointant vers le bouton */
.event-actions-menu-modal::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    z-index: -1;
}

/* Flèche en bas quand menu au-dessus */
.event-actions-menu-modal.position-top::after {
    bottom: -8px;
    right: 8px;
    transform: rotate(45deg);
}

/* Flèche en haut quand menu en-dessous */
.event-actions-menu-modal.position-bottom::after {
    top: -8px;
    right: 8px;
    transform: rotate(225deg);
}

/* Animation d'entrée pour les items du menu modal */
.event-actions-menu-modal.active .event-menu-item {
    animation: slideInMenuItem 0.3s ease-out forwards;
    opacity: 0;
}

.event-actions-menu-modal.active .event-menu-item:nth-child(1) {
    animation-delay: 0.05s;
}

.event-actions-menu-modal.active .event-menu-item:nth-child(2) {
    animation-delay: 0.1s;
}

.event-actions-menu-modal.active .event-menu-item:nth-child(3) {
    animation-delay: 0.15s;
}

.event-actions-menu-modal.active .event-menu-item:nth-child(4) {
    animation-delay: 0.2s;
}

.event-actions-menu-modal.active .event-menu-item:nth-child(6) {
    animation-delay: 0.25s;
}

.event-actions-menu-modal.active .event-menu-item:nth-child(7) {
    animation-delay: 0.3s;
}

/* Statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 0.875rem;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--rotary-blue);
}

.stat-card.stat-success::before {
    background: var(--success);
}

.stat-card.stat-danger::before {
    background: var(--danger);
}

.stat-card.stat-info::before {
    background: var(--sky-blue);
}

.stat-card.stat-purple::before {
    background: var(--purple);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--rotary-blue);
    margin-bottom: 0.25rem;
    animation: countUp 1s ease-out;
}

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

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

/* Grille de présences */
.presences-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.presence-card {
    background: white;
    border-radius: 8px;
    padding: 0.875rem 1rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.presence-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.presence-card.status-present {
    background: rgba(0, 151, 57, 0.08);
    border-left: 4px solid var(--success);
}

.presence-card.status-absent {
    background: rgba(224, 41, 39, 0.08);
    border-left: 4px solid var(--danger);
}

.presence-card.status-excuse {
    background: rgba(247, 168, 27, 0.08);
    border-left: 4px solid var(--rotary-gold);
}

.presence-info {
    flex: 1;
}

.presence-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
}

.presence-details {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    align-items: center;
}

.presence-checkbox {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.presence-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.presence-invites {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.presence-invites input[type="number"] {
    width: 50px;
    padding: 0.25rem 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    text-align: center;
}

.presence-invites input[type="number"]:focus {
    outline: none;
    border-color: var(--rotary-blue);
}

.presence-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.presence-status:hover {
    transform: scale(1.05);
}

.presence-status.status-present {
    background: var(--success);
    color: white;
}

.presence-status.status-absent {
    background: var(--danger);
    color: white;
}

.presence-status.status-excuse {
    background: var(--rotary-gold);
    color: white;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 700px;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-large {
    max-width: 800px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0 0 0.5rem;
}

.modal-header h3 {
    font-size: 1.4rem;
    color: var(--rotary-blue);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-content form {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
}

.modal-footer .btn {
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--rotary-blue);
    font-size: 0.85rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--rotary-blue);
    box-shadow: 0 0 0 3px rgba(23, 69, 143, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Section titles dans les formulaires */
.section-title {
    font-size: 1.1rem;
    color: var(--rotary-blue);
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

/* Boutons icônes */
.btn-icon {
    width: 24px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon svg {
    width: 14px;
    height: 14px;
}

.btn-icon-edit {
    background: rgba(0, 103, 200, 0.1);
    color: var(--azure);
}

.btn-icon-edit:hover {
    background: var(--azure);
    color: white;
    transform: translateY(-2px);
}

.btn-icon-primary {
    background: rgba(23, 69, 143, 0.1);
    color: var(--rotary-blue);
}

.btn-icon-primary:hover {
    background: var(--rotary-blue);
    color: white;
    transform: translateY(-2px);
}

.btn-icon-delete {
    background: rgba(224, 41, 39, 0.1);
    color: var(--danger);
}

.btn-icon-delete:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-2px);
}

.btn-icon-warning {
    background: rgba(247, 168, 27, 0.1);
    color: var(--rotary-gold);
}

.btn-icon-warning:hover {
    background: var(--rotary-gold);
    color: white;
    transform: translateY(-2px);
}

.btn-icon-success {
    background: rgba(0, 151, 57, 0.1);
    color: var(--success);
}

.btn-icon-success:hover {
    background: var(--success);
    color: white;
    transform: translateY(-2px);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Upload de fichiers */
.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-input-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-light);
}

.file-input-label:hover {
    border-color: var(--rotary-blue);
    background: rgba(23, 69, 143, 0.05);
}

.file-input-label.has-file {
    border-color: var(--success);
    background: rgba(0, 151, 57, 0.05);
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.file-name {
    color: var(--text-primary);
    font-weight: 500;
}

/* Sélection des membres pour invitations */
.membres-selection-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-light);
}

.membre-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    background: white;
    font-size: 0.8rem;
}

.membre-checkbox-item:hover {
    background: rgba(23, 69, 143, 0.05);
}

.membre-checkbox-item input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

/* Responsive */
@media (max-width: 1024px) {
    .membres-selection-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .nav-dropdown {
        width: 100%;
    }
    
    .nav-submenu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        margin-top: 0.5rem;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        display: none;
    }
    
    .nav-dropdown:hover .nav-submenu,
    .nav-dropdown.active .nav-submenu {
        display: block;
    }
    
    .nav-submenu-item {
        color: rgba(255, 255, 255, 0.9);
        border-bottom-color: rgba(255, 255, 255, 0.1);
        padding-left: 3rem;
    }
    
    .nav-submenu-item:hover {
        background: rgba(255, 255, 255, 0.2);
        color: white;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-links {
        width: 100%;
        flex-direction: column;
    }
    
    .nav-link {
        width: 100%;
        justify-content: center;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h2 {
        font-size: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .events-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .presences-grid {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }
    
    .membres-selection-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .membres-selection-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

/* === CUSTOM DROPDOWN === */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-button {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.dropdown-button:hover {
    border-color: var(--rotary-blue);
}

.custom-dropdown.active .dropdown-button {
    border-color: var(--rotary-blue);
    box-shadow: 0 0 0 3px rgba(23, 69, 143, 0.1);
}

.dropdown-text {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-arrow {
    margin-left: 0.5rem;
    transition: transform 0.2s ease;
}

.custom-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--rotary-blue);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow: hidden;
}

.dropdown-search {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
}

.dropdown-search input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
}

.dropdown-search input:focus {
    outline: none;
    border-color: var(--rotary-blue);
}

.dropdown-items {
    max-height: 340px;
    overflow-y: auto;
}

.dropdown-section-title {
    padding: 0.5rem 0.75rem;
    background: var(--bg-light);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rotary-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

.dropdown-section-title:first-child {
    border-top: none;
}

.dropdown-item {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(23, 69, 143, 0.08);
}

/* Ligne rapprochée */
.rappro-row {
    background: rgba(0, 151, 57, 0.05);
}

.rappro-row .dropdown-button {
    background: rgba(0, 151, 57, 0.05);
    cursor: not-allowed;
}

.rappro-row .custom-dropdown.active .dropdown-button {
    pointer-events: none;
}

/* ****************************** */
/* Correction du z-index pour éviter le clignotement des picklists */
.picklist-container {
    position: relative;
    z-index: 1;
}

/* Quand la picklist est active, augmenter son z-index */
.picklist-dropdown.active {
    z-index: 1000 !important;
}

/* S'assurer que le parent (td) ne limite pas le z-index */
td {
    position: relative;
}

/* Empêcher les éléments de passer au-dessus de la picklist ouverte */
tbody tr {
    position: relative;
    z-index: auto;
}

/* La ligne avec picklist active doit être au-dessus */
tbody tr:has(.picklist-dropdown.active) {
    z-index: 999;
}

/* Alternative si :has() n'est pas supporté */
tbody tr:focus-within {
    z-index: 999;
}

/* S'assurer que la picklist ouverte reste au-dessus de tout */
.picklist-dropdown {
    position: absolute;
    z-index: 1;
}

/* Supprimer le scroll du dropdown lui-même */
.picklist-dropdown {
    overflow: visible !important; /* Pas de scroll sur le dropdown */
}

/* Le scroll doit être uniquement sur les items */
.picklist-items {
    max-height: 300px;
    overflow-y: auto;
}


/* Ligne verrouillée (avec id_ecriture) */
.locked-row {
    background: rgba(200, 200, 200, 0.15) !important;
}

.locked-row td {
    color: var(--text-secondary);
}

/* Style pour la picklist sélectionnée cliquable */
.picklist-selected {
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.picklist-selected:hover {
    border-color: var(--rotary-blue);
    background: rgba(23, 69, 143, 0.05);
}

.picklist-selected span {
    flex: 1;
}

/* ************** */
/* Corrections z-index pour picklists */
.picklist-container {
    position: relative;
    z-index: 1;
}

.picklist-dropdown.active {
    z-index: 1000 !important;
}

td {
    position: relative;
}

tbody tr {
    position: relative;
    z-index: auto;
}

tbody tr:has(.picklist-dropdown.active) {
    z-index: 999;
}

tbody tr:focus-within {
    z-index: 999;
}

.picklist-dropdown {
    position: absolute;
    z-index: 1;
    overflow: visible !important;
}

.picklist-items {
    max-height: 300px;
    overflow-y: auto;
}

/* Ligne verrouillée */
.locked-row {
    background: rgba(200, 200, 200, 0.15) !important;
}

.locked-row td {
    color: var(--text-secondary);
}

/* Ligne en attente d'affectation */
.pending-row {
    background: rgba(247, 168, 27, 0.12) !important;
}

/* Animation pour les notifications */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Bouton icône info (pour le bouton Analyse) */

.btn-icon-info:hover {
    background: linear-gradient(135deg, #138496, #117a8b);
    border-color: #117a8b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.btn-icon-info:active {
    transform: translateY(0);
}

/* Animation pour le défilement des cartes texte */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Bouton Aide */
.aide-btn-float {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--rotary-blue);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 1000;
}

.aide-btn-float:hover {
    transform: scale(1.1);
    background: #0f3d73;
}