/* Dashboard Manager V2 - Design Moderne */

/* Variables CSS */
:root {
    /* Couleurs principales */
    --dashboard-bg: linear-gradient(135deg, #f5f7fa 0%, #e4e8ed 100%);
    --widget-bg: rgba(255, 255, 255, 0.85);
    --widget-border: rgba(255, 255, 255, 0.6);
    --widget-shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
    --widget-shadow-hover: 0 12px 40px rgba(31, 38, 135, 0.18);

    /* Couleurs thématiques */
    --primary: #4e73df;
    --secondary: #2c9faf;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --purple: #8b5cf6;
    --pink: #ec4899;
    --orange: #f97316;

    /* Gradients par widget */
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-missions: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    --gradient-staffing: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-debts: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-overtime: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --gradient-absences: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
    --gradient-contracts: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    --gradient-events: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);

    /* Texte */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* Effets */
    --glass-blur: blur(10px);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container principal */
.dashboard-container {
    background: var(--dashboard-bg);
    min-height: calc(100vh - 56px);
    padding: 2rem;
}

/* Hero Header */
.dashboard-hero {
    background: var(--gradient-hero);
    border-radius: 1.5rem;
    padding: 2rem 2.5rem;
    margin-bottom: 2rem;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.dashboard-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-greeting {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.5px;
}

.hero-date {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
    font-weight: 400;
}

/* Widget Cards - Glassmorphism */
.dashboard-widget {
    background: var(--widget-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--widget-border);
    border-radius: 1rem;
    box-shadow: var(--widget-shadow);
    transition: var(--transition-smooth);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

/* Widget Header */
.dashboard-widget .card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-widget .card-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Widget Icons avec Gradients */
.widget-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
}

.widget-icon-missions { background: var(--gradient-missions); }
.widget-icon-staffing { background: var(--gradient-staffing); }
.widget-icon-debts { background: var(--gradient-debts); }
.widget-icon-overtime { background: var(--gradient-overtime); }
.widget-icon-absences { background: var(--gradient-absences); }
.widget-icon-contracts { background: var(--gradient-contracts); }
.widget-icon-events { background: var(--gradient-events); }

/* Header Badge */
.dashboard-widget .header-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
}

/* Widget Body */
.dashboard-widget .card-body {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    max-height: 320px;
}

/* Widget Footer */
.dashboard-widget .card-footer {
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.875rem 1.5rem;
    text-align: center;
}

.dashboard-widget .card-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-widget .card-footer a:hover {
    color: var(--secondary);
    gap: 0.75rem;
}

/* ===== WIDGET: MISSIONS ===== */
.mission-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mission-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: var(--transition-smooth);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

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

.mission-item:hover { background: rgba(78, 115, 223, 0.04); }

.mission-item.mission-overdue {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.08) 0%, transparent 100%);
    border-left: 3px solid var(--danger);
}

.mission-content { flex: 1; min-width: 0; }

.mission-title {
    color: var(--text-primary);
    font-weight: 500;
    text-decoration: none;
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--transition-smooth);
}

.mission-title:hover { color: var(--primary); }

.mission-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.mission-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.mission-badges .badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
}

