/* 
   DESIGN SYSTEM : "ENTERPRISE ELITE"
   Refined for balanced proportions, content clarity, and professional data display.
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg: #0f172a;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    
    /* Fallback variables to override hardcoded inline backgrounds */
    --bg-card: #ffffff;
    --bg-accent: #f8fafc;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-main);
    line-height: 1.5;
    height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.hidden { display: none !important; }

.app-container { display: flex; height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 32px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-header h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; margin: 0; }

.dark-mode-toggle {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.dark-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    transform: rotate(15deg) scale(1.08);
}
.dark-mode-toggle i {
    font-size: 1.1rem;
}

.nav-links { list-style: none; padding: 20px 12px; flex: 1; overflow-y: auto; }
.nav-links li { margin-bottom: 4px; }
.nav-links a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s;
}
.nav-links a:hover { color: white; background: rgba(255,255,255,0.05); }
.nav-links a.active { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }

/* MAIN CONTENT AREA */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: auto;
}

.user-profile-mini {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.user-info-sm {
    display: flex;
    flex-direction: column;
}

.user-info-sm .name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: white;
}

.user-info-sm .role {
    font-size: 0.7rem;
    color: #64748b;
}

/* MAIN CONTENT AREA */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.content-wrapper { flex: 1; padding: 50px 60px; overflow-y: auto; scroll-behavior: smooth; }

