/* ============================================================
   PAGE HEADER — Composant standardisé SIRH IPS-CO
   Usage: class="page-header page-header--branded" (orange IPS-CO)
   Thèmes: --branded (orange), --finance (bleu), --hr (vert)
   Sans modificateur : en-tête neutre (blanc)
   ============================================================ */

/* --- Base neutre --- */
.page-header {
    background: var(--color-white);
    color: var(--color-gray-800);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--page-header-radius);
    padding: var(--page-header-padding);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

/* --- Variante IPS-CO orange (opt-in) --- */
.page-header--branded,
.page-header--default {
    background: var(--ipsco-gradient);
    color: white;
    border: none;
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.25);
}

.page-header--branded::before,
.page-header--default::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    animation: header-pulse 6s ease-in-out infinite;
    pointer-events: none;
}

.page-header--branded::after,
.page-header--default::after {
    content: '';
    position: absolute;
    bottom: -60%;
    left: -5%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    pointer-events: none;
}

@keyframes header-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50%       { transform: scale(1.15); opacity: 0.3; }
}

/* --- Titre principal --- */
.page-header__title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.page-header__subtitle {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-bottom: 0;
    position: relative;
    z-index: 1;
}

/* --- Actions dans le header --- */
.page-header__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.page-header--branded .page-header__actions .btn,
.page-header--default .page-header__actions .btn {
    background: rgba(255, 255, 255, 0.95);
    color: var(--ipsco-accent-dark);
    border: 2px solid rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.page-header--branded .page-header__actions .btn:hover,
.page-header--default .page-header__actions .btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.page-header--branded .page-header__actions .btn--primary-cta,
.page-header--default .page-header__actions .btn--primary-cta {
    background: white;
    color: var(--ipsco-accent-dark);
    border: 2px solid white;
    font-weight: 700;
}

/* --- Variante Finance (modules Paie, Comptabilité, Trésorerie) --- */
.page-header--finance {
    background: var(--ipsco-gradient-finance);
    color: white;
    border: none;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.25);
}

.page-header--finance .page-header__actions .btn {
    color: var(--color-primary-dark);
}

/* --- Variante RH (modules Congés, Missions, Medical) --- */
.page-header--hr {
    background: var(--ipsco-gradient-hr);
    color: white;
    border: none;
    box-shadow: 0 10px 30px rgba(5, 150, 105, 0.25);
}

.page-header--hr .page-header__actions .btn {
    color: #065f46;
}

/* --- Stat Cards standardisées --- */
.stat-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    border: none;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
    transition: width 0.3s ease;
}

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

.stat-card.stat-card--primary::before { background: var(--ipsco-accent); }
.stat-card.stat-card--success::before { background: var(--color-success); }
.stat-card.stat-card--warning::before { background: var(--color-warning); }
.stat-card.stat-card--danger::before  { background: var(--color-error); }
.stat-card.stat-card--info::before    { background: var(--color-primary); }

.stat-card__icon {
    font-size: 3rem;
    opacity: 0.12;
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.stat-card:hover .stat-card__icon {
    opacity: 0.22;
    transform: translateY(-50%) scale(1.1);
}

.stat-card__value {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.4rem;
    position: relative;
    z-index: 1;
}

.stat-card__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-gray-500);
    position: relative;
    z-index: 1;
}

.stat-card__trend {
    font-size: 0.75rem;
    margin-top: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-gray-400);
    position: relative;
    z-index: 1;
}

/* --- Gradient Header (legacy modules Employés, etc.) --- */
.gradient-header {
    background: var(--ipsco-gradient);
    color: white;
    border-radius: var(--page-header-radius);
    padding: var(--page-header-padding);
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.25);
    position: relative;
    overflow: hidden;
}

.gradient-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    pointer-events: none;
}

.gradient-header h1,
.gradient-header h2,
.gradient-header h3 {
    position: relative;
    z-index: 1;
}

/* --- Filter Cards — neutre par défaut (évite conflits globaux) --- */
.filter-card {
    background: var(--color-white);
    color: var(--color-gray-800);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--color-gray-200);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.filter-card .form-label {
    color: var(--color-gray-600);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}

.filter-card .form-control,
.filter-card .form-select {
    background: var(--color-white);
    border: 1px solid var(--color-gray-300);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.filter-card .form-control:focus,
.filter-card .form-select:focus {
    background: var(--color-white);
    border-color: var(--ipsco-accent);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

/* Variante IPS-CO orange — opt-in explicite */
.filter-card--branded {
    background: var(--ipsco-gradient);
    color: white;
    border: none;
    box-shadow: 0 8px 20px rgba(249, 115, 22, 0.2);
}

.filter-card--branded .form-label {
    color: rgba(255, 255, 255, 0.9);
}

.filter-card--branded .form-control,
.filter-card--branded .form-select {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.filter-card--branded .form-control:focus,
.filter-card--branded .form-select:focus {
    background: white;
    border-color: white;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .page-header {
        padding: 1.25rem;
        border-radius: 12px;
    }
    .page-header__title {
        font-size: 1.35rem;
    }
    .page-header__actions {
        margin-top: 1rem;
    }
    .stat-card__value {
        font-size: 1.75rem;
    }
}

@media print {
    .page-header--branded,
    .page-header--default,
    .page-header--finance,
    .page-header--hr {
        background: var(--ipsco-accent) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .page-header__actions {
        display: none !important;
    }
}
