/* ==========================================================================
   RESPONSIVE CSS - Pisciculture Bachelier
   ========================================================================== */

/* ==========================================================================
   BASE RESPONSIVE - Rendre le layout fluide
   ========================================================================== */

#container {
	width: 100%;
	max-width: 1024px;
	height: auto;
	min-height: 100vh;
	box-sizing: border-box;
}

header {
	width: 100%;
	max-width: 1024px;
	height: auto;
	min-height: 144px;
}

footer {
	position: relative;
	bottom: auto;
	width: 100%;
}

footer p {
	width: 100%;
	max-width: 1014px;
	box-sizing: border-box;
}

/* Slider etangs - layout fluide */
#sliderEtangsContainer {
	width: 100%;
	max-width: 986px;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
}

.sliderPontonContainer {
	width: 100%;
	max-width: 880px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* Images responsive */
img {
	max-width: 100%;
	height: auto;
}

/* ==========================================================================
   HOMEPAGE - Corrections layout
   ========================================================================== */

/* Image header sans bordure, 100% largeur */
#id1 header img {
	width: 100%;
	height: auto;
	display: block;
	border: none;
}

/* Formulaire de connexion - padding */
#home-fade {
	padding: 15px;
	box-sizing: border-box;
}

#home-login, #home-forgot {
	padding: 10px;
	box-sizing: border-box;
}

/* Bouton login à droite */
#id1 #content button {
	float: right;
	margin-top: 15px;
}

/* ==========================================================================
   ONGLETS ETANGS - Design moderne
   ========================================================================== */

#etangTabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 20px 0 0 0;
	padding: 0;
	list-style: none;
}

#etangTabs li {
	margin: 0;
}

#etangTabs li a {
	display: block;
	padding: 12px 20px;
	background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
	border: 1px solid #ccc;
	border-bottom: none;
	border-radius: 8px 8px 0 0;
	text-decoration: none;
	color: #555;
	font-weight: 600;
	font-size: 13px;
	transition: all 0.2s ease;
	box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
}

#etangTabs li a:hover {
	background: linear-gradient(to bottom, #fff, #f0f0f0);
	color: #333;
}

#etangTabs li.active a {
	background: linear-gradient(to bottom, #59BFE8, #3a9fcf);
	color: #fff;
	border-color: #3a9fcf;
	box-shadow: 0 -3px 10px rgba(89,191,232,0.3);
}

/* ==========================================================================
   TABLEAU RESERVATIONS - Nouveau design
   ========================================================================== */

#etangTablesContainer {
	margin-top: -1px;
}

.etangTable {
	padding: 0;
}

.tableWrapper {
	position: relative;
	overflow: hidden;
}

.tableScroll {
	overflow: auto;
	max-height: 500px;
	-webkit-overflow-scrolling: touch;
}

/* Grille CSS pour le tableau */
.tableGrid {
	display: grid;
	/* Colonnes fixes : date 70px + swims 113px (calculé pour 8 swims sur ~980px) */
	grid-template-columns: 70px repeat(var(--nb-pontons, 8), 113px);
	width: max-content;
}

/* En-têtes - sticky en haut */
.headerCell {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 45px;
	background: #59BFE8;
	color: #fff;
	font-weight: bold;
	font-size: 11px;
	text-align: center;
	border-bottom: 2px solid #3a9fcf;
}

/* En-tête dates - sticky gauche ET haut */
.headerCell.dateHeader {
	position: sticky;
	left: 0;
	z-index: 20;
	background: #555;
	border-bottom: 2px solid #333;
	border-right: 2px solid #444;
	text-transform: uppercase;
}

/* Cellules dates - sticky gauche */
.dateCell {
	position: sticky;
	left: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 38px;
	background: #f5f5f5;
	border-bottom: 1px solid #ddd;
	border-right: 2px solid #ddd;
	box-sizing: border-box;
}

.dateCell span {
	font-weight: bold;
	font-size: 14px;
	color: #333;
	line-height: 1;
}

