/* ==========================================================================
   Météo Personnelle - Styles
   ========================================================================== */

/* Variables CSS */
:root {
	--primary-color: #0073aa;
	--secondary-color: #23282d;
	--success-color: #28a745;
	--danger-color: #dc3545;
	--warning-color: #ffc107;
	--light-bg: #f5f5f5;
	--dark-bg: #1a1a1a;
	--text-light: #333;
	--text-dark: #e0e0e0;
	--border-color: #ddd;
	--shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Mode sombre par défaut */

/* Conteneur principal */
.meteo-perso-container {
	max-width: 1200px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
	color: var(--text-light);
}

/* Header */
.meteo-perso-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px 0;
	border-bottom: 2px solid var(--primary-color);
	margin-bottom: 30px;
	flex-wrap: wrap;
	gap: 20px;
}

.meteo-perso-header h1 {
	margin: 0;
	font-size: 28px;
	color: var(--primary-color);
}

/* Sélecteur de mode */
.meteo-perso-mode-selector {
	display: flex;
	gap: 10px;
}

.mode-btn {
	padding: 10px 15px;
	border: 2px solid var(--border-color);
	background: transparent;
	cursor: pointer;
	border-radius: 5px;
	transition: all 0.3s ease;
	color: var(--text-light);
	font-size: 14px;
	font-weight: 500;
}

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

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

/* Dashboard */
.meteo-perso-dashboard {
	display: grid;
	gap: 20px;
	margin-bottom: 30px;
}

/* Cartes de site */
.meteo-site-card {
	background: white;
	border: 1px solid var(--border-color);
	border-radius: 8px;
	padding: 20px;
	box-shadow: var(--shadow);
	transition: transform 0.2s, box-shadow 0.2s;
	cursor: pointer;
}

.meteo-site-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.site-card-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 15px;
	flex-wrap: wrap;
	gap: 10px;
}

.site-card-header h2,
.site-card-header h3 {
	margin: 0;
	font-size: 20px;
}

.site-type {
	display: inline-block;
	padding: 4px 12px;
	background: var(--primary-color);
	color: white;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
}

.site-label {
	display: inline-block;
	padding: 3px 10px;
	background: #e8f0fe;
	color: #2a6eb5;
	border: 1px solid #b8d0f5;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	white-space: nowrap;
}

.delete-site-btn {
	background: var(--danger-color);
	color: white;
	border: none;
	border-radius: 50%;
	width: 30px;
	height: 30px;
	cursor: pointer;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

.delete-site-btn:hover {
	background: #c82333;
}

/* Résumé du site */
.site-card-summary {
	display: flex;
	gap: 15px;
	margin-bottom: 15px;
	align-items: center;
}

.weather-icon {
	font-size: 48px;
	min-width: 50px;
	text-align: center;
}

.weather-info {
	flex: 1;
}

.temperature {
	font-size: 24px;
	font-weight: bold;
	color: var(--primary-color);
	margin-bottom: 5px;
}

.wind,
.humidity {
	font-size: 14px;
	color: #666;
	margin: 5px 0;
}

/* Alertes */
.alert {
	padding: 10px;
	border-radius: 4px;
	margin-top: 10px;
	font-weight: 600;
	font-size: 14px;
}

.frost-alert {
	background: #e3f2fd;
	color: #01579b;
	border-left: 4px solid #1976d2;
}

.storm-alert {
	background: #fff3e0;
	color: #e65100;
	border-left: 4px solid #ff6f00;
}

/* Bouton de détails */
.view-detail-btn {
	display: inline-block;
	padding: 10px 15px;
	background: var(--primary-color);
	color: white;
	text-decoration: none;
	border-radius: 4px;
	transition: background 0.2s;
	border: none;
	cursor: pointer;
	font-weight: 500;
}

.view-detail-btn:hover {
	background: #005a87;
}

/* Section randonnée */
.meteo-hiking-sites h3 {
	margin-top: 30px;
	margin-bottom: 15px;
	font-size: 18px;
}

.add-site-btn {
	display: block;
	width: 100%;
	padding: 15px;
	margin-top: 15px;
	background: var(--success-color);
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 16px;
	font-weight: 600;
	transition: background 0.2s;
}

.add-site-btn:hover {
	background: #218838;
}

/* Modal */
.meteo-modal {
	display: none !important;
	position: fixed;
	z-index: 1000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0,0,0,0.6);
}

.meteo-modal.show {
	display: flex !important;
	align-items: center;
	justify-content: center;
}