.mission-deadline {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

/* ===== WIDGET: STAFFING ===== */
.staffing-table { padding: 0.5rem 0; }

.staffing-row {
    display: flex;
    align-items: center;
    padding: 0.625rem 1.5rem;
    gap: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: var(--transition-smooth);
}

.staffing-row:last-child { border-bottom: none; }
.staffing-row:hover { background: rgba(16, 185, 129, 0.04); }

.day-info { width: 60px; flex-shrink: 0; }

.day-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.day-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.staffing-bar { flex: 1; min-width: 0; }

.staffing-progress {
    height: 28px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
}

.staffing-average-marker {
    position: absolute;
    top: 2px;
    bottom: 2px;
    width: 2px;
    background-color: #1f2937;
    z-index: 10;
    pointer-events: none;
    border-radius: 1px;
}

.staffing-progress-bar {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    transition: width 0.6s ease;
    border-radius: 0.5rem;
}

.staffing-progress-bar.bg-success { background: var(--gradient-staffing); }
.staffing-progress-bar.bg-warning { background: linear-gradient(90deg, #fbbf24, #f59e0b); color: #1f2937; }
.staffing-progress-bar.bg-danger { background: linear-gradient(90deg, #f87171, #ef4444); }
.staffing-progress-bar.bg-secondary { background: linear-gradient(90deg, #9ca3af, #6b7280); }

.deviation-badge { width: 55px; text-align: right; flex-shrink: 0; }

.deviation-badge .badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
}

/* ===== STAFFING NAV CONTROLS ===== */
.staffing-nav-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.staffing-nav-controls .header-badge {
    min-width: 45px;
    text-align: center;
}

.staffing-month-year {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.btn-nav {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 0;
}

.btn-nav:hover:not(:disabled) {
    background: var(--gradient-staffing);
    color: white;
    border-color: transparent;
    transform: scale(1.1);
}

.btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-nav i {
    font-size: 0.85rem;
}

/* ===== WIDGET: DETTES ===== */
.debt-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.debt-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
}

.debt-item:last-child { border-bottom: none; }
.debt-item:hover { background: rgba(245, 158, 11, 0.04); }

.debt-employee { flex: 1; }

.debt-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.debt-shifts {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.debt-value {
    font-size: 1rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
}

.debt-value.debt-negative {
    background: rgba(78, 115, 223, 0.1);
    color: var(--primary);
}

.debt-value.debt-positive {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* ===== WIDGET: HEURES SUPPLEMENTAIRES ===== */
.overtime-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.overtime-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-smooth);
}

.overtime-item:last-child { border-bottom: none; }
.overtime-item:hover { background: rgba(249, 115, 22, 0.04); }

.overtime-employee { flex: 1; }

.overtime-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.overtime-shifts {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.overtime-hours {
    font-size: 1rem;
    font-weight: 700;
    color: var(--orange);
    background: rgba(249, 115, 22, 0.1);
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
}

/* ===== WIDGET: ABSENCES ===== */
.absence-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.absence-item {
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-smooth);
}

.absence-item:last-child { border-bottom: none; }
.absence-item:hover { background: rgba(236, 72, 153, 0.04); }

.absence-date {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 45px;
}

.absence-info { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }

.absence-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.absence-type {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--pink);
    background: rgba(236, 72, 153, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    width: fit-content;
}

/* ===== WIDGET: ÉVÉNEMENTS ===== */
.event-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.event-item {
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-smooth);
}

.event-item:last-child { border-bottom: none; }
.event-item:hover { background: rgba(139, 92, 246, 0.04); }

.event-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.event-icon.event-type-formation_dejeuner {
    background: rgba(249, 115, 22, 0.15);
    color: var(--orange);
}

.event-icon.event-type-animation {
    background: rgba(236, 72, 153, 0.15);
    color: var(--pink);
}

.event-icon.event-type-autre {
    background: rgba(139, 92, 246, 0.15);
    color: var(--purple);
}

.event-info { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }

.event-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.event-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.event-type-badge {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    background: rgba(139, 92, 246, 0.1);
    color: var(--purple);
    white-space: nowrap;
}

/* ===== WIDGET: CONTRATS ===== */
.contract-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.contract-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-smooth);
}

.contract-item:last-child { border-bottom: none; }
.contract-item:hover { background: rgba(6, 182, 212, 0.04); }

.contract-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.contract-icon.contract-start {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.contract-icon.contract-end {
    background: rgba(249, 115, 22, 0.15);
    color: var(--orange);
}

.contract-info { flex: 1; }

.contract-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.contract-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.contract-type-badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    background: rgba(6, 182, 212, 0.1);
    color: var(--info);
}

.contract-days {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    opacity: 0.4;
    margin-bottom: 0.75rem;
    display: block;
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.widget-col {
    animation: fadeInUp 0.5s ease-out;
}

.widget-col:nth-child(1) { animation-delay: 0s; }
.widget-col:nth-child(2) { animation-delay: 0.1s; }
.widget-col:nth-child(3) { animation-delay: 0.15s; }
.widget-col:nth-child(4) { animation-delay: 0.2s; }
.widget-col:nth-child(5) { animation-delay: 0.25s; }
.widget-col:nth-child(6) { animation-delay: 0.3s; }
.widget-col:nth-child(7) { animation-delay: 0.35s; }

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .dashboard-container { padding: 1rem; }

    .dashboard-hero {
        padding: 1.5rem;
        border-radius: 1rem;
    }

    .hero-greeting { font-size: 1.5rem; }

    .dashboard-widget .card-body { max-height: 280px; }
}

@media (max-width: 575.98px) {
    .dashboard-container { padding: 0.75rem; }

    .dashboard-hero {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .hero-greeting { font-size: 1.35rem; }
    .hero-date { font-size: 0.9rem; }

    .dashboard-widget .card-header { padding: 1rem 1.25rem; }
    .dashboard-widget .card-footer { padding: 0.75rem 1.25rem; }

    .mission-item,
    .debt-item,
    .overtime-item,
    .absence-item,
    .event-item,
    .contract-item {
        padding: 0.875rem 1.25rem;
    }

    .staffing-row { padding: 0.5rem 1.25rem; }
}

/* ===== SCROLLBAR PERSONNALISEE ===== */
.dashboard-widget .card-body::-webkit-scrollbar {
    width: 4px;
}

.dashboard-widget .card-body::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-widget .card-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.dashboard-widget .card-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}
