/* ===== Intelia Congés - Feuille de style ===== */
:root {
    --primary: #2c5282;
    --primary-dark: #1a365d;
    --primary-light: #ebf4ff;
    --secondary: #4a5568;
    --success: #38a169;
    --success-light: #c6f6d5;
    --danger: #e53e3e;
    --danger-light: #fed7d7;
    --warning: #d69e2e;
    --warning-light: #fefcbf;
    --info: #3182ce;
    --info-light: #bee3f8;
    --bg: #f7fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #2d3748;
    --text-muted: #718096;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 6px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.app-header {
    background: var(--primary-dark);
    color: white;
    box-shadow: var(--shadow);
}
.app-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}
.brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: white;
    padding: 1rem 0;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.brand:hover { text-decoration: none; color: #fff; }
.brand-icon {
    background: white;
    color: var(--primary-dark);
    width: 32px; height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.main-nav {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex: 1;
    margin-left: 2rem;
}
.main-nav a {
    color: rgba(255,255,255,0.85);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
}
.main-nav a:hover, .main-nav a.active {
    background: rgba(255,255,255,0.15);
    color: white;
    text-decoration: none;
}
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255,255,255,0.9);
}
.user-menu .avatar {
    background: var(--primary);
    color: white;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}
.user-menu a { color: rgba(255,255,255,0.9); }

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1.5rem;
}
main.container {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}
.card-title {
    margin: 0 0 1rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== Stats / soldes ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.stat-card.cp { border-left-color: var(--primary); }
.stat-card.rtt { border-left-color: var(--info); }
.stat-card.attente { border-left-color: var(--warning); }
.stat-card.valide { border-left-color: var(--success); }
.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 0.25rem;
}
.stat-unit {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ===== Boutons ===== */
.btn {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #2f855a; color: white; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #c53030; color: white; }
.btn-secondary { background: white; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-link { background: none; border: none; color: var(--primary); padding: 0; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}
.required { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    background: white;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.15);
}
textarea { resize: vertical; min-height: 80px; }
.form-help { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }
.checkbox-group { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-group input { width: auto; margin: 0; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
}
table.data th {
    background: var(--bg);
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
}
table.data td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
table.data tbody tr:hover { background: var(--bg); }
table.data tbody tr:last-child td { border-bottom: none; }

/* ===== Badges / statuts ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-attente { background: var(--warning-light); color: #744210; }
.badge-valide { background: var(--success-light); color: #22543d; }
.badge-refuse { background: var(--danger-light); color: #742a2a; }
.badge-annule { background: #edf2f7; color: var(--text-muted); }
.badge-info { background: var(--info-light); color: #2c5282; }

/* ===== Alertes (flash messages) ===== */
.flash-messages { margin-bottom: 1.5rem; }
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    border-left: 4px solid;
    font-size: 0.9rem;
}
.alert-success { background: var(--success-light); border-color: var(--success); color: #22543d; }
.alert-danger { background: var(--danger-light); border-color: var(--danger); color: #742a2a; }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: #744210; }
.alert-info { background: var(--info-light); border-color: var(--info); color: #2c5282; }

/* ===== Login page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    padding: 2rem;
}
.login-box {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo h1 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 1.5rem;
}
.login-logo p {
    color: var(--text-muted);
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
}

/* ===== Calendrier ===== */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.calendar-nav .month-title {
    font-size: 1.25rem;
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

.calendar {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.calendar th {
    background: var(--bg);
    padding: 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    text-align: center;
    width: 14.28%;
}
.calendar td {
    border: 1px solid var(--border);
    height: 110px;
    vertical-align: top;
    padding: 0.5rem;
    position: relative;
}
.calendar .day-number {
    font-weight: 600;
    color: var(--text);
    font-size: 0.85rem;
}
.calendar .other-month { background: #fafafa; }
.calendar .other-month .day-number { color: #cbd5e0; }
.calendar .weekend { background: #f5f7fa; }
.calendar .ferie { background: #fff5f5; }
.calendar .ferie .day-number { color: var(--danger); }
.calendar .today { background: var(--primary-light); }
.calendar .today .day-number { color: var(--primary-dark); }
.calendar .conge-jour { background: var(--success-light); }

.event {
    display: block;
    margin-top: 0.25rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    line-height: 1.3;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.event.travail { background: #4299e1; }
.event.teletravail { background: #9f7aea; }
.event.deplacement { background: #ed8936; }
.event.astreinte { background: #e53e3e; }
.event.reunion { background: #38b2ac; }
.event.conge { background: var(--success); }

.add-day {
    position: absolute;
    bottom: 4px;
    right: 4px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.15s;
}
.calendar td:hover .add-day { opacity: 1; }

/* Equipe */
.team-grid {
    overflow-x: auto;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.team-grid table {
    border-collapse: collapse;
    min-width: 100%;
}
.team-grid th, .team-grid td {
    padding: 0.4rem 0.3rem;
    text-align: center;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    min-width: 32px;
}
.team-grid th.employee, .team-grid td.employee {
    text-align: left;
    background: var(--bg);
    font-weight: 600;
    position: sticky;
    left: 0;
    min-width: 180px;
    z-index: 1;
}
.team-grid .weekend { background: #f5f7fa; color: var(--text-muted); }
.team-grid .ferie { background: #fff5f5; }
.team-grid .conge { background: var(--success); color: white; font-weight: 600; }
.team-grid .today-col { background: var(--primary-light); }

/* ===== Dashboard ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Page header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}
.page-subtitle {
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-size: 0.9rem;
}
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ===== Filtres ===== */
.filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}
.filters select, .filters input {
    width: auto;
    min-width: 180px;
}

/* Modale simple */
.modal-bg {
    display: none;
    position: fixed; top:0; left:0; right:0; bottom:0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center; justify-content: center;
}
.modal-bg.show { display: flex; }
.modal {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}
.modal h3 { margin-top: 0; }

@media (max-width: 768px) {
    .main-nav { display: none; }
    .container { padding: 0 1rem; }
    .stat-value { font-size: 1.5rem; }
    .form-row { grid-template-columns: 1fr; }
    .calendar td { height: 80px; font-size: 0.75rem; }
}

/* ===== Footer (version) ===== */
.app-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 0;
    margin-top: 3rem;
    background: white;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.app-footer .container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.version-tag {
    display: inline-block;
    background: var(--bg);
    color: var(--text);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid var(--border);
    margin-left: 0.25rem;
    font-family: monospace;
}
.footer-sep { color: var(--border); }