.meteo-modal-content {
	background-color: white;
	padding: 30px;
	border-radius: 8px;
	width: 90%;
	max-width: 600px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 4px 20px rgba(0,0,0,0.3);
	position: relative;
}

.meteo-modal-content h2 {
	margin-top: 0;
	color: var(--primary-color);
}

.close {
	position: absolute;
	right: 15px;
	top: 15px;
	font-size: 28px;
	font-weight: bold;
	cursor: pointer;
	color: #666;
	transition: color 0.2s;
}

.close:hover {
	color: #000;
}

/* Formulaires */
.meteo-modal-content form {
	display: flex;
	flex-direction: column;
	gap: 15px;
}

.meteo-modal-content input[type="text"],
.meteo-modal-content input[type="email"],
.meteo-modal-content input[type="password"],
.meteo-modal-content input[type="number"],
.meteo-modal-content select,
.meteo-modal-content textarea {
	padding: 12px;
	border: 1px solid var(--border-color);
	border-radius: 4px;
	font-size: 14px;
	font-family: inherit;
}

.meteo-modal-content button[type="submit"] {
	padding: 12px;
	background: var(--primary-color);
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-weight: 600;
	font-size: 16px;
	transition: background 0.2s;
}

.meteo-modal-content button[type="submit"]:hover {
	background: #005a87;
}

/* Vue de détail */
.meteo-detail-view {
	min-height: 300px;
}

.meteo-detail-view h2 {
	margin-top: 0;
	color: var(--primary-color);
}

.detail-mode-selector {
	display: flex;
	gap: 10px;
	margin-bottom: 20px;
}

.detail-mode-btn {
	padding: 10px 15px;
	border: 1px solid var(--border-color);
	background: transparent;
	cursor: pointer;
	border-radius: 4px;
	transition: all 0.2s;
	color: var(--text-light);
}

.detail-mode-btn.active {
	background: var(--primary-color);
	color: white;
	border-color: var(--primary-color);
}

/* Tableau météo */
.weather-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 15px;
}

.weather-table thead {
	background: var(--light-bg);
}

.weather-table th,
.weather-table td {
	padding: 12px;
	text-align: left;
	border-bottom: 1px solid var(--border-color);
}

.weather-table th {
	font-weight: 600;
	color: var(--primary-color);
}

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

.frost-row {
	background: #e3f2fd;
	font-weight: 600;
}

/* Attribution */
.meteo-perso-attribution {
	text-align: center;
	padding: 20px 0;
	border-top: 1px solid var(--border-color);
	margin-top: 30px;
	color: #666;
	font-size: 12px;
}

.meteo-perso-attribution a {
	color: var(--primary-color);
	text-decoration: none;
}

.meteo-perso-attribution a:hover {
	text-decoration: underline;
}

/* Résultats de géocodage */
#geocode-results {
	margin-top: 10px;
}

.geocode-result {
	padding: 10px;
	background: var(--light-bg);
	border: 1px solid var(--border-color);
	border-radius: 4px;
	cursor: pointer;
	margin-bottom: 5px;
	transition: background 0.2s;
}

.geocode-result:hover {
	background: var(--primary-color);
	color: white;
}

/* Responsive */
@media (max-width: 768px) {
	.meteo-perso-header {
		flex-direction: column;
		align-items: flex-start;
	}
	
	.meteo-perso-mode-selector {
		flex-wrap: wrap;
	}
	
	.site-card-summary {
		flex-direction: column;
		align-items: flex-start;
	}
	
	.weather-table {
		font-size: 13px;
	}
	
	.weather-table th,
	.weather-table td {
		padding: 8px;
	}
	
	.weather-icon {
		font-size: 36px;
	}
	
	.temperature {
		font-size: 20px;
	}
}

/* Affichage horaire/journalier */
.detail-hourly,
.detail-daily {
	overflow-x: auto;
}

.hourly-chart {
	display: flex;
	gap: 20px;
	flex-direction: column;
}

/* État de chargement */
.loading {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 3px solid var(--border-color);
	border-radius: 50%;
	border-top-color: var(--primary-color);
	animation: spin 0.8s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}

