@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-body: #F5F5F7; --bg-card: #FFFFFF; --text-main: #1D1D1F; --text-muted: #86868B;
    --accent: #0071E3; --border: #E5E5E5; --radius-lg: 24px; --radius-md: 14px;
    --oxy-green: #10b981; --oxy-blue: #3b82f6; --oxy-rose: #f43f5e; --oxy-purple: #AF52DE;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }

/* POLICE PRO (COMPATIBILITÉ APPLE/WINDOWS RESTAURÉE) */
body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    background-color: var(--bg-body); color: var(--text-main); height: 100vh; overflow: hidden; 
}

/* --- LAYOUT GLOBAL --- */
.app-container { display: flex; height: 100%; width: 100%; position: relative; }
.main-content { flex: 1; padding: 40px 50px; overflow-y: auto; overflow-x: hidden; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; flex-wrap: wrap; gap: 20px; }
h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; margin: 0; }

/* --- SIDEBAR --- */
.sidebar { width: 260px; background: var(--bg-card); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 32px 24px; flex-shrink: 0; transition: transform 0.3s ease; z-index: 1001; }
.logo-area { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; font-weight: 700; font-size: 22px; }
.logo-icon { width: 36px; height: 36px; background: var(--text-main); color: white; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-menu { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.nav-group { margin-bottom: 4px; }
.nav-label { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; color: var(--text-main); font-weight: 600; font-size: 14px; cursor: pointer; border-radius: 12px; transition: 0.2s; }
.nav-label:hover { background: #F5F5F7; }
.nav-group.open .nav-label { color: var(--accent); }
.nav-group.open .nav-sub-menu { display: flex; }
.chevron { width: 14px; height: 14px; transition: transform 0.3s ease; }
.nav-group.open .chevron { transform: rotate(180deg); }
.nav-sub-menu { display: none; padding-left: 12px; margin-top: 4px; flex-direction: column; gap: 4px; }
.nav-item, .nav-sub-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; text-decoration: none; color: var(--text-muted); font-size: 13px; font-weight: 500; border-radius: 10px; transition: 0.2s; }
.nav-item:hover, .nav-sub-item:hover { color: var(--text-main); background: #FAFAFA; }
.nav-item.active, .nav-sub-item.active { color: var(--accent); background: #F2F2F7; font-weight: 600; }
.user-profile { display: flex; align-items: center; gap: 12px; padding-top: 20px; border-top: 1px solid var(--border); margin-top: auto; }
.sidebar-avatar-wrapper { position: relative; width: 44px; height: 44px; flex-shrink: 0; cursor: pointer; }
.avatar { width: 100%; height: 100%; background: var(--oxy-rose); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.sidebar-edit-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; opacity: 0; transition: opacity 0.2s; }
.sidebar-avatar-wrapper:hover .sidebar-edit-overlay { opacity: 1; }
.user-info { display: flex; flex-direction: column; font-size: 13px; } .user-info .role { color: var(--text-muted); }

/* --- UI ELEMENTS --- */
.card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 24px; box-shadow: 0 10px 40px rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.02); }
.btn-primary { background: var(--text-main); color: white; border: none; padding: 0 24px; border-radius: 50px; font-weight: 600; height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.1); transition: 0.2s; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 15px rgba(0,0,0,0.15); }
.btn-secondary { background: #E8E8ED; color: var(--text-main); border: none; padding: 0 24px; border-radius: 50px; font-weight: 600; height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; transition: 0.2s; }
.btn-secondary:hover { background: #dcdce0; }
.btn-icon-circle { width: 36px; height: 36px; border-radius: 50%; background: #F5F5F7; display: flex; align-items: center; justify-content: center; color: var(--text-main); text-decoration: none; border: none; cursor: pointer; transition: 0.2s; }
.btn-icon-circle:hover { background: #E0E0E5; }
.btn-icon-circle-small { width: 28px; height: 28px; border-radius: 50%; background: #F5F5F7; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-main); }
.badge { padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.badge.success { background: #E1FFEB; color: #007030; } .badge.neutral { background: #F2F2F7; color: var(--text-muted); } .badge.warning { background: #FFF4E5; color: #B95000; } .badge.vip { background: #F3E8FF; color: #7E22CE; } .badge.danger { background: #FFE5E5; color: #D32F2F; }

/* --- ANIMATIONS (COMPLETES) --- */
.anim-mail:hover svg { animation: pop 0.3s ease; }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }

.anim-pencil:hover svg { animation: wiggle 0.4s ease; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }

.anim-magic:hover svg { animation: magic-wave 1.2s ease-in-out infinite; color: var(--oxy-purple); }
@keyframes magic-wave { 0% { transform: rotate(0deg); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } 100% { transform: rotate(0deg); } }

.rotate-hover:hover svg { transform: rotate(90deg); transition: transform 0.3s ease; }

.btn-trash-animated { background-color: #E8E8ED; color: var(--text-main); width: 44px; height: 44px; border-radius: 50%; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; }
.btn-trash-animated:hover { background-color: #FFE5E5; color: #D32F2F; }
.btn-trash-animated:hover .trash-lid { transform-origin: center; animation: lid-bounce 0.4s ease forwards; }
@keyframes lid-bounce { 0% { transform: rotate(0); } 30% { transform: rotate(-15deg) translateY(-2px); } 60% { transform: rotate(5deg) translateY(-1px); } 100% { transform: rotate(0) translateY(0); } }

/* --- DASHBOARD & STATS --- */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 40px; }
.stat-card { display: flex; align-items: center; gap: 20px; transition: transform 0.2s; } .stat-card:hover { transform: translateY(-2px); }
.icon-box { width: 56px; height: 56px; border-radius: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-box.blue { background: #E1F0FF; color: var(--accent); } .icon-box.purple { background: #F4E1FF; color: #AF52DE; } .icon-box.green { background: #E1FFEB; color: #34C759; }
.stat-info .label { font-size: 14px; color: var(--text-muted); font-weight: 500; } .stat-info .value { font-size: 30px; font-weight: 700; display: block; margin-top: 4px; }
.table-card { overflow-x: auto; }
.clean-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.clean-table th { padding: 15px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; color: var(--text-muted); }
.clean-table td { padding: 18px 16px; border-bottom: 1px solid #f5f5f7; font-size: 14px; }
.user-cell { display: flex; align-items: center; gap: 16px; font-weight: 600; }
.mini-avatar { width: 36px; height: 36px; min-width: 36px; border-radius: 50%; font-size: 13px; font-weight: 700; color: white; display: flex; align-items: center; justify-content: center; }

/* --- CONTACT PROFILE DETAILS --- */
.profile-grid { display: grid; grid-template-columns: 350px 1fr; gap: 24px; }
.left-col, .right-col { display: flex; flex-direction: column; gap: 24px; }
.profile-card { text-align: center; } .avatar-section { margin-bottom: 25px; } 
.big-avatar { width: 100px; height: 100px; border-radius: 50%; font-size: 32px; font-weight: 700; color: white; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.avatar-wrapper { position: relative; width: 100px; height: 100px; margin: 0 auto 15px auto; cursor: pointer; } 
.edit-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; opacity: 0; transition: opacity 0.2s; } 
.avatar-wrapper:hover .edit-overlay { opacity: 1; }
.avatar-name { font-size: 20px; font-weight: 700; margin: 15px 0 5px; }
.profile-meta { text-align: left; margin-top: 20px; padding-top: 20px; border-top: 1px solid #F5F5F7; }
.meta-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; font-size: 14px; }
.icon-wrap { width: 32px; height: 32px; background: #F5F5F7; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-main); }
.note-input { width: 100%; border: 1px solid var(--border); border-radius: 14px; padding: 15px; font-family: 'Inter', sans-serif; font-size: 14px; resize: none; height: 100px; outline: none; background: #FAFAFA; } .note-input:focus { background: white; border-color: var(--accent); }

/* TIMELINE (Trait continu et icônes) */
.timeline-item { display: flex; gap: 15px; margin-bottom: 25px; position: relative; }
.timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 18px; top: 36px; bottom: -20px; width: 2px; background: #F5F5F7; }
.timeline-icon { width: 36px; height: 36px; border-radius: 50%; background: #eee; display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; z-index: 2; }
.timeline-icon.bg-blue { background: #E1F0FF; color: var(--accent); } .timeline-icon.bg-purple { background: #F4E1FF; color: #AF52DE; }

/* AI SCORE CIRCLE (RÉPARATION : Cercle Bleu et Vide) */
.ai-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.ai-score-box { display: flex; align-items: center; gap: 20px; }
.score-circle-container { position: relative; width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; }
.circular-chart { display: block; margin: 0 auto; max-width: 80%; max-height: 250px; }
.circle-bg { fill: none; stroke: #eee; stroke-width: 3.8; }
.circle { fill: none; stroke-width: 2.8; stroke-linecap: round; stroke: var(--accent); } /* ICI : FILL NONE et STROKE BLUE */
.percentage-centered { position: absolute; font-weight: 700; font-size: 18px; }

/* --- PLANNING V3 (APPLE STYLE) --- */
.planning-header-controls { display: flex; align-items: center; gap: 15px; }
.btn-nav-month { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: white; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.btn-nav-month:hover { background: #F5F5F7; }
.current-month-label { font-size: 18px; font-weight: 700; min-width: 150px; text-align: center; }
.planning-board { overflow-x: auto; background: white; }
.days-header { display: grid; grid-template-columns: 200px repeat(auto-fit, minmax(40px, 1fr)); border-bottom: 1px solid var(--border); background: #FAFAFA; position: sticky; top: 0; z-index: 20; }
.day-col-header { text-align: center; padding: 12px 0; font-size: 12px; font-weight: 600; color: var(--text-muted); border-right: 1px solid #F0F0F0; }
.day-col-header.weekend { background: #F2F2F7; color: #D32F2F; }
.member-row { display: grid; grid-template-columns: 200px repeat(auto-fit, minmax(40px, 1fr)); border-bottom: 1px solid #F5F5F7; }
.member-info { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: white; position: sticky; left: 0; z-index: 10; border-right: 1px solid var(--border); }
.day-slot { height: 50px; border-right: 1px solid #F5F5F7; position: relative; cursor: pointer; transition: 0.1s; }
.day-slot:hover { background: #F9F9FA; }
.day-slot.weekend { background: #FAFAFA; border-right: 1px solid #EAEAEA; }
.p-event { position: absolute; top: 4px; bottom: 4px; left: 2px; right: 2px; border-radius: 6px; font-size: 10px; font-weight: 700; color: white; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1); z-index: 5; pointer-events: none; }
.p-leave { background: var(--oxy-rose); } .p-remote { background: #AF52DE; } .p-work { background: var(--accent); opacity: 0.1; color: transparent; }

/* --- OPTIMIZER (DESIGN ROUGE/BLEU) --- */
.optimization-card { background: white; border: 1px solid #E5E5E5; border-radius: 16px; overflow: hidden; margin-bottom: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.opt-problem { background: #FFF5F5; padding: 14px 16px; color: #C0392B; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #FFE0E0; }
.opt-solution { background: #F0F7FF; padding: 14px 16px; color: #0056b3; font-size: 13px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }

/* --- MODALES & FORMS --- */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); align-items: center; justify-content: center; }
.modal-content { background: white; padding: 30px; border-radius: 24px; width: 90%; max-width: 500px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); animation: slideUp 0.3s; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; } .modal-header h2 { margin: 0; font-size: 22px; }
.btn-close-icon { background: none; border: none; cursor: pointer; color: var(--text-muted); }
.form-group { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.input-select { padding: 12px; border-radius: 10px; border: 1px solid var(--border); width: 100%; font-size: 14px; outline: none; transition: 0.2s; }
.input-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,113,227,0.1); }
.type-selector { display: flex; gap: 10px; }
.type-opt { flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: 10px; text-align: center; cursor: pointer; font-size: 13px; font-weight: 600; transition: 0.2s; }
.type-opt:hover { background: #FAFAFA; }
.type-opt.selected { border-color: var(--accent); background: #F0F7FF; color: var(--accent); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.spinner { width: 30px; height: 30px; border: 3px solid #F4E1FF; border-top: 3px solid #AF52DE; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* RESPONSIVE */
.btn-burger { display: none; position: absolute; top: 20px; left: 20px; z-index: 999; background: white; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); justify-content: center; align-items: center; cursor: pointer; }
.mobile-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; }
/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    .app-container { flex-direction: column; } 
    .btn-burger { display: flex; } 
    .sidebar { position: fixed; left: -280px; height: 100%; box-shadow: 5px 0 25px rgba(0,0,0,0.1); } 
    .sidebar.mobile-open { transform: translateX(280px); } 
    .mobile-overlay.active { display: block; }
    .main-content { padding: 80px 20px; } 
    .stats-grid, .profile-grid { grid-template-columns: 1fr; }
} /* <-- CETTE ACCOLADE ÉTAIT MANQUANTE */

/* --- ANIMATION BOUTON NOUVEAU CONTACT (DÉSORMAIS VALABLE PARTOUT) --- */
.btn-primary i, 
.btn-primary svg {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: inline-block !important;
}

.btn-primary:hover i, 
.btn-primary:hover svg {
    transform: rotate(90deg) scale(1.1) !important;
}

/* 1. Supprime les bordures à gauche partout (Planning & Validations) */
.card, .req-card, .ai-analysis-box {
    border-left: none !important;
}

/* 2. Nouveau style pour les alertes (Plus élégant) */
.ai-analysis-box {
    border-radius: 16px;
    padding: 18px;
    margin: 15px 0;
}

/* Version Rouge (Alerte) */
.risk-high {
    background: #FFF2F2 !important; /* Rouge très doux */
    border: 1px solid #FFD6D6 !important;
}

.ai-title {
    color: #D32F2F;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 3. Les Pastilles d'état (Pills) */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    background: #F0F7FF;
    color: #0071E3;
}

/* --- 8. STYLE DE LA MODALE DANGER (ALERTE) --- */
#alertModal .modal-card { 
    border: 2px solid #FF3B30; 
}
#alertModal h3 { 
    color: #FF3B30; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}
.btn-danger-apple { 
    background: #FF3B30; 
    color: white; 
    border: none; 
    padding: 15px 30px; 
    border-radius: 15px; 
    font-weight: 700; 
    cursor: pointer; 
    transition: background 0.2s;
}
.btn-danger-apple:hover { 
    background: #D70015; 
}