/**
 * TimeWise Bookings — front-end styles.
 * Token-driven, responsive, and RTL-aware.
 */

.twb-widget {
	--twb-radius: 16px;
	--twb-border: #ececf0;
	--twb-bg: #ffffff;
	--twb-muted: #71757e;
	--twb-ink: #14161a;
	--twb-accent: #1f7a5a;
	--twb-accent-hover: #1a6b4f;
	--twb-accent-ink: #ffffff;
	--twb-slot-bg: #f7f8fa;
	--twb-slot-hover: #eef1f4;
	--twb-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px rgba(16, 24, 40, .05);

	max-width: 640px;
	border: 1px solid var(--twb-border);
	border-radius: var(--twb-radius);
	background: var(--twb-bg);
	box-shadow: var(--twb-shadow);
	padding: 22px;
	color: var(--twb-ink);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.twb-widget__head {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--twb-border);
	margin-bottom: 14px;
}

.twb-widget__meta {
	display: flex;
	align-items: baseline;
	gap: 10px;
}

.twb-widget__price {
	font-size: 20px;
	font-weight: 700;
}

.twb-widget__duration {
	color: var(--twb-muted);
	font-size: 14px;
}

.twb-widget__tz {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.twb-tz-label {
	font-size: 13px;
	color: var(--twb-muted);
}

.twb-tz-change {
	border: none;
	background: none;
	color: var(--twb-accent);
	font-size: 13px;
	cursor: pointer;
	text-decoration: underline;
	padding: 0;
}

.twb-tz-select {
	max-width: 240px;
	padding: 6px 8px;
	border: 1px solid var(--twb-border);
	border-radius: 8px;
	font-size: 13px;
}

.twb-widget__notice {
	font-size: 13px;
	color: var(--twb-muted);
	margin-bottom: 12px;
	min-height: 18px;
}

.twb-widget__days {
	display: grid;
	gap: 16px;
	max-height: 360px;
	overflow-y: auto;
	padding-right: 4px;
}

.twb-day__label {
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 8px;
	position: sticky;
	top: 0;
	background: var(--twb-bg);
	padding: 2px 0;
}

.twb-day__slots {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 8px;
}

.twb-slot {
	border: 1px solid var(--twb-border);
	background: var(--twb-slot-bg);
	border-radius: 10px;
	padding: 10px 8px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: background .12s ease, border-color .12s ease, transform .04s ease;
	color: var(--twb-ink);
}

.twb-slot:hover {
	background: var(--twb-slot-hover);
	border-color: #cdd5d1;
}

.twb-slot:active {
	transform: translateY(1px);
}

.twb-slot.is-selected {
	background: var(--twb-accent);
	border-color: var(--twb-accent);
	color: var(--twb-accent-ink);
}

.twb-widget__form {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--twb-border);
}

.twb-widget__submit {
	width: 100%;
	background: var(--twb-accent);
	color: var(--twb-accent-ink);
	border: none;
	border-radius: 12px;
	padding: 13px 16px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background .12s ease;
}

.twb-widget__submit:hover:not(:disabled) {
	background: var(--twb-accent-hover);
}

.twb-slot:focus-visible,
.twb-widget__submit:focus-visible,
.twb-tz-select:focus-visible {
	outline: 2px solid var(--twb-accent);
	outline-offset: 2px;
}

.twb-widget__submit:disabled {
	opacity: .5;
	cursor: not-allowed;
}

/* Service grid */
.twb-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 18px;
}