/* Formulaire de login */
.meteo-login-container {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	background: linear-gradient(135deg, var(--primary-color) 0%, #005a87 100%);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	padding: 20px;
}

.meteo-login-box {
	background: white;
	padding: 40px;
	border-radius: 8px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
	max-width: 400px;
	width: 100%;
	text-align: center;
}

.meteo-login-box h1 {
	color: var(--primary-color);
	margin-top: 0;
	margin-bottom: 15px;
	font-size: 24px;
}

.meteo-login-box p {
	color: #666;
	margin-bottom: 30px;
	font-size: 14px;
	line-height: 1.5;
}

.meteo-login-form {
	display: flex;
	flex-direction: column;
}

.form-group {
	margin-bottom: 20px;
	text-align: left;
}

.form-group label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
	color: var(--text-light);
	font-size: 14px;
}

.form-group input[type="password"] {
	width: 100%;
	padding: 12px;
	border: 1px solid var(--border-color);
	border-radius: 4px;
	font-size: 16px;
	box-sizing: border-box;
	transition: border-color 0.2s;
}

.form-group input[type="password"]:focus {
	outline: none;
	border-color: var(--primary-color);
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.meteo-login-button {
	padding: 12px;
	background: var(--primary-color);
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-weight: 600;
	font-size: 16px;
	transition: background 0.2s;
	margin-bottom: 15px;
}

.meteo-login-button:hover {
	background: #005a87;
}

.meteo-login-button:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.meteo-login-message {
	padding: 12px;
	border-radius: 4px;
	font-size: 14px;
	margin-bottom: 10px;
}

.meteo-login-message.error {
	background: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
}

.meteo-login-message.success {
	background: #d4edda;
	color: #155724;
	border: 1px solid #c3e6cb;
}

/* Bouton de déconnexion */
.meteo-logout-button {
	padding: 8px 12px;
	background: var(--danger-color);
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 12px;
	transition: background 0.2s;
	float: right;
}

.meteo-logout-button:hover {
	background: #c82333;
}

/* ==========================================================================
   Conteneur pleine page
   ========================================================================== */

.meteo-detail-fullpage {
	max-width: 1160px;
	margin: 0 auto;
	padding: 0 16px 48px;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: var(--text-light);
}

.detail-page-nav {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 0;
	border-bottom: 2px solid var(--primary-color);
	margin-bottom: 22px;
}

.detail-back-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 18px;
	background: var(--primary-color);
	color: white !important;
	text-decoration: none !important;
	border-radius: 8px;
	font-weight: 600;
	font-size: 14px;
	transition: background 0.2s;
}

.detail-back-btn:hover { background: #005a87; }

/* ==========================================================================
   Sections
   ========================================================================== */

.detail-section {
	margin-bottom: 22px;
}

.section-title {
	font-size: 15px;
	font-weight: 700;
	color: var(--primary-color);
	margin: 0 0 12px;
}

/* ==========================================================================
   Hero — conditions actuelles
   ========================================================================== */

.detail-hero {
	border-radius: 16px;
	padding: 26px 28px 18px;
	color: white;
	margin-bottom: 22px;
	position: relative;
	overflow: hidden;
}

.hero-left {
	display: flex;
	align-items: flex-start;
	gap: 18px;
	flex-wrap: wrap;
	margin-bottom: 18px;
}

.hero-icon {
	font-size: 72px;
	line-height: 1;
	flex-shrink: 0;
	filter: drop-shadow(0 3px 8px rgba(0,0,0,0.25));
}

.hero-temp-line { line-height: 1; }

.temp-big {
	font-size: 62px;
	font-weight: 300;
	color: white;
}

.temp-unit {
	font-size: 30px;
	vertical-align: super;
	font-weight: 300;
	color: white;
}

.hero-desc {
	font-size: 17px;
	font-weight: 500;
	margin-top: 6px;
	opacity: 0.95;
}

.hero-feelslike {
	font-size: 13px;
	opacity: 0.72;
	margin-top: 3px;
}

.hero-site-name {
	font-size: 16px;
	font-weight: 700;
	margin-top: 8px;
	opacity: 0.9;
}

.hero-site-name small {
	display: block;
	font-size: 11px;
	font-weight: 400;
	opacity: 0.65;
	margin-top: 2px;
}

.hero-metrics {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 14px;
}

.hero-metric {
	display: flex;
	align-items: center;
	gap: 8px;
	background: rgba(255,255,255,0.17);
	backdrop-filter: blur(4px);
	border-radius: 10px;
	padding: 9px 13px;
	min-width: 130px;
}

.hero-metric .m-icon {
	font-size: 20px;
	flex-shrink: 0;
}

.hero-metric .m-text {
	display: flex;
	flex-direction: column;
}

.hero-metric .m-val {
	font-size: 14px;
	font-weight: 700;
	color: white;
	line-height: 1.2;
}

.hero-metric .m-lbl {
	font-size: 11px;
	color: rgba(255,255,255,0.72);
	margin-top: 1px;
}

.hero-footer {
	font-size: 11px;
	color: rgba(255,255,255,0.55);
	padding-top: 10px;
	border-top: 1px solid rgba(255,255,255,0.2);
}

/* ==========================================================================
   Bande horaire (prochaines 36h)
   ========================================================================== */

.hourly-strip-wrapper {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 4px;
}

.hourly-strip {
	display: flex;
	gap: 6px;
	width: max-content;
	padding: 2px 2px 8px;
	align-items: stretch;
}

.hour-day-sep {
	writing-mode: vertical-lr;
	transform: rotate(180deg);
	background: var(--primary-color);
	color: white;
	font-size: 10px;
	font-weight: 700;
	padding: 10px 5px;
	border-radius: 7px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	letter-spacing: 0.5px;
}

.hour-card {
	background: white;
	border-radius: 12px;
	padding: 11px 8px 9px;
	min-width: 68px;
	text-align: center;
	box-shadow: 0 1px 6px rgba(0,0,0,0.07);
	border: 1.5px solid #f0f0f0;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	gap: 5px;
	align-items: center;
	transition: transform 0.15s, box-shadow 0.15s;
	cursor: default;
}

.hour-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 5px 14px rgba(0,0,0,0.11);
}

