/*
 * Dental APPNA - My Account responsive layout.
 * Loaded last on My Account pages by mu-plugins/dentalappna-member-account.php. Built by Linknbit.
 *
 *   > 1024px   sidebar menu (desktop, laptop)
 *   <= 1024px  menu becomes a row of buttons above the content (tablet)
 *   <= 768px   swipeable menu; Orders, Payment methods and Event bookings become cards (phone)
 *   <= 400px   tighter spacing, stacked buttons (small phone)
 */

/* ==========================================================
   Tablet
   ========================================================== */
@media (max-width: 1024px) {
	.woocommerce-account.logged-in .woocommerce {
		gap: 20px;
	}
	.woocommerce-account .woocommerce-MyAccount-navigation {
		flex: 0 0 100%;
		padding: 8px;
	}
	.woocommerce-account .woocommerce-MyAccount-content {
		flex: 0 0 100%;
	}
	.woocommerce-account .woocommerce-MyAccount-navigation ul {
		position: relative;
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
	}
	.woocommerce-account .woocommerce-MyAccount-navigation li {
		flex: 0 0 auto;
		margin: 0;
	}
	.woocommerce-account .woocommerce-MyAccount-navigation li a {
		padding: 10px 14px;
		font-size: 14px;
		white-space: nowrap;
	}
	.woocommerce-account .woocommerce-MyAccount-navigation li.woocommerce-MyAccount-navigation-link--customer-logout {
		margin: 0 0 0 auto;
		padding: 0;
		border-top: 0;
	}

	.da-quick-links {
		grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	}
}

/* ==========================================================
   Phone
   ========================================================== */
