/**
 * TeaTime Bookings — Styles Frontend
 * Formulaire step-by-step, mobile-first.
 * Les couleurs sont pilotées par des variables CSS injectées depuis les réglages admin.
 */

/* =========================================
   VARIABLES CSS (valeurs par défaut — remplacées par l'admin si modifiées)
   ========================================= */
:root {
	--ttb-primary:      #7c5c3e;
	--ttb-primary-dark: #5c3e22;
	--ttb-success:      #27ae60;
	--ttb-text:         #3c2a1a;
	--ttb-border:       #d5c9bd;
	--ttb-bg-light:     #f7f3ef;
	--ttb-error:        #c0392b;

	/* Dérivée automatique (non modifiable directement) */
	--ttb-bg-lighter: #faf8f5;

	/* Widget horaires [teatime_hours] */
	--ttb-hours-text:   #3c2a1a;
	--ttb-hours-time:   #7c5c3e;
	--ttb-hours-closed: #999999;
}

/* =========================================
   WRAPPER PRINCIPAL
   ========================================= */
.ttb-booking-wrapper {
	max-width: 560px;
	margin: 0 auto;
	font-family: inherit;
	color: var(--ttb-text);
}

/* =========================================
   INDICATEUR D'ÉTAPES
   ========================================= */
.ttb-steps-indicator {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 28px;
	gap: 0;
}

.ttb-step-dot {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	position: relative;
}

.ttb-step-num {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--ttb-border-light);
	color: #999;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 0.9em;
	transition: background 0.3s, color 0.3s;
}

.ttb-step-lbl {
	font-size: 0.72em;
	color: #aaa;
	white-space: nowrap;
	transition: color 0.3s;
}

.ttb-step-dot.active .ttb-step-num {
	background: var(--ttb-primary);
	color: #fff;
}

.ttb-step-dot.active .ttb-step-lbl {
	color: var(--ttb-primary);
	font-weight: 600;
}

.ttb-step-dot.done .ttb-step-num {
	background: var(--ttb-success);
	color: #fff;
}

.ttb-step-dot.done .ttb-step-num::after {
	content: '✓';
}

.ttb-step-dot.done .ttb-step-num span {
	display: none;
}

.ttb-step-dot.done .ttb-step-lbl {
	color: var(--ttb-success);
}

.ttb-step-connector {
	flex: 1;
	height: 2px;
	background: var(--ttb-border-light);
	margin: 0 6px;
	margin-bottom: 18px;
	min-width: 24px;
	transition: background 0.3s;
}

.ttb-step-connector.done {
	background: var(--ttb-success);
}

/* =========================================
   MESSAGES
   ========================================= */
.ttb-messages {
	margin-bottom: 16px;
	min-height: 0;
}

.ttb-message {
	padding: 12px 16px;
	border-radius: 8px;
	font-size: 0.92em;
}

.ttb-message-error {
	background: #fdedec;
	color: var(--ttb-error);
	border: 1px solid #f5b7b1;
}

.ttb-message-success {
	background: #eafaf1;
	color: #1e8449;
	border: 1px solid #a9dfbf;
}

.ttb-message-info {
	background: var(--ttb-bg-light);
	color: var(--ttb-primary);
	border: 1px solid var(--ttb-border);
	line-height: 1.5;
}

/* =========================================
   ÉTAPES — AFFICHAGE
   ========================================= */
.ttb-step {
	display: none;
}

.ttb-step.ttb-step-active {
	display: block;
	animation: ttbFadeIn 0.25s ease;
}