.hour-card.current {
	border-color: var(--primary-color);
	background: #f0f8ff;
	box-shadow: 0 2px 10px rgba(0,115,170,0.22);
}

.hour-time {
	font-size: 10px;
	color: #999;
	font-weight: 700;
	line-height: 1;
}

.hour-card.current .hour-time { color: var(--primary-color); }

.hour-icon { font-size: 24px; line-height: 1; }

.hour-temp {
	font-size: 16px;
	font-weight: 800;
	line-height: 1;
}

.hour-precip {
	font-size: 10px;
	font-weight: 700;
	padding: 2px 6px;
	border-radius: 8px;
	line-height: 1.4;
}

.hour-wind {
	font-size: 10px;
	color: #777;
	line-height: 1.2;
}

.hour-wind em {
	font-style: normal;
	color: #e65100;
}

/* ==========================================================================
   Résumé 5 jours
   ========================================================================== */

.daily-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.day-row {
	display: grid;
	grid-template-columns: 110px 42px 1fr 80px 110px;
	align-items: center;
	gap: 14px;
	background: white;
	border-radius: 10px;
	padding: 11px 16px;
	box-shadow: 0 1px 5px rgba(0,0,0,0.055);
	border: 1px solid #f2f2f2;
	transition: box-shadow 0.15s;
}

.day-row:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.1); }

.day-info strong {
	display: block;
	font-size: 14px;
	font-weight: 700;
	color: var(--text-light);
}

.day-sun {
	font-size: 10px;
	color: #aaa;
	margin-top: 2px;
}

.day-icon { font-size: 28px; text-align: center; }

.day-temps {
	display: flex;
	align-items: center;
	gap: 8px;
}

.t-min, .t-max {
	font-size: 13px;
	font-weight: 700;
	min-width: 36px;
}

.t-min { text-align: right; }
.t-max { text-align: left; }

.temp-bar-track {
	flex: 1;
	height: 7px;
	background: #e8ecef;
	border-radius: 4px;
	position: relative;
	overflow: hidden;
}