.content-section { display: none !important; max-width: 1200px; margin: 0 auto; }
.content-section.active-section { display: block !important; animation: fadeIn 0.3s ease-out; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* DASHBOARD GRID - BENTO REFINED */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

/* DASHBOARD DYNAMIQUE (GRIDSTACK) */
.grid-stack { margin-top: 24px; }

/* --- DESIGN DASHBOARD MASTERPIECE (v7.0) --- */

/* 1. Menu Ajouter un Widget (Dropdown Pro) */
.dashboard-actions { position: relative; }
.btn-primary.btn-active { background: #1e40af !important; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); }

.widget-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 260px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 20px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    z-index: 2000;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.widget-menu button {
    width: 100%;
    padding: 12px 16px;
    border: none !important;
    background: transparent;
    border-radius: 12px;
    text-align: left;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--slate-700);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}
.widget-menu button:hover {
    background: var(--primary);
    color: white;
    transform: translateX(6px);
}
.widget-menu button i { font-size: 1rem; width: 20px; text-align: center; opacity: 0.7; }

/* 2. Conteneur Universel des Widgets */
.grid-stack-item-content {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    overflow: visible !important;
}

.widget-container {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 24px;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    container-type: inline-size;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Bouton de suppression robuste */
.remove-widget {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.04);
    color: currentColor;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s;
    z-index: 100; /* Toujours au-dessus */
}
.grid-stack-item-content:hover .remove-widget { opacity: 0.6; transform: scale(1); }
.remove-widget:hover { background: #ef4444 !important; color: white !important; opacity: 1 !important; }

/* 3. Entêtes et Corps */
.widget-header-mini, .widget-header-search {
    padding: 16px 20px 8px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.5;
}
.widget-body {
    flex: 1;
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.widget-body.centered { align-items: center; justify-content: center; text-align: center; }
.widget-body.no-padding { padding: 0; }

/* 4. Thèmes Colorés */
.theme-dark { background: linear-gradient(145deg, #0f172a, #1e293b); color: white; }
.theme-sky { background: linear-gradient(135deg, #f0f9ff, #e0f2fe); border-color: #bae6fd; }
.theme-amber { background: #fffbeb; border-color: #fde68a; }
.theme-amber textarea { 
    padding: 20px; font-size: 1rem; line-height: 1.6; color: #92400e;
    background: transparent !important; border: none; outline: none; width: 100%; height: 100%; resize: none;
}
.theme-indigo { background: #f5f3ff; border-color: #ddd6fe; }
.theme-slate { background: linear-gradient(135deg, #1e293b, #334155); color: white; border-color: #475569; }

/* CALCULATRICE PREMIUM COMPACTE */
.calc-display {
    background: rgba(0,0,0,0.2);
    padding: 12px 16px;
    font-size: 1.5rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    text-align: right;
    color: white;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    background: rgba(255,255,255,0.02);
}

.calc-btn {
    padding: 12px 0;
    border: 1px solid rgba(255,255,255,0.02);
    background: transparent;
    color: white;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.calc-btn:hover { background: rgba(255,255,255,0.1); }
.calc-btn:active { background: rgba(255,255,255,0.2); transform: scale(0.95); }

.calc-btn.op { background: rgba(255,255,255,0.06); color: #94a3b8; }
.calc-btn.eq { background: var(--primary); color: white; }
.calc-btn.eq:hover { background: var(--primary-dark); }
.calc-btn.zero { grid-column: span 2; aspect-ratio: auto; }
.theme-emerald { background: #f0fdf4; border-color: #bbf7d0; }

/* 5. Éléments Spécifiques - INPUTS PREMIUM */
.search-box-premium {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.7); padding: 4px 12px; border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.05); transition: all 0.2s;
}
.search-box-premium:focus-within { background: white; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
.search-box-premium input { border: none; background: transparent; font-size: 0.8rem; outline: none; width: 80px; }
.search-box-premium button { background: transparent; border: none; cursor: pointer; color: var(--primary); }

.timer-config { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.timer-config input {
    width: 45px; height: 30px; padding: 0; border-radius: 10px; border: 1px solid rgba(0,0,0,0.06);
    background: rgba(255,255,255,0.8); font-weight: 800; font-family: 'Outfit', sans-serif;
    text-align: center; font-size: 1rem; color: #166534; outline: none;
}
.timer-config .unit { font-weight: 700; font-size: 0.75rem; opacity: 0.5; }

.time-display { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 16cqw; line-height: 1; }
.weather-temp { font-size: 18cqw; font-weight: 800; color: #0284c7; }
.timer-display { 
    font-family: 'Outfit', sans-serif; 
    font-weight: 800; 
    font-size: 14cqw; 
    margin: 4px 0 10px; 
    line-height: 1;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
}

.timer-actions { 
    display: flex; 
    gap: 10px; 
    justify-content: center;
}

.btn-widget-primary {
    background: var(--primary); 
    color: white; 
    border: none; 
    padding: 10px 22px;
    border-radius: 12px; 
    font-weight: 700; 
    font-size: 0.75rem; 
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2); 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-widget-primary:hover { 
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3); 
}

.btn-widget-secondary {
    background: white; 
    color: var(--text-main); 
    border: 1px solid rgba(0,0,0,0.08);
    padding: 10px 22px; 
    border-radius: 12px; 
    font-weight: 700; 
    font-size: 0.75rem; 
    cursor: pointer;
    transition: all 0.2s;
}

.btn-widget-secondary:hover {
    background: #f8fafc;
    border-color: rgba(0,0,0,0.15);
}

/* DATA DISPLAYS (VEILLE, AIRTABLE) */
.news-grid, .reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

/* THE NEWS CARD (CLARITY FIX) */
.news-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.news-card-header { padding: 20px; border-bottom: 1px solid var(--border); background: var(--body-bg); }
.news-card-header h3 { font-size: 1rem; font-weight: 700; color: var(--text-main); line-height: 1.4; }

.news-card-body { padding: 20px; flex: 1; }
.news-card-body p { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.news-card-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }

.tag { font-size: 0.7rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; text-transform: uppercase; }
.tag-score { background: #dcfce7; color: #166534; } /* Green */
.tag-blue { background: #dbeafe; color: #1e40af; }
.tag-warning { background: #fef3c7; color: #92400e; } /* Orange */
.tag-danger { background: #fee2e2; color: #991b1b; } /* Red */
.tag-slate { background: #f1f5f9; color: #475569; }
.tag-date { background: #f1f5f9; color: #475569; }

/* BUTTONS */
.btn-primary { background: var(--primary); color: white; padding: 8px 16px; border-radius: 8px; border: none; font-weight: 600; font-size: 0.8125rem; cursor: pointer; transition: background 0.2s; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: white; border: 1px solid var(--border); color: var(--text-main); padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 0.8125rem; cursor: pointer; }

/* CHATBOT REFINED - ENTERPRISE SLEEK */
.chatbot-grid {
    display: grid;
    grid-template-columns: 1fr 1.8fr;
    gap: 24px;
    margin-top: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .chatbot-grid {
        grid-template-columns: 1fr;
    }
}

.prompt-suggestion-btn {
    text-align: left;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-accent);
    color: var(--text-main);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    outline: none;
}

.prompt-suggestion-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.04);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

body.dark-theme .prompt-suggestion-btn {
    background: #0b0f19 !important;
    border-color: #24314d !important;
    color: #f1f5f9 !important;
}

body.dark-theme .prompt-suggestion-btn:hover {
    border-color: var(--primary) !important;
    background: rgba(37, 99, 235, 0.12) !important;
}

.chat-box { 
    background: white; 
    border: 1px solid var(--border); 
    border-radius: var(--radius-lg); 
    height: 650px; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    box-shadow: var(--shadow-md); 
}

.chat-messages { 
    flex: 1; 
    padding: 32px; 
    background: #f8fafc; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 24px 24px;
}

.chat-message { display: flex; flex-direction: column; max-width: 80%; }
.bot-message { align-self: flex-start; }
.user-message { align-self: flex-end; }

.message-bubble { 
    padding: 16px 20px; 
    border-radius: 18px; 
    font-size: 0.9375rem; 
    line-height: 1.6; 
    position: relative;
    box-shadow: var(--shadow-sm);
}

.bot-message .message-bubble { 
    background: white; 
    border: 1px solid var(--border); 
    border-bottom-left-radius: 4px;
    color: var(--text-main);
}

.user-message .message-bubble { 
    background: linear-gradient(135deg, var(--sidebar-bg), #1e293b); 
    color: white; 
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.chat-input-area { 
    padding: 24px; 
    background: white; 
    border-top: 1px solid var(--border);
}

.prompt-container { 
    background: white; 
    border: 1px solid var(--border); 
    border-radius: var(--radius-md); 
    padding: 8px 12px; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.prompt-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.chat-input { 
    flex: 1; 
    border: none; 
    padding: 8px; 
    font-family: 'Inter', sans-serif; 
    font-size: 0.9375rem; 
    outline: none; 
    resize: none;
    max-height: 120px;
}

.send-btn { 
    background: var(--primary); 
    color: white; 
    border: none; 
    border-radius: 10px; 
    width: 40px; 
    height: 40px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: transform 0.1s;
}

.send-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
.send-btn:active { transform: scale(0.95); }

/* AGENDA & VISITES - VIGNETTES PREMIUM */
.agenda-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.agenda-card {
    background: linear-gradient(135deg, #e0f2fe 0%, #e0e7ff 100%);
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.12), 0 4px 10px -2px rgba(99, 102, 241, 0.06);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.agenda-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(180deg, #6366f1, #3b82f6);
    opacity: 0.8;
    transition: opacity 0.3s;
}

.agenda-card:hover {
    transform: translateY(-6px);
    border-color: rgba(99, 102, 241, 0.45);
    box-shadow: 0 20px 35px -10px rgba(99, 102, 241, 0.25), 0 4px 10px -2px rgba(99, 102, 241, 0.08);
}

.agenda-card:hover::before {
    opacity: 1;
}

.agenda-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid rgba(99, 102, 241, 0.2);
    min-width: 68px;
    height: 68px;
    border-radius: 16px;
    color: #4f46e5;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.06), inset 0 2px 4px rgba(255, 255, 255, 0.9);
    position: relative;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
}

.agenda-date::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #6366f1, #60a5fa);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.agenda-card:hover .agenda-date {
    transform: scale(1.06) rotate(-2deg);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.18);
}

.agenda-day {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    font-family: 'Outfit', sans-serif;
    color: #1e3a8a;
}

.agenda-month {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4f46e5;
    margin-top: 2px;
}

.agenda-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.agenda-info h3 {
    font-size: 1.02rem;
    font-weight: 750;
    color: #1e3a8a;
    line-height: 1.35;
    letter-spacing: -0.015em;
    transition: color 0.2s;
    margin: 0;
}

.agenda-card:hover .agenda-info h3 {
    color: #4f46e5;
}

.agenda-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.agenda-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    color: #1e3a8a;
    background: #ffffff;
    border: 1px solid rgba(99, 102, 241, 0.18);
    padding: 4px 10px;
    border-radius: 99px;
    width: fit-content;
    font-weight: 600;
    margin: 0;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.04);
}

/* Fallback for general p elements inside info */
.agenda-info p {
    margin: 0;
}

/* Sleek container for the action button inside .agenda-info */
.agenda-actions {
    margin-top: 6px;
    width: 100%;
    display: flex;
}

/* Sleek, premium reminder button */
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.75rem;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-reminder {
    color: #4f46e5;
    background: #ffffff;
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.06);
    width: 100%;
    justify-content: center;
}

.btn-reminder svg {
    transition: transform 0.25s ease;
}

.btn-reminder:hover {
    color: white;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-color: #4f46e5;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
    transform: translateY(-1.5px);
}

.btn-reminder:hover svg {
    transform: scale(1.1) rotate(-8deg);
}

.btn-reminder:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.15);
}

/* Event deletion button style */
.delete-event-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: rgba(99, 102, 241, 0.08);
    color: #4f46e5;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.85);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

.agenda-card:hover .delete-event-btn {
    opacity: 0.8;
    transform: scale(1);
}

.delete-event-btn:hover {
    background: #fee2e2 !important;
    color: #ef4444 !important;
    opacity: 1 !important;
    transform: scale(1.08) !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.delete-event-btn:active {
    transform: scale(0.92);
}

/* CUSTOM HIGH-CONTRAST NEON TAGS FOR CARDS */
.agenda-card .tag {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    width: fit-content;
    margin: 0;
}

.agenda-card .tag-score {
    background: #dcfce7 !important;
    color: #15803d !important;
    border-color: #bbf7d0 !important;
}

.agenda-card .tag-danger {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    border-color: #fca5a5 !important;
}

.agenda-card .tag-warning {
    background: #fef3c7 !important;
    color: #b45309 !important;
    border-color: #fde68a !important;
}

.agenda-card .tag-slate {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}

/* MODALS */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.3s;
}

.modal.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalSlide 0.3s ease-out;
    display: flex;
    flex-direction: column;
    max-height: 90vh; /* Empêche la modale de dépasser la hauteur de l'écran */
}

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

.modal-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Empêche l'en-tête de rétrécir */
}

.modal-header h3 {
    font-family: 'Outfit';
    font-size: 1.25rem;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto; /* Permet le défilement vertical du contenu si l'écran est petit */
    flex-grow: 1;
}

.modal-footer {
    padding: 16px 32px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0; /* Garantit que le footer ne se rétracte jamais */
    background: #f8fafc; /* Fond discret premium */
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-group input {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: 'Inter';
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

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

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

.modal-footer {
    padding: 24px 32px;
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .dashboard-widgets { grid-template-columns: 1fr; }
    .widget-date, .widget-weather, .widget-postit, .widget-chrono, .widget-timer { grid-column: span 12; }
}

/* --- PREMIUM SYSTEM TOAST NOTIFICATIONS (Tâche B) --- */
.toast-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-radius: 16px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 320px;
    max-width: 450px;
}

.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-fadeout {
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s ease-in;
}

.toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.35);
}

.toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 10px 20px -5px rgba(239, 68, 68, 0.35);
}

.toast-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.35);
}

.toast-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 10px 20px -5px rgba(245, 158, 11, 0.35);
}

.toast-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.toast-text {
    line-height: 1.4;
    flex: 1;
}

/* ==========================================================================
   KANBAN BOARD STYLING (Idée 4)
   ========================================================================== */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 24px;
    align-items: start;
}

@media (max-width: 1200px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 680px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
}

.kanban-column {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
}

.col-blue {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.col-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.col-orange {
    background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.3);
}

.col-green {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.kanban-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.kanban-cards-container {
    min-height: 450px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-radius: 12px;
    padding: 4px;
    transition: background-color 0.2s ease;
}

.kanban-cards-container.drag-over {
    background-color: rgba(99, 102, 241, 0.05);
    border: 2px dashed rgba(99, 102, 241, 0.3);
}

.kanban-card {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    padding: 16px;
    cursor: grab;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    position: relative;
    user-select: none;
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    border-color: rgba(99, 102, 241, 0.2);
}

.kanban-card-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
    margin-bottom: 6px;
}

.kanban-card-meta {
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kanban-card-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.kanban-card-delete {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fee2e2;
    color: #ef4444;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.kanban-card:hover .kanban-card-delete {
    opacity: 1;
}

.kanban-card-delete:hover {
    transform: scale(1.1);
    background: #fca5a5;
}

/* ==========================================================================
   FICHE DE PREPARATION STYLING (Idée 3)
   ========================================================================== */
.fiche-prep-section .card select,
.fiche-prep-section .card textarea,
.fiche-prep-section .card input {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.fiche-prep-section .card select:focus,
.fiche-prep-section .card textarea:focus,
.fiche-prep-section .card input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Checkbox selector for Newsletter list */
.news-select-checkbox {
    accent-color: var(--primary);
    cursor: pointer;
}

/* ==========================================================================
   CARNET D'ADRESSES & GROUPES STYLING
   ========================================================================== */
.contacts-table tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.contacts-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.015);
}

.contacts-table th, 
.contacts-table td {
    padding: 14px 16px;
    vertical-align: middle;
    font-size: 0.92rem;
}

/* Chips de groupes élégants */
.contact-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.contact-tag.tag-enseignants {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.contact-tag.tag-direction {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.contact-tag.tag-remplaçants {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.contact-tag.tag-spécialisés {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

/* Chips de statut de diffusion */
.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-tag::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-tag.status-active {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
}

.status-tag.status-active::before {
    background: #34d399;
}

.status-tag.status-inactive {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
}

.status-tag.status-inactive::before {
    background: #f87171;
}

/* Jetons de filtre interactifs */
.filter-chip {
    outline: none;
    border: 1px solid var(--border);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-chip:not(.active):hover {
    border-color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: translateY(-1px);
}

.btn-edit-contact {
    background: rgba(59, 130, 246, 0.08);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.15);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    margin-right: 8px;
    transition: all 0.2s ease;
}

.btn-edit-contact:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.03);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.btn-delete-contact {
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.15);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete-contact:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.03);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

/* TRACKER DRAWER PREMIUM ANIMATION */
.tracker-drawer {
    transition: all 0.3s ease-in-out;
}

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

.badge-premium {
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.25);
    transition: transform 0.2s;
}

.badge-premium:hover {
    transform: translateY(-1px) scale(1.03);
}

.step-card {
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.step-card:hover {
    background-color: rgba(255, 255, 255, 0.02) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* --- PREMIUM VEILLE NEWS LOADER & SKELETON ANIMATIONS --- */
#news-loading-container,
#aefe-loading-container,
#projets-loading-container {
    position: relative;
    width: 100%;
    margin-bottom: 24px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    z-index: 150; /* Garantit que l'animation de chargement s'affiche au-dessus de tout autre élément comme le répertoire des sources */
}

.news-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    z-index: 150;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.premium-loader-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(37, 99, 235, 0.08);
    border-top: 3px solid var(--primary);
    border-right: 3px solid var(--primary);
    border-radius: 50%;
    animation: premium-spin 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

.spinner-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border-radius: 50%;
    top: 4px;
    box-shadow: 0 0 10px #f59e0b;
    animation: premium-orbit 1.5s linear infinite;
}

.spinner-core {
    font-size: 1.8rem;
    animation: pulse-core 2s ease-in-out infinite;
}

.news-loading-overlay h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.loading-status-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    max-width: 450px;
    line-height: 1.5;
}

/* Progress indicator for Veille Loader */
.loading-steps-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.5);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
    text-align: left;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.4s ease;
    opacity: 0.5;
}

.loading-step.active {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
    opacity: 1;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.05);
}

.loading-step.completed {
    color: #10b981;
    opacity: 0.8;
}

.loading-step .step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    font-size: 1rem;
    transition: all 0.4s ease;
}

.loading-step.active .step-icon {
    background: var(--primary);
    color: white;
    animation: pulse-ring 1.5s cubic-bezier(0.215, 0.610, 0.355, 1) infinite;
}

.loading-step.completed .step-icon {
    background: #10b981;
    color: white;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

/* Skeleton Layout */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    pointer-events: none;
    user-select: none;
    opacity: 0.7;
}

.skeleton-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 320px;
}

.skeleton-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.skeleton-shimmer {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
    background-size: 400% 100%;
    animation: shimmer-effect 1.4s ease infinite;
    border-radius: 8px;
}

.skeleton-badge {
    width: 100px;
    height: 24px;
    border-radius: 9999px;
}

.skeleton-score {
    width: 110px;
    height: 24px;
    border-radius: 9999px;
}

.skeleton-title {
    width: 100%;
    height: 24px;
}

.skeleton-title.short {
    width: 60%;
    height: 24px;
    margin-bottom: 12px;
}

.skeleton-text {
    width: 100%;
    height: 16px;
}

.skeleton-text.medium {
    width: 85%;
    height: 16px;
    margin-bottom: auto;
}

.skeleton-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.skeleton-date {
    width: 90px;
    height: 16px;
}

.skeleton-button {
    width: 95px;
    height: 36px;
    border-radius: var(--radius-md);
}

/* Animations Keyframes */
@keyframes premium-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse-core {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(99, 102, 241, 0)); }
    50% { transform: scale(1.15); filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.4)); }
}

