/* =============================================================================
   INTERFACE INTRANET - CSS PROPRE SANS CONFLITS
   Version: 2.0
   ============================================================================= */

/* Reset et base pour l'intranet */
.holidee-intranet-body {
    margin: 0 !important;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #f8f9fa;
    overflow-x: hidden;
}

.holidee-intranet-body #wpadminbar {
    display: none !important;
}

.holidee-intranet-body.admin-bar {
    padding-top: 0 !important;
}

/* =============================================================================
   LAYOUT PRINCIPAL - MOBILE FIRST FLEXBOX
   ============================================================================= */

.holidee-intranet-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

/* Desktop : layout horizontal */
@media (min-width: 769px) {
    .holidee-intranet-layout {
        flex-direction: row;
    }
}

/* =============================================================================
   SIDEBAR NAVIGATION
   ============================================================================= */

.intranet-sidebar {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    width: 100%;
    min-height: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
}

/* Desktop : sidebar fixe */
@media (min-width: 769px) {
    .intranet-sidebar {
        width: 280px;
        min-height: 100vh;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        overflow-x: hidden;
    }
}

/* Header de la sidebar */
.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sidebar-header .logo {
    flex: 1;
}

.logo-link {
    display: block;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.sidebar-header .logo img {
    max-height: 40px;
    max-width: 200px;
    display: block;
}

.sidebar-header .logo h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hamburger {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: white;
    transition: transform 0.3s ease;
}

.hamburger::before {
    top: -6px;
}

.hamburger::after {
    top: 6px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.nav-section {
    margin-bottom: 30px;
}

.nav-title {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 15px 0;
    padding: 0 20px;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #3498db;
}

.nav-icon {
    font-size: 16px;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.nav-text {
    flex: 1;
}

.nav-badge {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* Footer de la sidebar */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    margin-top: auto;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: white;
    font-size: 14px;
    margin-bottom: 2px;
}

.user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.logout-btn:hover {
    background: rgba(231, 76, 60, 0.3);
    color: white;
}

/* =============================================================================
   CONTENU PRINCIPAL
   ============================================================================= */

.intranet-main {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

.intranet-topbar {
    display: flex;
    background: white;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-left: 15px;
    flex: 1;
}

/* Topbar mobile avec gap pour l'espacement */
.intranet-topbar {
    gap: 15px;
}

.intranet-content {
    flex: 1;
    padding: 15px;
    background: #f8f9fa;
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
}

/* Desktop : plus d'espace et marge pour sidebar fixe */
@media (min-width: 769px) {
    .intranet-content {
        padding: 25px;
    }
    
    .intranet-main {
        margin-left: 280px;
        width: calc(100% - 280px);
    }
}

/* Overlay pour mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =============================================================================
   RESPONSIVE - MOBILE FIRST
   ============================================================================= */

/* =============================================================================
   RESPONSIVE - MOBILE FIRST CORRECT
   ============================================================================= */

/* MOBILE (par défaut) : Sidebar cachée, topbar visible */
.mobile-only {
    display: flex;
}

.sidebar-toggle {
    display: flex;
    background: none;
    border: none;
    color: #2c3e50;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.3s ease;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: #f3f4f6;
}

.hamburger {
    display: block;
    width: 20px;
    height: 2px;
    background: #2c3e50;
    position: relative;
    transition: all 0.3s ease;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: #2c3e50;
    transition: transform 0.3s ease;
}

.hamburger::before {
    top: -6px;
}

.hamburger::after {
    top: 6px;
}

/* Animation hamburger actif */
.sidebar-open .hamburger {
    background: transparent;
}

.sidebar-open .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.sidebar-open .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

/* MOBILE : Sidebar en overlay */
.intranet-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 1000;
    width: 280px;
    transition: transform 0.3s ease;
}

.intranet-sidebar.active {
    transform: translateX(0);
}

.sidebar-overlay {
    display: block;
}

.sidebar-open {
    overflow: hidden;
}

/* DESKTOP : layout normal */
@media (min-width: 769px) {
    /* Cacher les éléments mobile */
    .mobile-only {
        display: none !important;
    }
    
    .sidebar-toggle {
        display: none !important;
    }
    
    .intranet-topbar {
        display: none !important;
    }
    
    /* Desktop : sidebar toujours visible et fixe */
    .intranet-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        transform: translateX(0) !important;
        min-height: 100vh;
        transition: none;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    /* Reset des classes actives sur desktop */
    .intranet-sidebar.active {
        transform: translateX(0);
    }
    
    /* Desktop : hover effects améliorés */
    .nav-link:hover {
        background: rgba(255, 255, 255, 0.15);
        transform: translateX(5px);
    }
    
    .logout-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }
}

/* =============================================================================
   ESPACEMENT POUR LE CONTENU
   ============================================================================= */

/* Dashboard dans l'intranet - adaptation */
.intranet-content .holidee-dashboard-a3 {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    min-height: auto !important;
    box-sizing: border-box;
}

/* Espacement pour les éléments du dashboard et pages */
.intranet-content .holidee-dashboard-a3 .dashboard-cards {
    margin-bottom: 25px;
    gap: 20px;
}

.intranet-content .dashboard-card,
.intranet-content .annual-limit-card,
.intranet-content .primes-table-section,
.intranet-content .payment-history-section,
.intranet-content .rookies-table-wrapper {
    margin-bottom: 25px;
}

/* Responsive pour les grilles et cartes */
@media (max-width: 768px) {
    .intranet-content .dashboard-cards {
        gap: 15px;
    }
    
    .intranet-content .dashboard-card,
    .intranet-content .annual-limit-card,
    .intranet-content .primes-table-section,
    .intranet-content .payment-history-section,
    .intranet-content .rookies-table-wrapper {
        margin-bottom: 20px;
    }
}

/* Assurer que rien ne déborde */
.intranet-content * {
    box-sizing: border-box;
    max-width: 100%;
}

/* Tables responsive dans l'intranet */
.intranet-content table {
    width: 100%;
    table-layout: auto;
    overflow-x: auto;
}

.intranet-content .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Pages existantes - responsive */
.holidee-dashboard-a3,
.holidee-rookies-page,
.holidee-primes-page,
.holidee-profil-page {
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Breadcrumbs pour toutes les pages */
.breadcrumb {
    display: flex;
    align-items: center;
    margin: 0 0 20px 0;
    font-size: 14px;
    padding: 0;
}

.breadcrumb a {
    color: #007cba;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    margin: 0 8px;
    color: #666;
}

/* Masquer certains éléments WordPress dans l'intranet */
.holidee-intranet-body .site-header,
.holidee-intranet-body .site-navigation,
.holidee-intranet-body .main-navigation,
.holidee-intranet-body header.entry-header {
    display: none !important;
}

/* =============================================================================
   A6 - MODALE DEMANDE DE VERSEMENT
   ============================================================================= */

/* Overlay de la modale */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
}

/* Contenu de la modale */
.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: min(500px, 90vw);
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

/* Header de la modale */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: #111827;
    background: #f3f4f6;
}

/* Corps de la modale */
.modal-body {
    padding: 24px 32px;
}

/* Section montant disponible */
.payment-amount-section {
    text-align: center;
    margin-bottom: 32px;
    padding: 24px;
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px solid #10b981;
}

.payment-amount-section h4 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    color: #065f46;
    font-weight: 600;
}

.available-amount {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.amount-value {
    font-size: 2rem;
    font-weight: 700;
    color: #10b981;
}

.amount-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

/* Section IBAN */
.iban-section {
    margin-bottom: 24px;
}

.iban-section h4 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    color: #111827;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: #6b7280;
}

/* Notice importante */
.payment-notice {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.notice-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.notice-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.notice-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #92400e;
}

.notice-text strong {
    font-weight: 600;
}

/* Messages de feedback */
.payment-feedback {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.payment-feedback.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.payment-feedback.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Footer de la modale */
.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 32px 24px;
    border-top: 1px solid #e5e7eb;
}

.btn-cancel {
    padding: 12px 24px;
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.btn-cancel:hover {
    background: #e5e7eb;
}

.btn-validate {
    padding: 12px 24px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.btn-validate:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-validate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    display: none;
}

/* Responsive pour la modale */
@media (max-width: 640px) {
    .modal-content {
        width: 95vw;
        margin: 20px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .payment-amount-section {
        padding: 16px;
    }
    
    .amount-value {
        font-size: 1.5rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .btn-cancel,
    .btn-validate {
        width: 100%;
        justify-content: center;
    }
}