/* ══════════════════════════════════════════════════════════════════════
   TDWellcare Account Enhancer - My Account
   Toàn bộ CSS giới hạn trong các wrapper riêng của plugin (#tdw-profile-wrap,
   .woocommerce-MyAccount-navigation, .tdw-loading-overlay, .tdw-form-row) để
   không ảnh hưởng các trang khác của site.
   ══════════════════════════════════════════════════════════════════════ */

:root {
	--tdw-border: #e6e6e6;
	--tdw-bg-soft: #faf9f7;
	--tdw-text-muted: #8a8a8a;
	--tdw-accent: #b5485e;
	--tdw-accent-soft: #f7e9ec;
	--tdw-radius: 10px;
	--tdw-danger: #c0392b;
	--tdw-danger-soft: #fdf0ef;
}

/* ===== Form đăng ký - field bổ sung ===== */
.tdw-form-row .tdw-field-hint {
	display: block;
	font-size: 0.8em;
	color: var( --tdw-text-muted );
	margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════════════════
   MENU MY ACCOUNT - Sidebar dọc (desktop) / menu gọn (mobile)
   Chỉ áp dụng khi đã đăng nhập, vì .woocommerce-MyAccount-navigation chỉ được
   WooCommerce render trong trường hợp đó - form đăng nhập/đăng ký không có
   phần tử này nên hoàn toàn không bị ảnh hưởng.
   ══════════════════════════════════════════════════════════════════════ */

.woocommerce-MyAccount-navigation ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.woocommerce-MyAccount-navigation ul li {
	margin: 0;
}

.woocommerce-MyAccount-navigation ul li a {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	box-sizing: border-box;
	padding: 12px 16px;
	border-radius: 8px;
	color: #555;
	text-decoration: none;
	font-weight: 500;
	font-size: 0.95em;
	border-left: 3px solid transparent;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.woocommerce-MyAccount-navigation ul li a:hover {
	background: var( --tdw-bg-soft );
	color: #222;
}

.woocommerce-MyAccount-navigation ul li.is-active a {
	background: var( --tdw-accent-soft );
	color: var( --tdw-accent );
	font-weight: 700;
	border-left-color: var( --tdw-accent );
}

/* Icon nét mảnh, đơn sắc - vẽ bằng CSS mask (tự nhận màu currentColor qua
   background-color), không tải thư viện icon ngoài. */
.woocommerce-MyAccount-navigation ul li a::before {
	content: '';
	display: inline-block;
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	background-color: currentColor;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.woocommerce-MyAccount-navigation-link--profile a::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 4-6 8-6s8 2 8 6'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 4-6 8-6s8 2 8 6'/%3E%3C/svg%3E");
}

.woocommerce-MyAccount-navigation-link--edit-address a::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s7-7.5 7-12a7 7 0 1 0-14 0c0 4.5 7 12 7 12z'/%3E%3Ccircle cx='12' cy='9' r='2.5'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s7-7.5 7-12a7 7 0 1 0-14 0c0 4.5 7 12 7 12z'/%3E%3Ccircle cx='12' cy='9' r='2.5'/%3E%3C/svg%3E");
}

.woocommerce-MyAccount-navigation-link--orders a::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h12v18l-3-2-3 2-3-2-3 2V3z'/%3E%3Cline x1='9' y1='8' x2='15' y2='8'/%3E%3Cline x1='9' y1='12' x2='15' y2='12'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h12v18l-3-2-3 2-3-2-3 2V3z'/%3E%3Cline x1='9' y1='8' x2='15' y2='8'/%3E%3Cline x1='9' y1='12' x2='15' y2='12'/%3E%3C/svg%3E");
}

.woocommerce-MyAccount-navigation-link--customer-logout a::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
}

/* Nút thu gọn menu (chỉ hiển thị mobile qua CSS bên dưới) - JS chèn vào ngay
   trước .woocommerce-MyAccount-navigation. */