@keyframes shimmer-effect {
    0% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes premium-orbit {
    0% { transform: rotate(0deg) translateX(36px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(36px) rotate(-360deg); }
}

/* --- HOVER DROP-DOWN SOURCES (TAB PROJETS) --- */
.sources-dropdown-container {
    position: relative;
    display: inline-block;
    z-index: 90;
}

/* Pseudo-élément invisible pour combler le vide physique de 8px entre le bouton et le menu */
.sources-dropdown-container::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 12px;
    background: transparent;
    z-index: 95;
}

.sources-dropdown-container #sources-dropdown-card {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 520px;
    z-index: 100;
    margin-bottom: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border-top: 4px solid #7c3aed !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
}

.sources-dropdown-container:hover #sources-dropdown-card {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

.sources-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    padding: 10px 16px;
    background-color: var(--slate-50);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    outline: none;
}

.sources-toggle-btn:hover {
    background-color: white;
    border-color: #7c3aed;
    color: #7c3aed;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.12);
    transform: translateY(-1px);
}

/* ==========================================
   PREMIUM DARK MODE DESIGN SYSTEM
   ========================================== */

body.dark-theme {
    --body-bg: #0b0f19;
    --card-bg: #151d30;
    --sidebar-bg: #070a12;
    --text-main: #f1f5f9;
    --text-muted: #8295b4;
    --border: #24314d;
    --bg-card: #151d30;
    --bg-accent: #0b0f19;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
}