.twb-card {
	display: block;
	border: 1px solid var(--twb-border, #e6e8ec);
	border-radius: 14px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	background: #fff;
	transition: box-shadow .15s ease, transform .08s ease;
}

.twb-card:hover {
	box-shadow: 0 8px 28px rgba(16, 24, 40, .1);
	transform: translateY(-2px);
}

.twb-card__media img {
	width: 100%;
	height: 150px;
	object-fit: cover;
	display: block;
}

.twb-card__body {
	padding: 14px 16px;
}

.twb-card__title {
	font-size: 16px;
	margin: 0 0 6px;
}

.twb-card__price {
	font-weight: 700;
}

/* RTL */
[dir="rtl"] .twb-widget__days {
	padding-right: 0;
	padding-left: 4px;
}

/* Schedule editor (admin) */
.twb-schedule td {
	padding: 4px 8px 4px 0;
}

@media (max-width: 480px) {
	.twb-widget {
		padding: 16px;
	}
	.twb-day__slots {
		grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
	}
}

/* ----------------------------------------------------------------------- *
 * Dashboard ([twb_my_bookings]) + status badges
 * ----------------------------------------------------------------------- */
.twb-dash {
	--twb-accent: #1f7a5a;
	max-width: 760px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #14161a;
}

.twb-dash__title {
	font-size: 18px;
	font-weight: 700;
	margin: 0 0 14px;
}

.twb-dash__title--mt {
	margin-top: 34px;
}

.twb-bk-list {
	display: grid;
	gap: 12px;
}

.twb-bk {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	align-items: flex-start;
	border: 1px solid #ececf0;
	border-radius: 14px;
	padding: 16px 18px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.twb-bk__service {
	font-weight: 600;
	font-size: 15px;
	margin-bottom: 3px;
}

.twb-bk__when {
	color: #44484f;
	font-size: 14px;
}

.twb-bk__tz {
	color: #9097a1;
	font-size: 12px;
	margin-left: 6px;
}

.twb-bk__who,
.twb-bk__ref {
	color: #9097a1;
	font-size: 12px;
	margin-top: 3px;
}

.twb-bk__side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	flex-shrink: 0;
}

.twb-bk__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: flex-end;
}

.twb-act {
	border: 1px solid #d8dce1;
	background: #fff;
	border-radius: 8px;
	padding: 6px 11px;
	font-size: 12.5px;
	font-weight: 500;
	cursor: pointer;
	color: #14161a;
}

.twb-act:hover:not(:disabled) {
	background: #f6f7f9;
}

.twb-act:disabled {
	opacity: .5;
	cursor: default;
}

.twb-act--danger {
	color: #b4232a;
	border-color: #f0c7c9;
}

.twb-act--ok {
	color: #156e4f;
	border-color: #bfe3d4;
}

/* Status badges (shared with wp-admin tables) */
.twb-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	white-space: nowrap;
}