.dateCell small {
	font-size: 9px;
	color: #777;
	text-transform: uppercase;
	line-height: 1;
	margin-top: 2px;
}

/* Cellules de reservation */
.dataCell {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 38px;
	padding: 3px;
	border-bottom: 1px solid #eee;
	border-right: 1px solid #eee;
	box-sizing: border-box;
}

.dataCell a {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 4px;
	text-decoration: none;
	font-size: 11px;
	line-height: 32px;
	text-align: center;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding: 0 2px;
	box-sizing: border-box;
	transition: all 0.15s ease;
}

.dataCell a:hover {
	transform: scale(1.1);
	box-shadow: 0 2px 8px rgba(0,0,0,0.25);
	z-index: 5;
}

/* Etats des cellules - couleurs originales */
.dataCell a.libre {
	background: #BFBFBF;
	border: 1px solid #999;
}

.dataCell a.option,
.dataCell a.reserve {
	border: 1px solid rgba(0,0,0,0.2);
}

.dataCell a.close {
	background: #333;
	border: 1px solid #000;
	color: #fff;
}

/* Cellules vides (pour compléter jusqu'à 8) */
.headerCell.emptyCell {
	background: #ddd;
	border-bottom-color: #bbb;
}

.dataCell.emptyCell {
	background: #f0f0f0;
	border-bottom: 1px solid #ddd;
	border-right: 1px solid #ddd;
}

/* Ancien slider - masquer */
#sliderEtangsContainer,
#listEtangs,
.navPonton {
	display: none !important;
}

/* ==========================================================================
   POPUPS - Contours modernes uniquement
   ========================================================================== */

/* Tous les popups - bordures arrondies et ombres */
#popup,
#popupEdit,
#popupOK {
	z-index: 9999 !important;
	border-radius: 12px !important;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4) !important;
	overflow: hidden !important;
}

/* Boutons popup édition */
.popButtons {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	margin-top: 15px;
}

.popButtons button {
	padding: 10px 20px;
	border: none !important;
	border-radius: 4px;
	cursor: pointer;
	font-weight: bold;
	text-transform: uppercase;
	font-size: 12px;
	width: auto !important;
	float: none !important;
	color: #fff !important;
}

.popButtons .btn-edit {
	background: #59BFE8 !important;
	color: #fff !important;
}

.popButtons .btn-edit:hover {
	background: #3a9fcf !important;
}

.popButtons .btn-cancel-edit {
	background: #c0392b !important;
	color: #fff !important;
}

.popButtons .btn-cancel-edit:hover {
	background: #a93226 !important;
}

/* Légende - masquée sur toutes les pages */
#legend {
	display: none !important;
}

/* ==========================================================================
   TABLETTE (820px et moins - iPad Air inclus)
   ========================================================================== */