.temp-bar-fill {
	position: absolute;
	top: 0;
	bottom: 0;
	border-radius: 4px;
	background: linear-gradient(to right, #64b5f6, #ffcc02, #f4511e);
}

.day-precip {
	font-size: 12px;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 10px;
	text-align: center;
	white-space: nowrap;
}

.day-wind {
	font-size: 12px;
	color: #666;
	font-weight: 500;
}

.day-et0 {
	font-size: 11px;
	color: #4caf50;
	text-align: right;
	white-space: nowrap;
}

/* ==========================================================================
   Barre d'onglets détail (style souligné)
   ========================================================================== */

.detail-tabs-bar {
	display: flex;
	gap: 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border-bottom: 2px solid #dde4ed;
	margin-bottom: 0;
}

.detail-tabs-bar .detail-mode-btn {
	padding: 10px 17px;
	border: none;
	border-bottom: 3px solid transparent;
	background: transparent;
	border-radius: 0;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: #777;
	white-space: nowrap;
	flex-shrink: 0;
	transition: color 0.2s, border-color 0.2s;
	margin-bottom: -2px;
}

.detail-tabs-bar .detail-mode-btn:hover { color: var(--primary-color); }

.detail-tabs-bar .detail-mode-btn.active {
	color: var(--primary-color);
	border-bottom-color: var(--primary-color);
	background: transparent;
}

/* Sélecteur classique (ancien, gardé pour compatibilité hors detail-page) */
.detail-mode-selector {
	display: flex;
	gap: 8px;
	margin-bottom: 18px;
	flex-wrap: wrap;
}

.detail-mode-btn {
	padding: 9px 14px;
	border: 1px solid var(--border-color);
	background: transparent;
	cursor: pointer;
	border-radius: 5px;
	transition: all 0.2s;
	color: var(--text-light);
	font-size: 13px;
}

.detail-mode-btn.active {
	background: var(--primary-color);
	color: white;
	border-color: var(--primary-color);
}

.detail-tab-panel {
	background: white;
	border: 1px solid #dde4ed;
	border-top: none;
	border-radius: 0 0 12px 12px;
	padding: 20px 20px 24px;
	min-height: 180px;
}

/* ==========================================================================
   Tableaux communs
   ========================================================================== */

.table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin-bottom: 16px;
}

tr.day-separator td {
	background: var(--primary-color) !important;
	color: white !important;
	padding: 5px 10px !important;
	font-size: 12px;
}

/* ==========================================================================
   Tables transposées (temps → colonnes, variables → lignes)
   ========================================================================== */

.tx-table {
	border-collapse: collapse;
	white-space: nowrap;
}

/* Colonne label collée à gauche */
.tx-table .tx-label-col {
	position: sticky;
	left: 0;
	z-index: 3;
	background: #f8f9fa;
	border-right: 2px solid #dde4ed;
	min-width: 130px;
	max-width: 180px;
	white-space: normal;
	word-break: break-word;
	padding: 5px 10px;
	font-size: 12px;
	vertical-align: middle;
}

/* En-tête de jour (fond coloré) */
.tx-table thead .tx-label-col {
	background: #f0f4f8;
	z-index: 4;
}

.tx-day-row th {
	background: var(--primary-color);
	color: white;
	text-align: center;
	font-size: 12px;
	font-weight: 700;
	padding: 5px 8px;
	border-left: 1px solid rgba(255,255,255,0.2);
}

.tx-day-row .tx-label-col {
	background: #f0f4f8;
	color: var(--text-light);
}

/* Ligne des heures */
.tx-time-row th {
	background: #e8f0f8;
	font-size: 11px;
	font-weight: 700;
	text-align: center;
	padding: 4px 6px;
	min-width: 46px;
	border-left: 1px solid #dde4ed;
	color: #555;
}

.tx-time-row .tx-label-col {
	background: #e0eaf4;
	color: var(--primary-color);
	font-size: 11px;
	font-weight: 700;
}

/* Cellules de données */
.tx-table tbody td {
	text-align: center;
	font-size: 12px;
	padding: 4px 6px;
	border-bottom: 1px solid #f0f0f0;
	border-left: 1px solid #f4f4f4;
	min-width: 46px;
	vertical-align: middle;
}

/* Ligne d'icônes météo — plus haute */
.tx-icon-row td {
	font-size: 18px;
	padding: 4px 4px;
	line-height: 1;
}

/* Ligne séparateur de groupe dans les lignes */
.tx-separator-row td {
	background: #eef2f7 !important;
	color: var(--primary-color) !important;
	padding: 5px 10px !important;
	font-size: 11px;
	text-align: left !important;
}

/* Alternance légère des lignes */
.tx-table tbody tr:nth-child(even) td:not(.tx-label-col):not(.spread-ok):not(.spread-warn):not(.spread-high) {
	background: #fafbfc;
}