/* Force override of hardcoded light backgrounds & borders */
body.dark-theme .card,
body.dark-theme .widget-container,
body.dark-theme .search-box-premium,
body.dark-theme .prompt-container,
body.dark-theme .chat-messages,
body.dark-theme .chat-container,
body.dark-theme .agenda-container,
body.dark-theme .event-modal-content,
body.dark-theme .view-modal-content,
body.dark-theme .fiche-prep-container,
body.dark-theme .kanban-column,
body.dark-theme .contact-card,
body.dark-theme .modal-content,
body.dark-theme .modal-header,
body.dark-theme .modal-footer,
body.dark-theme #sources-dropdown-card {
    background: var(--card-bg) !important;
    background-color: var(--card-bg) !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
}

/* Inputs, Textareas and Dropdowns styling in Dark Mode */
body.dark-theme input,
body.dark-theme textarea,
body.dark-theme select,
body.dark-theme .chat-input,
body.dark-theme .search-input {
    background-color: #1a243a !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.8;
}

/* Special Button Overrides */
body.dark-theme .btn-secondary,
body.dark-theme .sources-toggle-btn {
    background-color: #1c2841 !important;
    color: var(--text-main) !important;
    border-color: var(--border) !important;
}

body.dark-theme .btn-secondary:hover,
body.dark-theme .sources-toggle-btn:hover {
    background-color: #243557 !important;
    border-color: var(--primary) !important;
}

/* Active links and elements adjustments */
body.dark-theme .nav-links a:not(.active):hover {
    background: rgba(255, 255, 255, 0.03);
    color: #f1f5f9;
}

body.dark-theme .nav-links a.active {
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Table heads and lists inside sections */
body.dark-theme th {
    background-color: #1a243a !important;
    color: var(--text-main) !important;
    border-bottom: 2px solid var(--border) !important;
}

body.dark-theme td {
    border-color: var(--border) !important;
}

/* Focus and active borders */
body.dark-theme .search-box-premium:focus-within {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25) !important;
}

/* Smooth glassmorphic highlights in dark mode */
body.dark-theme .sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

body.dark-theme .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
