/**
 * Customize My Account — base frontend styles.
 * Uses CSS variables so presets and inline styles can override cleanly.
 */

.cma-woo {
	--cma-primary: #2271b1;
	--cma-accent: #135e96;
	--cma-bg: transparent;
	--cma-text: inherit;
	--cma-border: rgba(0, 0, 0, 0.1);
	--cma-active-bg: var(--cma-primary);
	--cma-active-text: #fff;
	--cma-radius: 8px;
	--cma-sidebar-width: 260px;
	--cma-gap: 32px;
}

/* Header (avatar + welcome) — lives INSIDE the sidebar nav */
.cma-woo .cma-account-header {
	padding: 14px 10px 16px;
	margin: 0 0 10px;
	border-bottom: 1px solid var(--cma-border);
	text-align: center;
}
.cma-woo .cma-welcome h3 {
	margin: 10px 0 0;
	font-size: 1rem;
	line-height: 1.3;
}

/* Profile photo box — square (or whatever radius the admin sets) with a gear */
.cma-woo .cma-profile-box-wrap {
	display: flex;
	justify-content: center;
}
.cma-woo .cma-profile-box {
	position: relative;
	width: var(--cma-photo-width, 120px);
	height: var(--cma-photo-height, 120px);
	max-width: 100%;
	display: inline-block;
	box-sizing: content-box;
}
.cma-woo .cma-profile-photo-inner {
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: var(--cma-photo-radius, 12px);
	border: var(--cma-photo-border-width, 2px) solid var(--cma-photo-border-color, var(--cma-border));
	background: rgba(127, 127, 127, 0.1);
	box-sizing: border-box;
}
.cma-woo .cma-profile-photo {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.cma-woo .cma-photo-gear {
	position: absolute;
	right: -4px;
	bottom: -4px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #111;
	color: #fff;
	border: 2px solid #fff;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	z-index: 2;
}
.cma-woo .cma-photo-gear:hover {
	background: #333;
}
.cma-woo .cma-photo-gear .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
	line-height: 1;
}
.cma-woo .cma-photo-menu {
	position: absolute;
	top: calc(100% + 8px);
	right: -4px;
	min-width: 180px;
	list-style: none;
	margin: 0;
	padding: 4px 0;
	background: #fff;
	color: #1f2937;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 6px;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
	z-index: 100;
	text-align: left;
}
.cma-woo .cma-photo-menu[hidden] {
	display: none;
}
.cma-woo .cma-photo-menu li {
	margin: 0;
}
.cma-woo .cma-photo-menu button {
	display: block;
	width: 100%;
	background: transparent;
	border: 0;
	padding: 8px 14px;
	cursor: pointer;
	font-size: 14px;
	color: inherit;
	text-align: left;
	line-height: 1.4;
}
.cma-woo .cma-photo-menu button:hover:not([disabled]) {
	background: rgba(0, 0, 0, 0.05);
}
.cma-woo .cma-photo-menu button[disabled] {
	color: #9ca3af;
	cursor: not-allowed;
}
.cma-woo .cma-photo-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	border-radius: var(--cma-photo-radius, 12px);
	display: none;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 12px;
	z-index: 3;
	pointer-events: none;
}
.cma-woo .cma-profile-box.is-loading .cma-photo-overlay {
	display: flex;
}
.cma-woo .cma-profile-box.is-loading .cma-photo-overlay span::before {
	content: "";
	display: inline-block;
	width: 22px;
	height: 22px;
	border: 3px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: cma-spin 0.8s linear infinite;
}
@keyframes cma-spin {
	to { transform: rotate(360deg); }
}

/* Navigation baseline */
.cma-woo .woocommerce-MyAccount-navigation ul {
	list-style: none;
	margin: 0;
	padding: 0;
}
.cma-woo .woocommerce-MyAccount-navigation li {
	margin: 0;
	border: 0;
}
.cma-woo .woocommerce-MyAccount-navigation a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	color: var(--cma-text);
	text-decoration: none;
	border-radius: var(--cma-radius);
	transition: background-color 0.15s ease, color 0.15s ease;
}
.cma-woo .woocommerce-MyAccount-navigation li.is-active > a,
.cma-woo .woocommerce-MyAccount-navigation li.woocommerce-MyAccount-navigation-link--active > a {
	background: var(--cma-active-bg);
	color: var(--cma-active-text);
}
.cma-woo .woocommerce-MyAccount-navigation a:hover {
	background: rgba(0, 0, 0, 0.05);
}