/* Cellules d'alerte */
.storm-cell { background: #fff3cd !important; }
.wind-cell  { background: #e3f2fd !important; }
.warn-cell  { background: #f3e5f5 !important; }

/* Scrollbar fine et discrète */
.tx-table-wrap::-webkit-scrollbar { height: 5px; }
.tx-table-wrap::-webkit-scrollbar-track { background: #f1f1f1; }
.tx-table-wrap::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* Dark mode */

/* ==========================================================================
   Carte météo (Leaflet + RainViewer + Windy)
   ========================================================================== */

.map-source-bar {
	display: flex;
	gap: 8px;
	margin-bottom: 12px;
	border-bottom: 2px solid var(--border-color);
	padding-bottom: 0;
}

.map-source-btn {
	padding: 8px 18px;
	border: none;
	background: none;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: #666;
	border-bottom: 3px solid transparent;
	margin-bottom: -2px;
	border-radius: 0;
	transition: color 0.2s, border-color 0.2s;
}

.map-source-btn.active {
	color: var(--primary-color);
	border-bottom-color: var(--primary-color);
}

.map-source-btn:hover:not(.active) {
	color: #333;
	background: #f5f5f5;
}

.map-windy-panel .map-controls {
	flex-wrap: wrap;
	gap: 12px;
}

.windy-ctrl-group {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.windy-ctrl-label {
	font-size: 11px;
	font-weight: 600;
	color: #888;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.windy-ctrl-group select {
	padding: 6px 10px;
	border: 1px solid var(--border-color);
	border-radius: 6px;
	font-size: 13px;
	background: white;
	cursor: pointer;
	min-width: 120px;
}

.windy-embed-frame {
	border: 1px solid var(--border-color);
	border-radius: 8px;
	margin-top: 10px;
	display: none;
}

.meteo-leaflet-map {
	height: 480px;
	width: 100%;
	border-radius: 8px;
	border: 1px solid var(--border-color);
	background: #e8f0f8;
	margin-top: 10px;
}

.map-controls {
	display: flex;
	gap: 10px;
	margin-bottom: 10px;
	align-items: center;
	flex-wrap: wrap;
}

.map-layer-btn {
	padding: 8px 16px;
	border: 2px solid var(--border-color);
	background: white;
	border-radius: 20px;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	transition: all 0.2s;
	color: #555;
}

.map-layer-btn.active {
	background: var(--primary-color);
	color: white;
	border-color: var(--primary-color);
}

.map-layer-btn:hover:not(.active) {
	border-color: var(--primary-color);
	color: var(--primary-color);
}

.map-timeline {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 8px;
	padding: 8px 14px;
	background: var(--light-bg);
	border-radius: 8px;
}

.map-play-btn {
	min-width: 34px;
	height: 34px;
	padding: 0;
	border: none;
	background: var(--primary-color);
	color: white;
	border-radius: 50%;
	cursor: pointer;
	font-size: 15px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.2s;
}

.map-play-btn:hover { background: #005a87; }
.map-slider { flex: 1; cursor: pointer; }
.map-time-display { font-size: 12px; font-weight: bold; min-width: 150px; text-align: right; white-space: nowrap; }
.map-legend { font-size: 11px; color: #888; margin-bottom: 6px; font-style: italic; }

/* ==========================================================================
   Historique / Chart.js
   ========================================================================== */

.history-loader { text-align: center; padding: 40px; color: #888; }

.history-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 12px;
	margin-bottom: 20px;
}

.history-stat-card {
	background: var(--light-bg);
	border-radius: 8px;
	padding: 14px;
	text-align: center;
	border: 1px solid var(--border-color);
}

.history-stat-card .stat-value { font-size: 22px; font-weight: bold; color: var(--primary-color); }
.history-stat-card .stat-label { font-size: 11px; color: #888; margin-top: 4px; }

.chart-container { position: relative; height: 260px; margin-bottom: 24px; }
.chart-title { font-size: 14px; font-weight: 700; color: var(--primary-color); margin: 20px 0 8px; }

/* ==========================================================================
   Fiabilité modèles
   ========================================================================== */

.reliability-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 13px; }
.reliability-table th { background: var(--light-bg); padding: 8px 12px; text-align: left; font-weight: 600; color: var(--primary-color); border-bottom: 2px solid var(--border-color); }
.reliability-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.reliability-bar-bg { display: inline-block; width: 100px; height: 8px; background: #e0e0e0; border-radius: 4px; vertical-align: middle; margin-left: 8px; }
.reliability-bar { display: block; height: 8px; border-radius: 4px; background: var(--primary-color); }

.score-high   { color: #28a745; font-weight: bold; }
.score-medium { color: #e67e00; font-weight: bold; }
.score-low    { color: #dc3545; font-weight: bold; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
	.detail-hero { padding: 18px 16px 14px; }
	.hero-icon { font-size: 52px; }
	.temp-big { font-size: 46px; }
	.hero-metrics { gap: 7px; }
	.hero-metric { min-width: 110px; padding: 7px 10px; }
	.day-row { grid-template-columns: 80px 36px 1fr 65px; }
	.day-wind { display: none; }
	.detail-tab-panel { padding: 14px 12px; }
}

/* ==========================================================================
   Mode sombre
   ========================================================================== */

/* ==========================================================================
   Météo Marine
   ========================================================================== */

.meteo-marine-sites {
	margin-top: 30px;
	padding-top: 20px;
	border-top: 2px solid var(--border-color);
}

.meteo-marine-sites h3 {
	margin: 0 0 16px 0;
	font-size: 18px;
	color: var(--primary-color);
}

/* Carte spot marin */
.marine-card {
	border-left: 4px solid #0288d1 !important;
}

.marine-card-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
	gap: 10px;
	padding: 14px;
	background: #e3f2fd;
	border-radius: 8px;
	margin: 12px 0;
}

.marine-metric {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 10px 8px;
	background: rgba(255,255,255,0.7);
	border-radius: 8px;
}

.marine-metric-icon { font-size: 20px; margin-bottom: 4px; }
.marine-metric-val  { font-size: 18px; font-weight: 700; color: #01579b; line-height: 1.1; }
.marine-metric-lbl  { font-size: 11px; color: #546e7a; margin-top: 2px; }
.marine-metric-lbl small { display: block; color: #78909c; }

/* Badge qualité vagues */
.marine-quality-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}
.wave-unknown { background: #eceff1; color: #546e7a; }
.wave-flat    { background: #eceff1; color: #607d8b; }
.wave-small   { background: #e0f7fa; color: #006064; }
.wave-ok      { background: #b2ebf2; color: #00695c; }
.wave-good    { background: #80cbc4; color: #004d40; }
.wave-strong  { background: #0288d1; color: #fff; }
.wave-big     { background: #01579b; color: #fff; }
.wave-huge    { background: #311b92; color: #fff; }

/* Bande horaire marine */
.marine-hour-card {
	background: #e3f2fd;
	border-color: #b3d9f0;
	min-width: 64px;
}

.marine-hour-card.current {
	background: #e1f5fe;
	border-color: #0288d1;
}

.marine-wave-icon {
	font-size: 17px;
	font-weight: 700;
	line-height: 1.2;
	padding: 4px 0;
}

/* Colorisation wave dans bande */
.marine-wave-icon.wave-flat    { color: #607d8b; }
.marine-wave-icon.wave-small   { color: #0097a7; }
.marine-wave-icon.wave-ok      { color: #00838f; }
.marine-wave-icon.wave-good    { color: #00695c; }
.marine-wave-icon.wave-strong  { color: #0288d1; }
.marine-wave-icon.wave-big     { color: #01579b; font-size: 20px; }
.marine-wave-icon.wave-huge    { color: #311b92; font-size: 22px; }

/* Cellule wave colorée dans tableau transposé */
.marine-tx-wave.wave-ok     { background: #e0f7fa; color: #006064; }
.marine-tx-wave.wave-good   { background: #b2dfdb; color: #004d40; }
.marine-tx-wave.wave-strong { background: #0288d1 !important; color: #fff !important; }
.marine-tx-wave.wave-big    { background: #01579b !important; color: #fff !important; }
.marine-tx-wave.wave-huge   { background: #311b92 !important; color: #fff !important; }

/* Responsive marine */
@media (max-width: 600px) {
	.marine-card-summary { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   Météo Astro
   ========================================================================== */

/* Dashboard astro */
.astro-dashboard { padding: 16px 0; }

.astro-summary-card {
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: 12px;
	padding: 18px 20px;
	margin-bottom: 20px;
}
.astro-summary-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
}
.astro-summary-icon { font-size: 28px; }
.astro-summary-title { font-weight: 700; font-size: 16px; }
.astro-summary-loc   { font-size: 12px; color: #888; }
.astro-quality-badge {
	margin-left: auto;
	padding: 4px 12px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
}
.astro-quality-excellent { background: #c8e6c9; color: #1b5e20; }
.astro-quality-good      { background: #dcedc8; color: #33691e; }
.astro-quality-average   { background: #fff9c4; color: #f57f17; }
.astro-quality-poor      { background: #ffcdd2; color: #b71c1c; }

.astro-metrics {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
	margin-bottom: 14px;
}
.astro-metric {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
}
.astro-metric-icon { font-size: 20px; }
.astro-metric-val  { font-size: 18px; font-weight: 700; }
.astro-metric-lbl  { font-size: 11px; color: #888; text-align: center; }

.astro-best-hours {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	font-size: 12px;
}
.astro-best-label { color: #888; }
.astro-hour-chip {
	padding: 3px 10px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 700;
}
.chip-clear   { background: #c8e6c9; color: #1b5e20; }
.chip-partial { background: #fff9c4; color: #795548; }

/* Night table (dashboard) */
.astro-section-title  { font-size: 13px; font-weight: 700; color: #555; margin: 16px 0 8px; }
.astro-night-table-wrap { overflow-x: auto; }
.astro-table-scroll   { overflow-x: auto; }

.astro-table {
	border-collapse: collapse;
	font-size: 12px;
	min-width: 600px;
	width: 100%;
}
.astro-table th,
.astro-table td {
	padding: 5px 8px;
	border: 1px solid var(--border-color);
	white-space: nowrap;
	text-align: center;
}
.astro-table thead th {
	background: var(--card-bg);
	font-weight: 600;
	font-size: 11px;
	color: #555;
	position: sticky;
	top: 0;
}
.astro-table .astro-clear   { background: rgba(200,230,201,.25); }
.astro-table .astro-partial { background: rgba(255,249,196,.25); }
.astro-table .astro-cloudy  { background: rgba(255,205,210,.15); }

.astro-cloud-bar { display: inline-block; padding: 2px 5px; border-radius: 4px; }
.astro-dew-risk  { color: #b71c1c; font-weight: 700; }

/* Detail page astro */
.astro-detail-wrap { padding: 10px 0; }

/* Moon card */
.astro-moon-card {
	display: flex;
	align-items: center;
	gap: 14px;
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: 10px;
	padding: 14px 18px;
	margin-bottom: 18px;
}
.astro-moon-icon   { font-size: 36px; }
.astro-moon-phase  { font-weight: 700; font-size: 15px; }
.astro-moon-detail { font-size: 12px; color: #888; margin-top: 3px; }
.astro-moon-tip {
	margin-left: auto;
	padding: 4px 12px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
}
.moon-bright { background: #fff9c4; color: #f57f17; }
.moon-dark   { background: #c8e6c9; color: #1b5e20; }

/* Day picker */
.astro-day-picker {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 14px;
}
.astro-day-btn {
	padding: 5px 14px;
	border: 1px solid var(--border-color);
	border-radius: 20px;
	background: var(--card-bg);
	cursor: pointer;
	font-size: 12px;
	font-weight: 600;
	color: #555;
	transition: all .15s;
}
.astro-day-btn.active,
.astro-day-btn:hover {
	background: var(--primary-color);
	color: #fff;
	border-color: var(--primary-color);
}

/* Astro detail table */
.astro-td-time  { font-weight: 700; text-align: left; min-width: 44px; }
.astro-td-good  { color: #2e7d32; font-weight: 600; }
.astro-td-bad   { color: #c62828; font-weight: 600; }
.astro-row-now  { outline: 2px solid var(--primary-color); outline-offset: -2px; }

.astro-row-clear     { background: rgba(200,230,201,.30); }
.astro-row-few       { background: rgba(255,249,196,.30); }
.astro-row-scattered { background: rgba(255,224,178,.20); }
.astro-row-cloudy    { background: rgba(238,238,238,.50); }

/* Cloud bar */
.astro-cloud-bar-wrap {
	position: relative;
	width: 60px;
	height: 16px;
	background: #e0e0e0;
	border-radius: 3px;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
}
.astro-cloud-bar-fill {
	position: absolute;
	left: 0; top: 0; bottom: 0;
	background: linear-gradient(90deg, #90caf9, #1565c0);
	transition: width .3s;
}
.astro-cloud-bar-lbl {
	position: relative;
	z-index: 1;
	font-size: 10px;
	font-weight: 700;
	color: #fff;
	text-shadow: 0 0 3px rgba(0,0,0,.5);
	padding: 0 4px;
}

/* Legend */
.astro-legend {
	font-size: 11px;
	color: #888;
	margin-top: 14px;
	line-height: 1.6;
}
.astro-legend .astro-row-clear,
.astro-legend .astro-row-few,
.astro-legend .astro-row-scattered,
.astro-legend .astro-row-cloudy {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 2px;
	vertical-align: middle;
}

@media (max-width: 600px) {
	.astro-metrics { grid-template-columns: repeat(2, 1fr); }
	.astro-moon-card { flex-wrap: wrap; }
	.astro-moon-tip { margin-left: 0; }
}