.twb-badge--pending   { background: #fff4e0; color: #9a6700; }
.twb-badge--confirmed { background: #e3f3ec; color: #156e4f; }
.twb-badge--completed { background: #e7eefb; color: #2b4f9e; }
.twb-badge--cancelled { background: #fbe9ea; color: #b4232a; }
.twb-badge--refunded  { background: #f0eafb; color: #6c40b5; }
.twb-badge--no_show   { background: #eef0f2; color: #5b626b; }

@media (max-width: 540px) {
	.twb-bk {
		flex-direction: column;
	}
	.twb-bk__side {
		align-items: flex-start;
	}
	.twb-bk__actions {
		justify-content: flex-start;
	}
}

/* ----------------------------------------------------------------------- *
 * Provider signup ([twb_provider_signup])
 * ----------------------------------------------------------------------- */
.twb-signup {
	--twb-accent: #1f7a5a;
	max-width: 460px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #14161a;
}

.twb-field {
	margin-bottom: 14px;
}

.twb-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 5px;
	color: #2d3138;
}

.twb-field input,
.twb-field select,
.twb-field textarea {
	width: 100%;
	border: 1px solid #d8dce1;
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	box-sizing: border-box;
	font-family: inherit;
}

.twb-field input:focus,
.twb-field select:focus,
.twb-field textarea:focus {
	outline: 2px solid var(--twb-accent);
	outline-offset: 1px;
	border-color: var(--twb-accent);
}

.twb-signup__submit {
	width: 100%;
	background: var(--twb-accent);
	color: #fff;
	border: none;
	border-radius: 10px;
	padding: 13px 16px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.twb-signup__notice {
	border-radius: 10px;
	padding: 12px 14px;
	font-size: 14px;
	margin-bottom: 16px;
}

.twb-signup__notice--ok {
	background: #e3f3ec;
	color: #156e4f;
}

.twb-signup__notice--error {
	background: #fbe9ea;
	color: #b4232a;
}

.twb-dash__sub {
	margin: -6px 0 14px;
	font-size: 13px;
}

.twb-dash__sub a {
	color: var(--twb-accent, #1f7a5a);
}

/* ----------------------------------------------------------------------- *
 * Provider schedule manager ([twb_provider_schedule])
 * ----------------------------------------------------------------------- */
.twb-sched {
	--twb-accent: #1f7a5a;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 32px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #14161a;
}

.twb-week__row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}

.twb-week__day {
	width: 96px;
	font-size: 13px;
	font-weight: 600;
}

.twb-week__row input {
	border: 1px solid #d8dce1;
	border-radius: 8px;
	padding: 6px 8px;
	font-size: 13px;
}

.twb-sched__save,
.twb-block-form button {
	background: var(--twb-accent);
	color: #fff;
	border: none;
	border-radius: 9px;
	padding: 9px 16px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	margin-top: 10px;
}

.twb-block-form {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-top: 4px;
}

.twb-block-form input {
	border: 1px solid #d8dce1;
	border-radius: 8px;
	padding: 8px;
	font-size: 13px;
}

.twb-block-form button {
	margin-top: 0;
}

.twb-hint {
	font-size: 12px;
	color: #9097a1;
	margin: 6px 0;
}

.twb-block-list {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
}

.twb-block-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	border: 1px solid #ececf0;
	border-radius: 9px;
	padding: 8px 12px;
	margin-bottom: 6px;
	font-size: 13px;
}

.twb-block-del {
	border: none;
	background: none;
	color: #b4232a;
	cursor: pointer;
	font-size: 12.5px;
}

/* Calendar */
.twb-cal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.twb-cal__title {
	font-weight: 700;
	font-size: 15px;
}

.twb-cal__head button {
	border: 1px solid #d8dce1;
	background: #fff;
	border-radius: 8px;
	width: 32px;
	height: 32px;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.twb-cal__grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
}

.twb-cal__dow {
	text-align: center;
	font-size: 11px;
	color: #9097a1;
	font-weight: 600;
	padding-bottom: 4px;
}

.twb-cal__cell {
	min-height: 56px;
	border: 1px solid #eef0f2;
	border-radius: 9px;
	padding: 5px;
	position: relative;
}

.twb-cal__cell--empty {
	border: none;
}

.twb-cal__cell.is-blocked {
	background: repeating-linear-gradient(45deg, #fafbfc, #fafbfc 6px, #f1f3f5 6px, #f1f3f5 12px);
}

.twb-cal__num {
	font-size: 12px;
	color: #44484f;
}

.twb-cal__dots {
	display: flex;
	flex-wrap: wrap;
	gap: 3px;
	margin-top: 4px;
}

.twb-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	display: inline-block;
}

.twb-dot--confirmed { background: #1f7a5a; }
.twb-dot--pending   { background: #d99a00; }
.twb-dot--completed { background: #2b4f9e; }
.twb-dot--cancelled { background: #b4232a; }
.twb-dot--blocked   { background: #9097a1; }

.twb-cal__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 12px;
	font-size: 12px;
	color: #5b626b;
}

.twb-cal__legend span {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

@media (max-width: 700px) {
	.twb-sched {
		grid-template-columns: 1fr;
	}
}

/* ----------------------------------------------------------------------- *
 * Active-now switch, join button, service attributes (Batches 3-4)
 * ----------------------------------------------------------------------- */
.twb-activenow {
	margin-bottom: 16px;
}

.twb-switch {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.twb-switch input {
	width: 18px;
	height: 18px;
	accent-color: var(--twb-accent, #1f7a5a);
}

.twb-join {
	display: inline-block;
	background: var(--twb-accent, #1f7a5a);
	color: #fff;
	border-radius: 8px;
	padding: 6px 12px;
	font-size: 12.5px;
	font-weight: 600;
	text-decoration: none;
}

.twb-attrs {
	display: grid;
	gap: 10px;
	margin: 18px 0;
	padding: 16px;
	border: 1px solid #ececf0;
	border-radius: 14px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.twb-attr {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	font-size: 14px;
}

.twb-attr__label {
	min-width: 140px;
	color: #71757e;
	font-weight: 600;
}

.twb-attr__value {
	color: #14161a;
	flex: 1;
}

.twb-attr__value img {
	max-width: 220px;
	height: auto;
	border-radius: 10px;
}

.twb-attr-color {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.twb-attr-color i {
	width: 16px;
	height: 16px;
	border-radius: 4px;
	display: inline-block;
	border: 1px solid rgba(0, 0, 0, .1);
}

@media (max-width: 480px) {
	.twb-attr {
		flex-direction: column;
		gap: 2px;
	}
	.twb-attr__label {
		min-width: 0;
	}
}

/* ----------------------------------------------------------------------- *
 * Dashboard: tabs, stats, payouts, reschedule picker
 * ----------------------------------------------------------------------- */
.twb-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	border-bottom: 1px solid #e6e8ec;
	margin-bottom: 22px;
}

.twb-tabs__tab {
	padding: 11px 16px;
	text-decoration: none;
	color: #6a7178;
	font-weight: 600;
	font-size: 14px;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}

.twb-tabs__tab:hover { color: #14161a; }
.twb-tabs__tab.is-active { color: #1f7a5a; border-bottom-color: #1f7a5a; }

.twb-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 14px;
	margin-bottom: 26px;
}

.twb-stat {
	background: #fff;
	border: 1px solid #e6e8ec;
	border-radius: 14px;
	padding: 16px 18px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.twb-stat__num { font-size: 26px; font-weight: 800; color: #14161a; }
.twb-stat__label { font-size: 12.5px; color: #6a7178; font-weight: 600; }

.twb-dash__h {
	font-size: 16px;
	font-weight: 700;
	margin: 8px 0 12px;
}

/* Reschedule picker */
.twb-resched {
	margin-top: 12px;
	width: 100%;
	background: #fff;
	border: 1px solid #e6e8ec;
	border-radius: 14px;
	padding: 12px;
}

.twb-resched__loading { color: #6a7178; font-size: 13px; margin: 4px; }

.twb-resched__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 6px;
}

.twb-resched__close {
	border: none;
	background: #f3f4f6;
	width: 26px;
	height: 26px;
	border-radius: 7px;
	font-size: 16px;
	cursor: pointer;
	line-height: 1;
}

.twb-resched__tz { font-size: 12px; color: #6a7178; margin: 0 0 8px; }

.twb-resched__days {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding-bottom: 6px;
	-webkit-overflow-scrolling: touch;
}

.twb-resched__day {
	flex: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1px;
	min-width: 54px;
	padding: 8px 6px;
	border: 1px solid #e6e8ec;
	border-radius: 11px;
	background: #fff;
	cursor: pointer;
	touch-action: manipulation;
}

.twb-resched__day.is-active { border-color: #1f7a5a; background: rgba(31,122,90,.06); }
.twb-resched__dow { font-size: 11px; color: #6a7178; text-transform: uppercase; }
.twb-resched__dom { font-size: 17px; font-weight: 700; color: #14161a; }
.twb-resched__mon { font-size: 11px; color: #6a7178; }

.twb-resched__slots {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.twb-resched__slot {
	border: 1px solid #e6e8ec;
	background: #fff;
	border-radius: 10px;
	padding: 9px 14px;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	touch-action: manipulation;
}

.twb-resched__slot:hover { border-color: #1f7a5a; color: #1f7a5a; }
.twb-resched__slot:disabled { opacity: .5; cursor: default; }

.twb-act--ghost {
	background: transparent;
	border: 1px solid #e6e8ec;
	color: #14161a;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
}

.twb-act--primary { background: #1f7a5a; color: #fff; border: none; }
.twb-act--danger { background: #fbe9ea; color: #b4232a; border: none; }