@media screen and (max-width: 820px) {
	#container {
		width: 100%;
		padding: 0 10px;
		box-sizing: border-box;
		border-top-width: 10px;
	}

	header {
		height: auto;
		min-height: auto;
		/* Annuler le padding du container parent */
		margin-left: -10px;
		margin-right: -10px;
		width: calc(100% + 20px);
	}

	/* Navigation verticale tablette */
	header nav {
		position: relative;
		bottom: auto;
		height: auto;
		padding: 0;
		margin: 0;
	}

	header nav ul {
		display: flex;
		flex-direction: column;
		width: 100%;
		padding: 0;
		margin: 0;
	}

	header nav ul li {
		width: 100%;
		border-bottom: 1px solid #ddd;
	}

	header nav ul li:last-child {
		border-bottom: none;
	}

	header nav ul li a {
		display: block;
		width: 100%;
		height: auto;
		padding: 15px 20px;
		margin: 0;
		font-size: 14px;
		font-weight: bold;
		color: #333;
		text-align: left;
		text-decoration: none;
		background: #f5f5f5;
		border: none;
		box-sizing: border-box;
		float: none;
	}

	header nav ul li a:hover,
	header nav ul li.active a {
		background: #59BFE8;
		color: #fff;
	}

	header aside {
		position: relative;
		top: auto;
		right: auto;
		text-align: right;
		padding: 10px 15px;
		background: #333;
	}

	header aside a {
		color: #fff;
	}

	#content {
		padding: 20px 10px 0 10px;
	}

	/* Page d'accueil */
	#id1 #content {
		padding: 20px 10px 0 10px !important;
	}

	#id1 #content #presentation {
		width: 100%;
		max-width: 100%;
		float: none;
		border-right: none;
		border-bottom: 1px solid #999;
		padding-right: 0;
		padding-bottom: 20px;
		margin-right: 0;
		margin-bottom: 20px;
	}

	#home-fade {
		width: 100%;
		max-width: 100%;
		float: none;
	}

	/* Masquer l'image header sur tablette */
	header img {
		display: none;
	}

	#home-login, #home-forgot {
		position: relative;
		width: 100%;
		max-width: 100%;
		padding: 0;
	}

	#id1 #content input {
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
	}

	#id1 #content label.loginRemembermeLabel {
		width: 100%;
		max-width: 100%;
		padding-left: 0;
	}

	/* Forgot link à gauche, bouton à droite */
	.lgnForgotLink {
		float: left;
		text-align: left;
	}

	#id1 #content button {
		float: right;
	}

	/* Page contact */
	#id7 #left {
		width: 100%;
		max-width: 100%;
		float: none;
	}

	#id7 #left article {
		width: 100%;
		max-width: 100%;
		float: none;
	}

	#id7 form {
		width: 100%;
		max-width: 100%;
		float: none;
		margin-top: 30px;
	}

	/* Tableau reservations tablette */
	#etangTabs {
		gap: 5px;
	}

	#etangTabs li a {
		padding: 10px 15px;
		font-size: 12px;
	}

	.tableScroll {
		max-height: 400px;
	}

	.tableGrid {
		/* Tablette : 60px date + 95px par swim (pour 8 swims sur ~820px) */
		grid-template-columns: 60px repeat(var(--nb-pontons, 8), 95px);
	}

	.headerCell {
		height: 40px;
		font-size: 10px;
	}

	.dateCell, .dataCell {
		height: 32px;
	}

	.dateCell span {
		font-size: 12px;
	}

	.dateCell small {
		font-size: 8px;
	}

	.dataCell a {
		line-height: 26px;
		font-size: 7px;
	}

	/* Dashboard */
	#dashboard h3 {
		float: none;
		margin: 0 auto 20px auto;
	}

	/* Popups - centrage responsive tablette */
	#popup, #popupOK, #popupEdit {
		width: 90% !important;
		max-width: 500px !important;
		height: auto !important;
		left: 50% !important;
		top: 50% !important;
		margin: 0 !important;
		transform: translate(-50%, -50%) !important;
		max-height: 90vh;
		overflow-y: auto;
	}

	#popup div#main,
	#popupEdit div#mainEdit {
		width: 100% !important;
		height: auto !important;
		padding: 20px !important;
		box-sizing: border-box;
	}

	.dateReservation {
		width: 100%;
		float: none;
		margin-bottom: 15px;
	}

	.dateReservation input {
		width: 100%;
	}

	.popInfos input.long,
	.popInfos textarea {
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
	}

	/* Selection annee */
	#selectionAnnee {
		position: relative;
		top: auto;
		right: auto;
		margin: 10px 0;
		text-align: center;
	}


	footer {
		position: relative;
		bottom: auto;
		padding: 20px 0;
	}
}

/* ==========================================================================
   MOBILE (480px et moins)
   ========================================================================== */