@keyframes ttbFadeIn {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.ttb-step-title {
	font-size: 1.2em;
	font-weight: 700;
	color: var(--ttb-text);
	margin: 0 0 20px;
	padding-bottom: 10px;
	border-bottom: 2px solid var(--ttb-bg-light);
}

.ttb-step-subtitle {
	font-size: 0.8em;
	font-weight: 400;
	color: var(--ttb-primary);
	margin-left: 8px;
}

/* =========================================
   CHAMPS DE FORMULAIRE
   ========================================= */
.ttb-field-group {
	margin-bottom: 18px;
}

.ttb-label {
	display: block;
	font-weight: 600;
	font-size: 0.92em;
	margin-bottom: 6px;
	color: var(--ttb-text);
}

.ttb-required {
	color: var(--ttb-error);
	margin-left: 2px;
}

.ttb-input {
	width: 100%;
	padding: 10px 14px;
	border: 1.5px solid var(--ttb-border);
	border-radius: 8px;
	font-size: 1em;
	color: var(--ttb-text);
	background: #fff;
	transition: border-color 0.2s, box-shadow 0.2s;
	box-sizing: border-box;
	-webkit-appearance: none;
}

.ttb-input:focus {
	outline: none;
	border-color: var(--ttb-primary);
	box-shadow: 0 0 0 3px var(--ttb-primary-alpha);
}

.ttb-select {
	cursor: pointer;
}

.ttb-textarea {
	resize: vertical;
	min-height: 80px;
}

.ttb-field-hint {
	font-size: 0.82em;
	margin: 4px 0 0;
	min-height: 18px;
}

.ttb-hint-error { color: var(--ttb-error); }
.ttb-hint-ok    { color: var(--ttb-success); font-weight: 600; }

/* Honeypot — caché visuellement mais pas via display:none (contournement bots) */
.ttb-hp-field {
	position: absolute;
	left: -9999px;
	opacity: 0;
	height: 0;
	overflow: hidden;
}

/* =========================================
   SÉLECTEUR DE SIÈGES
   ========================================= */
.ttb-seats-picker {
	display: flex;
	align-items: center;
	gap: 12px;
}

.ttb-seats-btn {
	width: 40px;
	height: 40px;
	border: 1.5px solid var(--ttb-border);
	border-radius: 8px;
	background: #fff;
	font-size: 1.4em;
	font-weight: 300;
	color: var(--ttb-primary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, border-color 0.2s;
	flex-shrink: 0;
}

.ttb-seats-btn:hover {
	background: var(--ttb-bg-light);
	border-color: var(--ttb-primary);
}

.ttb-seats-input {
	width: 64px !important;
	text-align: center;
	font-weight: 700;
	font-size: 1.1em;
}

/* =========================================
   SÉLECTION DU MOTIF (étape 1)
   ========================================= */
.ttb-motives-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 16px 0 24px;
}

.ttb-motive-btn {
	flex: 1 1 140px;
	min-height: 56px;
	padding: 12px 16px;
	border: 2px solid var(--ttb-border);
	border-radius: 8px;
	background: #fff;
	color: var(--ttb-text);
	font-size: 1.05em;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
	text-align: center;
}

.ttb-motive-btn:hover {
	border-color: var(--ttb-primary);
	background: var(--ttb-primary-alpha);
}

.ttb-motive-btn.ttb-motive-selected {
	border-color: var(--ttb-primary);
	background: var(--ttb-primary);
	color: #fff;
}

.ttb-step-desc {
	color: var(--ttb-text);
	font-size: 0.95em;
	margin: 0 0 12px;
	opacity: 0.75;
}

/* =========================================
   GRILLE DE CRÉNEAUX
   ========================================= */
.ttb-slots-grid {
	margin-bottom: 20px;
}

.ttb-slots-list {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 110px, 1fr ) );
	gap: 10px;
	margin-top: 12px;
}

.ttb-slot-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 12px 8px;
	border: 1.5px solid var(--ttb-border);
	border-radius: 10px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s, transform 0.1s;
	text-align: center;
}

.ttb-slot-btn:hover:not([disabled]) {
	border-color: var(--ttb-primary);
	background: var(--ttb-bg-light);
	transform: translateY(-2px);
}

.ttb-slot-btn.ttb-slot-selected {
	border-color: var(--ttb-primary);
	background: var(--ttb-primary);
	color: #fff;
}

.ttb-slot-btn.ttb-slot-selected .ttb-slot-sub {
	color: rgba(255,255,255,0.8);
}

.ttb-slot-btn.ttb-slot-full,
.ttb-slot-btn[disabled] {
	opacity: 0.45;
	cursor: not-allowed;
	background: #f5f5f5;
	border-color: var(--ttb-border-light);
}

