/* ========================= RESET & BASE ========================= */
:root {
    --col-head-width: 250px;
}

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

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f5f6fa;
    color: #333;
    line-height: 1.5;
}

h1 {
    text-align: center;
    margin-top: 40px;
	margin-bottom: 20px;
    font-size: 2rem; 
    color: #2c3e50;
}

button {
	border: 0;
	padding: 0;
	margin: 0;
	border-radius: 4px;
	background: transparent;
}

button:hover {
	cursor: pointer;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

/* ========================= HEADER ========================= */
.header {
    background:#0d2c54;
    color:white;
    text-align:center;
    padding:25px;
}

.app-title {
    margin:0;
    color:white;
}

/* ========================= MAIN CONTAINER ========================= */
.main-container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 15px;
}

/* ========================= TITRES ========================= */
.section-title {
    margin: 20px 0 10px;
    font-size: 1.5rem;
    color: #2c3e50;
}

/* ========================= CARTES ========================= */
.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
}

.card-link:hover {
    transform: translateY(-3px);
    cursor: pointer;
}

/* ========================= FORMULAIRE LOGIN ========================= */
.login-card h2 {
    margin-bottom: 15px;
    text-align: center;
}

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

input {
	padding: 4px;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid #ccc;
    transition: 0.2s;
}

input:focus {
    border-color: #3498db;
    outline: none;
}

.form-select {
    width: auto;
    padding: 4px;
    font-size: 11px;
	font-weight: normal;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
    transition: 0.2s;
    cursor: pointer;
}

.form-select:focus {
    border-color: #3498db;
    outline: none;
}