.tdw-account-nav-toggle {
	display: none;
}

/* ── Desktop (>600px): sidebar 2 cột, dùng kỹ thuật float + BFC (overflow:hidden)
     để không phụ thuộc vào việc biết trước class/structure của thẻ cha chung
     giữa nav và content - ổn định với mọi theme/phiên bản WooCommerce. ── */
@media ( min-width: 601px ) {
	body.woocommerce-account .woocommerce-MyAccount-navigation {
		float: left;
		width: 220px;
		box-sizing: border-box;
		margin-right: 24px;
		background: #fff;
		border: 1px solid var( --tdw-border );
		border-radius: var( --tdw-radius );
		padding: 10px;
	}

	body.woocommerce-account .woocommerce-MyAccount-content {
		overflow: hidden; /* tạo block formatting context riêng - nội dung tự
		                     chiếm phần còn lại bên phải, không bị tràn xuống
		                     dưới cột menu, không cần biết class thẻ cha chung. */
	}
}

/* ── Mobile (≤600px): menu gọn dạng nút thu gọn + danh sách xổ xuống ── */
@media ( max-width: 600px ) {
	.tdw-account-nav-toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		box-sizing: border-box;
		padding: 12px 16px;
		margin-bottom: 10px;
		background: #fff;
		border: 1px solid var( --tdw-border );
		border-radius: var( --tdw-radius );
		font-size: 0.95em;
		font-weight: 600;
		color: #232323;
		cursor: pointer;
	}

	.tdw-account-nav-toggle-icon {
		width: 10px;
		height: 10px;
		border-right: 2px solid #777;
		border-bottom: 2px solid #777;
		transform: rotate( 45deg );
		transition: transform 0.18s ease;
		flex-shrink: 0;
	}

	.tdw-account-nav-toggle[aria-expanded="true"] .tdw-account-nav-toggle-icon {
		transform: rotate( 225deg );
	}

	/* Mặc định (không có JS): menu vẫn hiển thị đầy đủ, dùng được bình thường -
	   JS chỉ ẨN nó đi SAU KHI đã chèn xong nút thu gọn (progressive enhancement). */
	.woocommerce-MyAccount-navigation {
		background: #fff;
		border: 1px solid var( --tdw-border );
		border-radius: var( --tdw-radius );
		padding: 8px;
		margin-bottom: 16px;
		overflow: hidden;
		max-height: 1000px;
		transition: max-height 0.2s ease;
	}

	.woocommerce-MyAccount-navigation.tdw-nav-collapsed {
		max-height: 0;
		border-width: 0;
		padding-top: 0;
		padding-bottom: 0;
		margin-bottom: 0;
	}

	.woocommerce-MyAccount-navigation ul li a {
		padding: 11px 14px;
	}
}

/* ===== Tab Hồ sơ ===== */
#tdw-profile-wrap {
	max-width: 900px;
}

.tdw-welcome-toast {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 16px 20px;
	margin-bottom: 20px;
	background: #fff;
	border: 1px solid var( --tdw-accent-soft );
	border-left: 4px solid var( --tdw-accent );
	border-radius: var( --tdw-radius );
	box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.06 );
	opacity: 1;
	transition: opacity 0.4s ease, transform 0.4s ease;
}

.tdw-welcome-toast.is-hiding {
	opacity: 0;
	transform: translateY( -6px );
}

.tdw-welcome-icon {
	font-size: 1.5em;
	line-height: 1;
}

.tdw-welcome-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.tdw-welcome-text strong {
	font-size: 1.02em;
	color: #232323;
}

.tdw-welcome-text span {
	font-size: 0.88em;
	color: var( --tdw-text-muted );
}

/* ══════════════════════════════════════════════════════════════════════
   CARD / ACCORDION - mỗi section Hồ sơ là 1 card có thể đóng/mở
   ══════════════════════════════════════════════════════════════════════ */