.ttb-slot-time {
	font-size: 1.05em;
	font-weight: 700;
	color: var(--ttb-slot-time);
}

.ttb-slot-sub {
	font-size: 0.72em;
	color: #888;
}

.ttb-slots-loading,
.ttb-slots-empty {
	text-align: center;
	padding: 24px;
	color: #888;
	font-size: 0.92em;
}

.ttb-slots-empty.ttb-error {
	color: var(--ttb-error);
}

/* =========================================
   SPINNER
   ========================================= */
.ttb-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid var(--ttb-border);
	border-top-color: var(--ttb-primary);
	border-radius: 50%;
	animation: ttbSpin 0.7s linear infinite;
	vertical-align: middle;
	margin-right: 6px;
}

.ttb-spinner-white {
	border-color: rgba(255,255,255,0.4);
	border-top-color: #fff;
}

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

/* =========================================
   NAVIGATION ÉTAPES (BOUTONS)
   ========================================= */
.ttb-step-nav {
	display: flex;
	gap: 12px;
	justify-content: space-between;
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--ttb-bg-light);
}

.ttb-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 12px 22px;
	border-radius: 8px;
	border: none;
	font-size: 0.95em;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s, opacity 0.2s, transform 0.1s;
}

.ttb-btn:active {
	transform: scale(0.98);
}

.ttb-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.ttb-btn-prev {
	background: var(--ttb-bg-light);
	color: var(--ttb-primary);
}

.ttb-btn-prev:hover {
	filter: brightness(0.95);
}

.ttb-btn-next {
	background: var(--ttb-primary);
	color: #fff;
	margin-left: auto;
}

.ttb-btn-next:hover:not(:disabled) {
	background: var(--ttb-primary-dark);
}

.ttb-btn-submit {
	background: var(--ttb-success);
	color: #fff;
	margin-left: auto;
}

.ttb-btn-submit:hover:not(:disabled) {
	filter: brightness(0.9);
}

.ttb-btn-arrow {
	font-size: 1.1em;
}

/* =========================================
   RÉCAPITULATIF
   ========================================= */
.ttb-recap-card {
	background: var(--ttb-bg-light);
	border: 1px solid var(--ttb-border-light);
	border-radius: 10px;
	padding: 20px;
	margin-bottom: 16px;
}

.ttb-recap-list {
	margin: 0;
	padding: 0;
}

.ttb-recap-row {
	display: flex;
	gap: 12px;
	padding: 8px 0;
	border-bottom: 1px solid var(--ttb-border-light);
}

.ttb-recap-row:last-child {
	border-bottom: none;
}

.ttb-recap-row dt {
	min-width: 100px;
	font-weight: 600;
	color: var(--ttb-primary);
	font-size: 0.9em;
}

.ttb-recap-row dd {
	margin: 0;
	color: var(--ttb-text);
	font-size: 0.9em;
}

.ttb-recap-notice {
	font-size: 0.78em;
	color: #999;
	margin-bottom: 0;
}

/* =========================================
   ÉCRAN DE SUCCÈS
   ========================================= */
.ttb-step-success {
	text-align: center;
	padding: 40px 20px;
}

.ttb-success-icon {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: var(--ttb-success);
	color: #fff;
	font-size: 2.2em;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 20px;
}

.ttb-btn-reset {
	background: var(--ttb-bg-light);
	color: var(--ttb-primary);
	margin-top: 16px;
}

.ttb-btn-reset:hover {
	filter: brightness(0.95);
}

/* =========================================
   CALENDRIER INLINE (étape 1)
   ========================================= */
.ttb-calendar {
	border: 1.5px solid var(--ttb-border);
	border-radius: 12px;
	overflow: hidden;
	background: #fff;
	margin-bottom: 12px;
}

.ttb-cal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	background: var(--ttb-bg-light);
	border-bottom: 1px solid var(--ttb-border-light);
}

.ttb-cal-title {
	font-weight: 700;
	font-size: 0.97em;
	color: var(--ttb-text);
	text-transform: capitalize;
}