@media (max-width: 768px) {
	.woocommerce-account.logged-in .woocommerce {
		gap: 14px;
	}

	/* --- Menu: one swipeable row, active item scrolled into view by account.js --- */
	.woocommerce-account .woocommerce-MyAccount-navigation {
		padding: 6px;
	}
	.woocommerce-account .woocommerce-MyAccount-navigation ul {
		flex-wrap: nowrap;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scroll-behavior: smooth;
		scrollbar-width: none;
	}
	.woocommerce-account .woocommerce-MyAccount-navigation ul::-webkit-scrollbar {
		display: none;
	}
	.woocommerce-account .woocommerce-MyAccount-navigation.is-scrollable:not(.is-end) ul {
		-webkit-mask-image: linear-gradient(90deg, #000 82%, transparent);
		mask-image: linear-gradient(90deg, #000 82%, transparent);
	}
	.woocommerce-account .woocommerce-MyAccount-navigation li a {
		min-height: 44px;
		padding: 0 14px;
	}
	.woocommerce-account .woocommerce-MyAccount-navigation li.woocommerce-MyAccount-navigation-link--customer-logout {
		margin-left: 0;
	}

	/* --- Dashboard --- */
	.da-member-card__band {
		height: 60px;
	}
	.woocommerce-account .da-member-card__name {
		font-size: 21px;
	}
	.da-quick-links {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
		margin-top: 12px;
	}
	.da-account a.da-quick-link {
		padding: 14px;
	}
	.da-quick-link__title {
		font-size: 15px;
	}
	.da-account__switch {
		text-align: center;
	}

	/* --- Account details --- */
	.woocommerce-account .woocommerce-EditAccountForm,
	.woocommerce-account .woocommerce-form-login,
	.woocommerce-account .woocommerce-form-register,
	.woocommerce-account .woocommerce-ResetPassword {
		padding-left: 16px;
		padding-right: 16px;
	}
	.woocommerce-account label.da-file--drop {
		padding: 20px 14px;
	}
	.woocommerce-account .woocommerce form .input-text,
	.woocommerce-account .woocommerce form input,
	.woocommerce-account .woocommerce form select,
	.woocommerce-account .woocommerce form textarea {
		font-size: 16px; /* stops iPhones zooming in when a field is tapped */
	}

	/* --- Orders and Payment methods as cards --- */
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods {
		display: block;
		width: 100%;
		background: transparent;
		border: 0;
		border-radius: 0;
		overflow: visible;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table thead,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods thead {
		display: none;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody {
		display: block;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: center;
		gap: 8px 12px;
		margin: 0 0 12px;
		padding: 14px 16px;
		background: #fff;
		border: 1px solid var(--da-line);
		border-radius: var(--da-radius);
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr > th,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr > td,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr > td {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		grid-column: 1 / -1;
		padding: 0 !important;
		background: transparent;
		border: 0;
		font-size: 14px;
		text-align: right !important;
	}
	/* Column label on the left of each line */
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr > td::before,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr > td::before {
		content: attr(data-title);
		float: none;
		margin-right: auto;
		color: var(--da-muted);
		font-size: 13px;
		font-weight: 600;
		text-align: left;
	}

	/* Orders: number top-left, status top-right with a coloured dot */
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr > .woocommerce-orders-table__cell-order-number {
		grid-column: 1;
		justify-content: flex-start;
		font-size: 17px;
		text-align: left !important;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr > td.woocommerce-orders-table__cell-order-status {
		grid-column: 2;
		gap: 7px;
		font-weight: 700;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr > td.woocommerce-orders-table__cell-order-status::before {
		content: "";
		width: 8px;
		height: 8px;
		margin: 0;
		border-radius: 50%;
		background: #9AA0B5;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr.woocommerce-orders-table__row--status-completed > td.woocommerce-orders-table__cell-order-status::before {
		background: #2E9E57;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr.woocommerce-orders-table__row--status-processing > td.woocommerce-orders-table__cell-order-status::before,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr.woocommerce-orders-table__row--status-on-hold > td.woocommerce-orders-table__cell-order-status::before {
		background: #E0A100;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr.woocommerce-orders-table__row--status-cancelled > td.woocommerce-orders-table__cell-order-status::before,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr.woocommerce-orders-table__row--status-failed > td.woocommerce-orders-table__cell-order-status::before,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr.woocommerce-orders-table__row--status-refunded > td.woocommerce-orders-table__cell-order-status::before {
		background: var(--da-red);
	}

	/* Payment methods: card name top-left, Default badge top-right */
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr > td.woocommerce-PaymentMethod--method {
		grid-column: 1;
		justify-content: flex-start;
		font-size: 16px;
		font-weight: 700;
		text-align: left !important;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr > td.woocommerce-PaymentMethod--default {
		grid-column: 2;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr > td.woocommerce-PaymentMethod--method::before,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr > td.woocommerce-PaymentMethod--default::before,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr > td.woocommerce-PaymentMethod--details::before {
		display: none;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr > td.woocommerce-PaymentMethod--details {
		justify-content: flex-start;
		text-align: left !important;
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr > td:empty {
		display: none;
	}

	/* Action buttons: full row under a divider, buttons share the width */
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr > td.woocommerce-orders-table__cell-order-actions,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr > td.woocommerce-PaymentMethod--actions {
		flex-wrap: wrap;
		justify-content: stretch;
		gap: 8px;
		margin-top: 4px;
		padding-top: 12px !important;
		border-top: 1px solid var(--da-line);
	}
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr > td.woocommerce-orders-table__cell-order-actions::before,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr > td.woocommerce-PaymentMethod--actions::before {
		display: none;
	}
	body.woocommerce-account .woocommerce .woocommerce-orders-table__cell-order-actions .button,
	body.woocommerce-account .woocommerce .woocommerce-PaymentMethod--actions .button {
		flex: 1 1 auto;
		justify-content: center;
		min-height: 40px;
		margin: 0;
	}

	/* Add payment method / pagination buttons: full width */
	body.woocommerce-account .woocommerce-MyAccount-content > .button,
	body.woocommerce-account .woocommerce-MyAccount-content > p > .button,
	body.woocommerce-account .woocommerce-pagination .button {
		width: 100%;
	}

	/* --- Single order view --- */
	.woocommerce-account .woocommerce-customer-details .col2-set .col-1,
	.woocommerce-account .woocommerce-customer-details .col2-set .col-2 {
		float: none;
		width: 100%;
		margin-bottom: 14px;
	}
	.woocommerce-account .woocommerce-MyAccount-content table.order_details th,
	.woocommerce-account .woocommerce-MyAccount-content table.order_details td {
		padding: 10px 12px;
		font-size: 14px;
	}

	/* --- Event bookings (the plugin turns rows into blocks below 782px) --- */
	.woocommerce-account .mpwem-dashboard-filters {
		padding: 14px;
	}
	.woocommerce-account .mpwem-filter-group {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 8px;
	}
	.woocommerce-account .mpwem-event-bookings-dashboard input.mpwem-search-input {
		flex: 1 1 100%;
		min-width: 0;
		width: 100%;
		font-size: 16px;
	}
	.woocommerce-account .mpwem-filter-group .mpwem-btn {
		flex: 1 1 0;
		width: auto;
		justify-content: center;
		min-height: 44px;
	}
	.woocommerce-account .mpwem-stats {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 8px;
	}
	.woocommerce-account .mpwem-stat-clickable {
		padding: 12px 6px;
	}
	.woocommerce-account .mpwem-stat-number {
		font-size: 24px;
	}
	.woocommerce-account .mpwem-stat-label {
		font-size: 12px;
	}
	.woocommerce-account .woocommerce-MyAccount-content table.mpwem-bookings-table {
		background: transparent;
		border: 0;
		border-radius: 0;
		overflow: visible;
	}
	.woocommerce-account .mpwem-bookings-table tbody tr {
		margin-bottom: 12px;
		background: #fff;
		border: 1px solid var(--da-line);
		border-radius: var(--da-radius);
	}
	.woocommerce-account .woocommerce-MyAccount-content table.mpwem-bookings-table td {
		padding: 10px 14px !important;
		border-bottom: 1px solid #F0F1F6;
		font-size: 14px;
	}
	.woocommerce-account .mpwem-bookings-table td::before {
		color: var(--da-muted);
		font-size: 13px;
		font-weight: 600;
	}
	.woocommerce-account .mpwem-bookings-table .mpwem-actions-group .mpwem-btn {
		flex: 1 1 auto;
		min-height: 40px;
	}
	.woocommerce-account .woocommerce-MyAccount-content table.mpwem-bookings-table td.mpwem-no-bookings {
		background: #fff;
		border: 1px solid var(--da-line);
		border-radius: var(--da-radius);
	}
	.woocommerce-account .mpwem-modal-content {
		width: calc(100% - 24px);
		margin: 12px auto;
		max-height: calc(100vh - 24px);
	}
	.woocommerce-account .mpwem-booking-details,
	.woocommerce-account .mpwem-cancel-request-form {
		padding: 16px;
	}
}

/* ==========================================================
   Small phone
   ========================================================== */
@media (max-width: 400px) {
	.da-member-card__body {
		padding: 0 14px;
	}
	.da-member-card__photo {
		flex-basis: 88px;
		width: 88px;
		height: 88px;
	}
	.da-member-card__actions {
		flex-direction: column;
		padding: 14px 14px 18px;
	}
	.da-account a.da-btn {
		width: 100%;
	}
	.da-quick-links {
		gap: 8px;
	}
	.da-account a.da-quick-link {
		padding: 12px;
	}
	.da-quick-link__text {
		display: none;
	}

	.woocommerce-account .woocommerce-EditAccountForm,
	.woocommerce-account .woocommerce-form-login,
	.woocommerce-account .woocommerce-form-register {
		padding-left: 12px;
		padding-right: 12px;
	}
	.da-photo-field {
		flex-direction: column;
		align-items: flex-start;
	}

	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-orders-table tbody tr,
	body.woocommerce-account .woocommerce-MyAccount-content table.woocommerce-MyAccount-paymentMethods tbody tr {
		padding: 12px;
	}
	body.woocommerce-account .woocommerce .woocommerce-orders-table__cell-order-actions .button,
	body.woocommerce-account .woocommerce .woocommerce-PaymentMethod--actions .button {
		flex-basis: 100%;
	}

	.woocommerce-account .mpwem-stat-number {
		font-size: 20px;
	}
}