.tdw-card {
	background: #fff;
	border: 1px solid var( --tdw-border );
	border-radius: var( --tdw-radius );
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.04 );
	margin-bottom: 14px;
	overflow: hidden;
}

/* Đúng pattern accordion chuẩn accessibility: <h3><button aria-expanded
   aria-controls>...</button></h3> - header là 1 nút bấm THỰC SỰ. */
.tdw-card > h3 {
	margin: 0;
}

.tdw-accordion-toggle {
	all: unset;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 15px 20px;
	background: var( --tdw-bg-soft );
	cursor: pointer;
}

.tdw-accordion-toggle:focus-visible {
	outline: 2px solid var( --tdw-accent );
	outline-offset: -2px;
}

.tdw-card-header-title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	color: #232323;
	letter-spacing: 0.01em;
}

.tdw-card-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	flex-shrink: 0;
	background-color: var( --tdw-accent );
	border-radius: 8px;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: 16px;
	mask-size: 16px;
}

.tdw-icon-user { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 4-6 8-6s8 2 8 6'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 4-6 8-6s8 2 8 6'/%3E%3C/svg%3E"); }
.tdw-icon-briefcase { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7' width='18' height='13' rx='2'/%3E%3Cpath d='M8 7V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7' width='18' height='13' rx='2'/%3E%3Cpath d='M8 7V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3C/svg%3E"); }
.tdw-icon-shirt { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 4l4 2 4-2 4 4-3 3v9H7v-9L4 8z'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 4l4 2 4-2 4 4-3 3v9H7v-9L4 8z'/%3E%3C/svg%3E"); }
.tdw-icon-ruler { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7' width='18' height='10' rx='1.5'/%3E%3Cpath d='M7 7v3M11 7v3M15 7v3'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7' width='18' height='10' rx='1.5'/%3E%3Cpath d='M7 7v3M11 7v3M15 7v3'/%3E%3C/svg%3E"); }

.tdw-accordion-chevron {
	margin-left: auto;
	width: 9px;
	height: 9px;
	border-right: 2px solid #999;
	border-bottom: 2px solid #999;
	transform: rotate( 45deg );
	transition: transform 0.18s ease;
	flex-shrink: 0;
}

.tdw-accordion-toggle[aria-expanded="false"] .tdw-accordion-chevron {
	transform: rotate( -45deg );
}

/* Vùng nội dung co giãn bằng grid-template-rows - animate mượt tới đúng
   chiều cao thật của nội dung (không dùng max-height cố định), ~180ms. */
.tdw-card-body-wrap {
	display: grid;
	grid-template-rows: 1fr;
	transition: grid-template-rows 0.18s ease;
}

.tdw-card-body-wrap.is-collapsed {
	grid-template-rows: 0fr;
}

.tdw-card-body-wrap > .tdw-card-body {
	overflow: hidden;
	min-height: 0;
}

.tdw-card-body {
	padding: 18px 20px;
}

.tdw-grid-2 {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 210px, 1fr ) );
	gap: 14px 18px;
	align-items: start;
}

.tdw-span-2 {
	grid-column: 1 / -1;
}

.tdw-field {
	margin: 0;
}

.tdw-field label {
	display: block;
	font-size: 13.5px;
	font-weight: 600;
	color: #444;
	margin-bottom: 6px;
}

.tdw-required {
	color: var( --tdw-accent );
}

.tdw-optional-tag {
	font-weight: 400;
	color: var( --tdw-text-muted );
	font-size: 0.88em;
}

.tdw-field input[type="text"],
.tdw-field input[type="tel"],
.tdw-field input[type="email"],
.tdw-field input[type="date"],
.tdw-field select,
.tdw-field textarea {
	width: 100%;
	box-sizing: border-box;
	height: 42px;
	padding: 0 12px;
	border: 1px solid var( --tdw-border );
	border-radius: 8px;
	font-size: 14.5px;
	background: #fff;
}

.tdw-field textarea {
	height: auto;
	padding: 10px 12px;
	line-height: 1.5;
}

.tdw-field input:focus,
.tdw-field select:focus,
.tdw-field textarea:focus {
	outline: none;
	border-color: var( --tdw-accent );
	box-shadow: 0 0 0 3px var( --tdw-accent-soft );
}

.tdw-profile-actions {
	display: flex;
	align-items: center;
	gap: 18px;
	margin: 4px 2px 32px;
}

.tdw-btn-primary {
	background: var( --tdw-accent );
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 11px 26px;
	font-weight: 600;
	font-size: 0.96em;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.tdw-btn-primary:hover {
	opacity: 0.9;
}

.tdw-link-muted {
	font-size: 0.9em;
	color: var( --tdw-text-muted );
	text-decoration: underline;
}

.tdw-measurement-intro {
	color: #666;
	margin-top: 0;
	font-size: 0.92em;
}

.tdw-measurement-meta {
	font-size: 0.86em;
	color: var( --tdw-text-muted );
	margin-bottom: 14px;
}

.tdw-empty-state {
	padding: 2em;
	text-align: center;
	background: var( --tdw-bg-soft );
	border: 1px dashed var( --tdw-border );
	border-radius: 8px;
	color: var( --tdw-text-muted );
}

/* ===== Overlay loading khi đăng ký ===== */
.tdw-loading-overlay {
	position: fixed;
	inset: 0;
	background: rgba( 255, 255, 255, 0.82 );
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.tdw-loading-overlay.is-visible {
	opacity: 1;
	pointer-events: all;
}

.tdw-loading-box {
	text-align: center;
	padding: 28px 36px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 6px 24px rgba( 0, 0, 0, 0.12 );
	max-width: 320px;
}

.tdw-spinner {
	display: inline-block;
	width: 34px;
	height: 34px;
	border: 3px solid var( --tdw-accent-soft );
	border-top-color: var( --tdw-accent );
	border-radius: 50%;
	animation: tdw-spin 0.8s linear infinite;
	margin-bottom: 14px;
}

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

.tdw-loading-title {
	margin: 0 0 4px;
	font-weight: 700;
	color: #222;
}

.tdw-loading-hint {
	margin: 0;
	font-size: 0.86em;
	color: var( --tdw-text-muted );
}

html.tdw-loading-active {
	overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════════
   Nút icon "In" trong cột Hành động của trang Đơn hàng
   ══════════════════════════════════════════════════════════════════════ */
.button.tdwprint,
.woocommerce-button.tdwprint {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	overflow: hidden;
	white-space: nowrap;
	text-indent: -9999px; /* ẩn chữ "In" khỏi màn hình nhưng vẫn còn trong DOM
	                          cho trình đọc màn hình - kỹ thuật image-replacement
	                          chuẩn, không dùng display:none/visibility:hidden. */
	vertical-align: middle;
	background: #fff;
	border: 1px solid var( --tdw-border );
	border-radius: 8px;
	color: #666;
}

.button.tdwprint:hover,
.button.tdwprint:focus-visible {
	background: var( --tdw-accent-soft );
	border-color: var( --tdw-accent );
	color: var( --tdw-accent );
	outline: none;
}

.button.tdwprint::before {
	content: '';
	position: absolute;
	inset: 0;
	margin: auto;
	width: 16px;
	height: 16px;
	background-color: currentColor;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 6 2 18 2 18 9'/%3E%3Cpath d='M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2'/%3E%3Crect x='6' y='14' width='12' height='8'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 6 2 18 2 18 9'/%3E%3Cpath d='M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2'/%3E%3Crect x='6' y='14' width='12' height='8'/%3E%3C/svg%3E");
}

/* ===== Responsive tổng thể cho tab Hồ sơ ===== */
@media ( max-width: 640px ) {
	.tdw-grid-2 {
		grid-template-columns: 1fr;
	}

	.tdw-card-body {
		padding: 16px;
	}

	.tdw-accordion-toggle {
		padding: 13px 16px;
	}
}