/* Icons — injected as <span class="dashicons dashicons-XYZ"> inside the anchor by frontend.js */
.cma-woo .woocommerce-MyAccount-navigation a > .dashicons {
	width: 18px;
	height: 18px;
	font-size: 18px;
	line-height: 1;
	flex-shrink: 0;
}

/* ---------- Layouts ---------- */

/* Sidebar left (Woo default-ish) */
.cma-woo.cma-layout-sidebar-left .woocommerce-account .woocommerce-MyAccount-navigation {
	width: var(--cma-sidebar-width);
	float: left;
}
.cma-woo.cma-layout-sidebar-left .woocommerce-account .woocommerce-MyAccount-content {
	width: calc(100% - var(--cma-sidebar-width) - var(--cma-gap));
	float: right;
}

/* Sidebar right */
.cma-woo.cma-layout-sidebar-right .woocommerce-account .woocommerce-MyAccount-navigation {
	width: var(--cma-sidebar-width);
	float: right;
}
.cma-woo.cma-layout-sidebar-right .woocommerce-account .woocommerce-MyAccount-content {
	width: calc(100% - var(--cma-sidebar-width) - var(--cma-gap));
	float: left;
}

/* Tabs on top */
.cma-woo.cma-layout-tabs-top .woocommerce-account .woocommerce-MyAccount-navigation {
	width: 100%;
	float: none;
	margin-bottom: 24px;
	border-bottom: 1px solid var(--cma-border);
}
.cma-woo.cma-layout-tabs-top .woocommerce-account .woocommerce-MyAccount-navigation ul {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}
.cma-woo.cma-layout-tabs-top .woocommerce-account .woocommerce-MyAccount-navigation a {
	border-radius: var(--cma-radius) var(--cma-radius) 0 0;
	padding: 12px 18px;
}
.cma-woo.cma-layout-tabs-top .woocommerce-account .woocommerce-MyAccount-content {
	width: 100%;
	float: none;
}
.cma-woo.cma-layout-tabs-top .cma-account-header {
	border-bottom: 0;
}

/* Compact vertical */
.cma-woo.cma-layout-tabs-vertical .woocommerce-account .woocommerce-MyAccount-navigation {
	width: 200px;
	float: left;
}
.cma-woo.cma-layout-tabs-vertical .woocommerce-account .woocommerce-MyAccount-navigation a {
	padding: 6px 10px;
	font-size: 14px;
}
.cma-woo.cma-layout-tabs-vertical .woocommerce-account .woocommerce-MyAccount-content {
	width: calc(100% - 200px - 24px);
	float: right;
}

/* Mobile */
@media (max-width: 768px) {
	.cma-woo .woocommerce-account .woocommerce-MyAccount-navigation,
	.cma-woo .woocommerce-account .woocommerce-MyAccount-content {
		width: 100% !important;
		float: none !important;
	}
	.cma-woo .woocommerce-account .woocommerce-MyAccount-navigation {
		margin-bottom: 20px;
	}
	.cma-woo.cma-layout-tabs-top .woocommerce-MyAccount-navigation ul {
		flex-direction: column;
	}
}

/* Custom fields */
.cma-woo .cma-custom-fields .cma-field {
	margin-top: 12px;
}
.cma-woo .cma-radio-group label {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-right: 12px;
}
.cma-woo .cma-checkbox-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.cma-woo .cma-field-group {
	border: 1px solid var(--cma-border);
	border-radius: var(--cma-radius);
	padding: 12px 18px 6px;
	margin: 18px 0 6px;
}
.cma-woo .cma-field-group > legend {
	padding: 0 8px;
	font-weight: 600;
	font-size: 0.95em;
}
