/* ============================================
   Bulletin de Paie - Styles principaux
   ============================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --bg-light: #f1f5f9;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 15px rgba(0,0,0,0.1);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
}

/* ---- NAVBAR ---- */
.navbar {
    padding: 0.5rem 1rem;
    z-index: 1040;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.2rem;
}

.navbar .nav-link {
    padding: 0.6rem 1rem;
    font-weight: 500;
    border-radius: 8px;
    margin: 0 2px;
    transition: background 0.2s;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: rgba(255,255,255,0.15);
}

/* ---- CONTENU PRINCIPAL ---- */
.main-content {
    padding-top: 70px;
    min-height: 100vh;
}

/* ---- PAGE DE CONNEXION ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
    padding: 1rem;
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.login-card .logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-card .logo i {
    font-size: 3rem;
    color: var(--primary);
}

.login-card .logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 0.5rem;
}

/* ---- CARTES ---- */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}

/* ---- CHAMPS OPTIONNELS (jaune clair) ---- */
.card.card-optional {
    border-color: #ffc107;
    border-style: dashed;
}
.card.card-optional > .card-header {
    background: #fff9e6;
    color: #856404;
}
.card.card-optional > .card-header .badge-optional {
    background: #ffc107;
    color: #212529;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.2em 0.5em;
    border-radius: 3px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ---- STAT CARDS (Dashboard) ---- */
.stat-card {
    border-radius: var(--radius);
    padding: 1.5rem;
    color: white;
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card .stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 0.3rem;
}

.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

/* ---- BOUTONS ---- */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.2rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-back {
    background: var(--secondary);
    border-color: var(--secondary);
    color: white;
}

.btn-back:hover {
    background: #475569;
    color: white;
}

/* ---- TABLEAUX ---- */
.table {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
}

.table thead th {
    background: var(--primary);
    color: white;
    font-weight: 600;
    border: none;
    padding: 0.8rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--primary-light);
}

/* ---- TABLE RESPONSIVE MOBILE ---- */
@media (max-width: 768px) {
    .table-responsive-cards thead {
        display: none;
    }

    .table-responsive-cards tbody tr {
        display: block;
        background: var(--bg-white);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        margin-bottom: 1rem;
        padding: 1rem;
    }

    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.4rem 0;
        border: none;
    }

    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--secondary);
        margin-right: 1rem;
        flex-shrink: 0;
    }

    .table-responsive-cards tbody td:last-child {
        justify-content: center;
        padding-top: 0.8rem;
        margin-top: 0.5rem;
        border-top: 1px solid var(--border);
    }
}

/* ---- FORMULAIRES ---- */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 0.6rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.3rem;
}

/* ---- PAGE TITLE ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

/* ---- BADGES ---- */
.badge {
    font-weight: 500;
    padding: 0.4em 0.7em;
    border-radius: 6px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 576px) {
    .main-content {
        padding-top: 60px;
    }

    .login-card {
        padding: 1.5rem;
    }

    .stat-card .stat-number {
        font-size: 1.8rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header .btn {
        width: 100%;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }

    h1 {
        font-size: 1.3rem;
    }
}

/* ---- UTILITAIRES ---- */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

/* Animation de chargement */
.spinner-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}