@media screen and (max-width: 480px) {
	body {
		font-size: 14px;
	}

	/* Masquer l'image header sur mobile */
	header img {
		display: none;
	}

	/* Pas de padding sur le formulaire login */
	#home-login, #home-forgot {
		padding: 0;
	}

	#id1 #content input {
		box-sizing: border-box;
	}

	#id1 #content label.loginRemembermeLabel {
		padding-left: 0;
	}

	/* Forgot link à gauche, bouton à droite */
	.lgnForgotLink {
		float: left;
		text-align: left;
	}

	#id1 #content button {
		float: right;
	}

	#container {
		padding: 0 5px;
		border-top-width: 10px;
	}

	header {
		/* Annuler le padding du container parent */
		margin-left: -5px;
		margin-right: -5px;
		width: calc(100% + 10px);
	}

	/* Navigation verticale mobile */
	header nav ul li a {
		padding: 12px 15px;
		font-size: 13px;
	}

	#content {
		padding: 15px 5px 0 5px;
	}

	#id1 #content {
		padding: 15px 5px 0 5px !important;
	}

	/* Tableau reservations mobile */
	#etangTabs {
		display: flex;
		flex-wrap: nowrap;
		overflow-x: auto;
		gap: 8px;
		margin: 15px 0 10px 0;
		padding: 5px;
		background: #f0f0f0;
		border-radius: 25px;
		-webkit-overflow-scrolling: touch;
	}

	#etangTabs::-webkit-scrollbar {
		display: none;
	}

	#etangTabs li a {
		display: block;
		padding: 10px 16px;
		font-size: 11px;
		font-weight: 600;
		border-radius: 20px;
		background: transparent;
		border: none;
		color: #666;
		white-space: nowrap;
		box-shadow: none;
		transition: all 0.2s ease;
	}

	#etangTabs li a:hover {
		background: rgba(89, 191, 232, 0.15);
		color: #3a9fcf;
	}

	#etangTabs li.active a {
		background: #59BFE8;
		color: #fff;
		box-shadow: 0 2px 8px rgba(89, 191, 232, 0.4);
	}

	#etangTablesContainer {
		border-radius: 0;
	}

	.tableScroll {
		max-height: 60vh;
	}

	.tableGrid {
		/* Mobile : 45px date + 100px par swim (3 swims visibles sur ~365px) */
		grid-template-columns: 45px repeat(var(--nb-pontons, 8), 100px);
	}

	.headerCell {
		height: 40px;
		font-size: 11px;
	}

	.dateCell, .dataCell {
		height: 40px;
	}

	.dateCell span {
		font-size: 13px;
	}

	.dateCell small {
		font-size: 9px;
	}

	.dataCell {
		padding: 3px;
	}

	.dataCell a {
		font-size: 11px;
		line-height: 34px;
		border-radius: 4px;
	}

	/* Popups mobile */
	#popup, #popupOK, #popupEdit {
		width: 95% !important;
		max-width: none !important;
	}

	#popup div#main,
	#popupEdit div#mainEdit {
		padding: 15px !important;
	}

	#popupEdit div#mainEdit .popInfos .dateReservation,
	#popup div#main .popInfos .dateReservation {
		width: 100%;
		float: none;
		margin-bottom: 15px;
	}

	#popupEdit div#mainEdit .popInfos .dateReservation input,
	#popup div#main .popInfos .dateReservation input {
		width: 100% !important;
		box-sizing: border-box;
	}

	#popupEdit div#mainEdit .popInfos input.long,
	#popupEdit div#mainEdit .popInfos textarea,
	#popup div#main .popInfos input.long,
	#popup div#main .popInfos textarea {
		width: 100% !important;
		max-width: 100%;
		box-sizing: border-box;
	}

	#popup button,
	#popupEdit button,
	#id7 form button {
		width: 100%;
		float: none;
		margin-top: 10px;
	}
	#popup button,
	#popupEdit button,
	#id7 form button {
		color:#fff !important;
		width: auto;
		float: right;
		margin-bottom: 10px;
		
	}

	/* Dashboard */
	#dashboard div {
		padding: 15px 0;
	}

	/* Footer */
	footer p {
		text-align: center;
		padding: 10px;
		font-size: 9px;
	}
}