/* ========================= BOUTONS ========================= */
.btn {
    display: inline-block;
    text-align: center;
    padding: 4px;
    border-radius: 4px;
    font-size: 11px;
	font-weight: normal;
    text-decoration: none;
    color: #fff;
    transition: 0.3s;
    cursor: pointer;
	box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.btn:hover {
    opacity: 0.9;
	box-shadow: 0 6px 14px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.primary { background-color: #2ecc71; }
.primary:hover { background-color: #27ae60; }

.logout { background-color: #e67e22; }
.logout:hover { background-color: #c0392b; }

.btn:not(.logout):not(.primary) {
    background-color: #3498db;
}
.btn:not(.logout):not(.primary):hover {
    background-color: #2980b9;
}

/* ========================= ALERTES ========================= */
.alert {
    background: #fdecea;
    color: #c0392b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
}

/* ========================= MENU CARD ========================= */
.menu-card {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.menu-card .btn {
    flex: 1 1 calc(50% - 10px);
}

/* ========================= DASHBOARD ========================= */
/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100%;
    background: #2c3e50;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding-top: 20px;
	z-index: 1000;
	overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.5rem;
}

.sidebar-menu {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    padding: 10px 20px;
    font-size: 0.9rem;
    color: #bdc3c7;
    text-transform: uppercase;
}

.sidebar a {
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;
}

.sidebar a:hover { background: #34495e; }
.logout { margin-top: auto; }

.main-content {
    margin-left: 250px;
    padding: 30px;
}

.dashboard-header h2 {
    margin-bottom: 15px;
}

.dashboard-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-card {
    flex: 1 1 calc(33% - 20px);
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 15px;
    transition: 0.2s;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stat-card i { font-size: 2rem; color: #3498db; }

.card-info p { font-size: 0.9rem; color: #7f8c8d; }
.card-info h3 { font-size: 1.5rem; }

/* ========================= UPDATE ========================= */
.update {
    text-align: center;
    font-style: italic;
    color: #7f8c8d;
    margin-top: 20px;
}

/* ========================= FOOTER ========================= */
.footer {
    text-align: center;
    padding: 20px 0;
    background: #ecf0f1;
    color: #7f8c8d;
}

/* ========================= FORMULAIRE LOGIN ========================= */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container .title {
    font-size: 2.2rem;
    margin-bottom: 30px;
    text-align: center;
}

.card.login-card {
    background: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Bouton toggle pour sidebar */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1000;
    background: #2c3e50;
    color: #fff;
    border: none;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 1.2rem;
    cursor: pointer;
}

/* ========================= TABLEAU PLANNING ========================= */
.div_table_planning {
    width: 100%;
    overflow: auto;
    max-height: 80vh;
}

.table_planning th.corner-cell { z-index: 1000; width: 220px; min-width: 220px; max-width: 220px;}
.table_planning th.headcol { z-index: 200; }
.table_planning thead tr:nth-child(1) th { z-index: 150; }
.table_planning thead tr:nth-child(2) th { z-index: 140; }
.table_planning thead tr:nth-child(3) th { z-index: 130; }

.table_planning {
    border-collapse: separate;
    border-spacing: 0;
	table-layout: fixed;
    width: max-content;
	font-weight: normal;
	font-size: 11px;
}

/* CELLS */
.table_planning td,
.table_planning th {
	border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
    padding: 2px;
    min-width: 45px;
    max-width: 45px;
	font-weight: normal;
	font-size: 11px;
}

.table_planning tr td:first-child,
.table_planning tr th:first-child {
    border-left: 1px solid #e0e0e0;
}

.table_planning thead tr:first-child th {
    border-top: 1px solid #e0e0e0;
}

/* HEADER STICKY */
.table_planning thead th {
    position: sticky;
    top: 0;
    background: #8DADBA;
	color: white;
	font-weight: normal;
	font-size: 11px;
}

.table_planning thead tr {
    height: 20px;
}

thead tr:nth-child(1) th { top: 0; }
thead tr:nth-child(2) th { top: 20px; }
thead tr:nth-child(3) th { top: 40px; }

/* PREMIÈRE COLONNE */
.corner-cell,
.table_planning th.headcol {
    position: sticky;
    left: 0;
    background: #8DADBA;
    color: white;
	width: 130px;
    min-width: 130px;
    max-width: 130px;
	font-weight: normal;
	font-size: 11px;
}

.table_planning th,
.table_planning td {
    background-clip: padding-box;
}

/* ========================= TABLEAU AUTRE ========================= */
.div_table_autre {
    width: 100%;
    overflow: auto;
    max-height: 80vh;
}

.table_autre th.corner-cell { z-index: 1000; width: 220px; min-width: 220px; max-width: 220px;}
.table_autre th.headcol { z-index: 200; }
.table_autre thead tr:nth-child(1) th { z-index: 150; }
.table_autre thead tr:nth-child(2) th { z-index: 140; }
.table_autre thead tr:nth-child(3) th { z-index: 130; }

.table_autre {
    border-collapse: separate;
    border-spacing: 0;
	table-layout: auto;
    width: 100%;
	font-weight: normal;
	font-size: 11px;
}

/* CELLS */
.table_autre td,
.table_autre th {
	border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
    padding: 2px;
	font-weight: normal;
	font-size: 11px;
}

.table_autre tr td:first-child,
.table_autre tr th:first-child {
    border-left: 1px solid #e0e0e0;
}

.table_autre thead tr:first-child th {
    border-top: 1px solid #e0e0e0;
}

/* HEADER STICKY */
.table_autre thead th {
    position: sticky;
    top: 0;
    background: #8DADBA;
	color: white;
	font-weight: normal;
	font-size: 11px;
	white-space: nowrap;
}

.table_autre thead tr {
    height: 20px;
}

thead tr:nth-child(1) th { top: 0; }
thead tr:nth-child(2) th { top: 20px; }
thead tr:nth-child(3) th { top: 40px; }

/* PREMIÈRE COLONNE */
.corner-cell,
.table_autre th.headcol {
    position: sticky;
    left: 0;
    background: #8DADBA;
    color: white;
	width: 130px;
    min-width: 130px;
    max-width: 130px;
	font-weight: normal;
	font-size: 11px;
}

.table_autre th,
.table_autre td {
    background-clip: padding-box;
}

.year-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.year-nav form {
    margin: 0;
}

.current-year {
    font-weight: bold;
    font-size: 1.5em;
    min-width: 60px;
    text-align: center;
}

th.day-detail {
    background-color: #FFF5A0;
}

.table_planning td.vac-cell.active {
    background-color: #e74c3c;
    color: white;
}

.table_planning td.vac-cell.locked {
    cursor: not-allowed;
    opacity: 0.6;
}

.total-ok {
    background-color: #d4edda;
    color: #155724;
    text-align: center;
}

.total-warn {
    background-color: #fff3cd;
    color: #856404;
    text-align: center;
}

.total-danger {
    background-color: #f8d7da;
    color: #721c24;
    text-align: center;
}

.autre-field{
    display:none;
    margin-top:6px;
}

.btn-ajouter{
    background:#4CAF50;
    color:white;
    border:none;
    padding:10px 20px;
    border-radius:8px;
    font-size:15px;
    cursor:pointer;
    transition:0.2s;
}

.btn-ajouter:hover{
    background:#43a047;
    transform:scale(1.03);
}

.cell {
    position: relative;
    padding: 0;
}

.cell-select {
    position: absolute;
    inset: 0;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 100%;
    margin: 0;
    padding: 0;
    border: none;
    opacity: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    z-index: 1;
}

.cell-input {
    position: relative;
    z-index: 2;
    width: 80%;
	height: 100%;
    border: 0;
    background: transparent;
    padding: 4px;
    box-sizing: border-box;
	text-align: center;
	font-weight: normal;
	font-size: 11px;
	display: block;
    margin-right: auto;
}

/* ========================= TOOLTIP ========================= */
.medecin-tooltip-container{
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.medecin-identite{
    transition: color 0.2s ease;
}

.medecin-identite:hover{
    color: #3498db;
}

.medecin-tooltip {
    position: absolute;
    left: 130px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 220px;
    background: #1f2937;
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 6px 18px rgba(0,0,0,.25);
    opacity: 0;
    visibility: hidden;
    z-index: 10001;
}

.tooltip-desiderata{
    color: #facc15;
    font-weight: bold;
}

.medecin-tooltip-container:hover .medecin-tooltip,
.medecin-tooltip-container.active .medecin-tooltip {
	opacity: 1;
	visibility: visible;
	transform: translateY(-50%);
}
	
/* ========================= RESPONSIVE ========================= */
@media (max-width: 768px) {
	:root {
        --col-head-width: 100px;
    }
	
    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        width: 250px;
        height: 100%;
        transition: left 0.3s ease;
        z-index: 1000;
        padding-top: 20px;
    }

    .sidebar.show {
        left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content.overlay {
		filter: brightness(0.7);
	}

    .sidebar-header {
        margin-bottom: 10px;
    }
    .sidebar-header h2 {
        text-align: center;
    }

    .sidebar-menu {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .sidebar a {
        justify-content: flex-start;
        padding: 12px 20px;
    }

    .logout {
        margin-top: 10px;
        align-self: center;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    /* ========================= COLONNE NOM MEDECIN ========================= */
    .table_planning th.corner-cell,
    .table_planning th.headcol {
        width: 130px;
        min-width: 130px;
        max-width: 130px;
        font-weight: normal;
		font-size: 10px;
        padding: 0;
    }

    /* ========================= CELLULES PLANNING ========================= */
    .table_planning td,
    .table_planning th {
        min-width: 45px;
        max-width: 45px;
        padding: 2px;
        font-weight: normal;
		font-size: 10px;
    }

    /* ========================= HAUTEUR HEADER (important sticky) ========================= */
    .table_planning thead tr {
        height: 20px;
    }

    thead tr:nth-child(1) th { top: 0; }
    thead tr:nth-child(2) th { top: 20px; }
    thead tr:nth-child(3) th { top: 40px; }

    /* ========================= OPTIMISATION TEXTE NOM MEDECIN ========================= */
    .table_planning th.corner-cell,
    .table_planning th.headcol {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ========================= SCROLL PLUS FLUID MOBILE ========================= */
    .div_table_planning {
        max-height: 80vh;
        -webkit-overflow-scrolling: touch;
    }
	
	.medecin-tooltip {
		position: fixed;
		opacity: 0;
		visibility: hidden;
		z-index: 999999;
		transform: none;
	}

    .medecin-tooltip-container.active .medecin-tooltip {
		opacity: 1;
		visibility: visible;
	}
}