.ttb-cal-nav {
	background: none;
	border: none;
	color: var(--ttb-primary);
	font-size: 1.5em;
	line-height: 1;
	cursor: pointer;
	width: 32px;
	height: 32px;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
	padding: 0;
}

.ttb-cal-nav:hover:not([disabled]) {
	background: var(--ttb-primary-alpha);
}

.ttb-cal-nav[disabled] {
	opacity: 0.28;
	cursor: not-allowed;
}

.ttb-cal-grid {
	display: grid;
	grid-template-columns: repeat( 7, 1fr );
	gap: 3px;
	padding: 10px 12px 14px;
}

.ttb-cal-day-name {
	text-align: center;
	font-size: 0.68em;
	font-weight: 700;
	color: #aaa;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	padding: 2px 0 8px;
}

.ttb-cal-day-empty {
	aspect-ratio: 1;
}

.ttb-cal-day {
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	border-radius: 8px;
	font-size: 0.88em;
	font-weight: 500;
	color: var(--ttb-text);
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	padding: 0;
	width: 100%;
}

.ttb-cal-day:hover:not([disabled]) {
	background: var(--ttb-primary-alpha);
	color: var(--ttb-primary);
}

.ttb-cal-day-today {
	font-weight: 800;
	color: var(--ttb-primary);
}

.ttb-cal-day-selected {
	background: var(--ttb-primary) !important;
	color: #fff !important;
	font-weight: 700;
}

.ttb-cal-day-disabled,
.ttb-cal-day[disabled] {
	opacity: 0.25;
	cursor: not-allowed;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media ( max-width: 480px ) {
	.ttb-slots-list {
		grid-template-columns: repeat( 3, 1fr );
	}

	.ttb-step-nav {
		flex-direction: column-reverse;
	}

	.ttb-btn-next,
	.ttb-btn-submit {
		margin-left: 0;
		width: 100%;
		justify-content: center;
	}

	.ttb-btn-prev {
		width: 100%;
		justify-content: center;
	}

	.ttb-recap-row {
		flex-direction: column;
		gap: 2px;
	}
}

/* =========================================================
   Widget horaires d'ouverture [teatime_hours]
   ========================================================= */
.ttb-hours-list {
	list-style: none;
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: inherit;
	width: max-content;
	margin-left: auto;
	margin-right: auto;
}

.ttb-hours-item {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1em;
	padding: 0.25em 0;
}

.ttb-hours-day {
	color: var(--ttb-hours-text);
	font-family: inherit;
	font-size: inherit;
}

.ttb-hours-time {
	color: var(--ttb-hours-time);
	font-family: inherit;
	font-size: inherit;
}

.ttb-hours-closed {
	color: var(--ttb-hours-closed);
	font-family: inherit;
	font-size: inherit;
}

.ttb-hours-note {
	margin: 2em 0 0;
	font-family: inherit;
	font-size: inherit;
	color: inherit;
	text-align: center;
}

/* =========================================================
   Widget menu spécial [teatime_menu]
   ========================================================= */
.ttb-menu-widget {
	text-align: center;
}

.ttb-menu-widget .ttb-menu-image {
	border-radius: 15px;
	max-width: 100%;
	height: auto;
	display: block;
	margin: 0 auto;
}

.ttb-menu-widget .ttb-menu-text {
	margin: 1em 0 0;
	font-family: inherit;
	font-size: inherit;
	color: inherit;
	text-align: center;
}

/* =========================================================
   Message de maintenance (formulaire désactivé)
   ========================================================= */
.ttb-maintenance-notice {
	text-align: center;
	padding: 48px 24px;
}

.ttb-maintenance-icon {
	font-size: 3em;
	margin-bottom: 16px;
	line-height: 1;
}

.ttb-maintenance-notice .ttb-step-title {
	color: var(--ttb-primary, #5c3317);
	margin-bottom: 14px;
}

.ttb-maintenance-notice .ttb-step-desc {
	max-width: 420px;
	margin: 0 auto;
	line-height: 1.7;
	color: var(--ttb-text, #3c2a1a);
}
