/* ============================================================
   SKG.EDUCATION - woocommerce.css
   Reskins the WooCommerce cart, checkout and My Account pages
   into the "Momentum" design. This is a SKIN only: colours,
   borders, radius, type and buttons. Layout is left to
   WooCommerce's own block CSS so updates never break the grid.

   Loaded by inc/enqueue.php on WooCommerce pages only, after
   main.css (so the --skg-* tokens are available).
   ============================================================ */

/* ---------- page shell ---------- */
.woocommerce-cart .wc-block-cart,
.woocommerce-checkout .wc-block-checkout,
.woocommerce-account .woocommerce {
	max-width: var(--skg-maxw);
	margin-left: auto;
	margin-right: auto;
}

.woocommerce-page :where(h1, h2, h3) {
	color: var(--skg-navy);
	font-weight: 900;
	letter-spacing: -.03em;
}

/* Content links (cart / checkout / account body) - scoped to <main> so
   it never leaks into the header or footer template parts, which carry
   their own link colours. (Without the `main` scope this rule's
   specificity beat the header shield below and turned the nav blue.) */
.woocommerce-page main a:not(.button):not(.wc-block-components-button) {
	color: var(--skg-blue-deep);
}

/* ---------- header shield ----------
   WooCommerce's block cart/checkout templates render the header
   template part WITHOUT the theme's .skg-header class, so the header
   chrome (white bg, navy underline, sticky) is lost. Re-apply it to
   the header element that contains the nav. The logo size itself is
   fixed in main.css (.skg-nav .skg-logo-img). The nav-link colours
   below are a safety net - the content-link rule above is scoped to
   <main>, so it no longer reaches the header anyway. */
.woocommerce-page header:has(.skg-nav) {
	position: sticky;
	top: 0;
	z-index: 100;
	background: #fff;
	border-bottom: 3px solid var(--skg-navy);
}
.woocommerce-page .skg-nav .skg-logo-img { height: 56px; width: auto; max-width: none; }
.woocommerce-page .skg-navitem > a { color: var(--skg-navy); }
.woocommerce-page .skg-navitem > a:hover,
.woocommerce-page .skg-navitem.has-menu:hover > a { color: var(--skg-orange); }

/* ---------- checkout / cart header: logo, not the site-title text ----------
   The block checkout/cart render a minimal header showing the plain
   "SKG.EDUCATION" site-title text instead of the brand logo. Swap the
   text for the logo image. The text stays in the DOM (just visually
   replaced via text-indent) so screen readers still announce the site
   name and the link to home keeps working. */
.woocommerce-page header .wp-block-site-title {
	margin: 0;
	line-height: 0;
}
.woocommerce-page header .wp-block-site-title a {
	display: inline-block;
	width: 210px;
	height: 50px;
	background: url(../img/skg-logo.png) left center / contain no-repeat;
	text-indent: -9999px;
	white-space: nowrap;
	overflow: hidden;
}

/* ---------- footer shield ----------
   Same symptom as the header: WC renders the footer template-part
   WITHOUT the theme's .skg-footer class, so the navy background,
   light text and link palette all evaporate. Re-attach everything
   via :has(.skg-foot-inner). The WC page-level link colour we set
   above (skg-blue-deep) is overridden here with !important so links
   in the navy footer keep their muted/orange palette. */
.woocommerce-page footer:has(.skg-foot-inner) {
	background: var(--skg-navy);
	color: #aab4c6;
}
.woocommerce-page footer:has(.skg-foot-inner) a {
	color: #aab4c6 !important;
	text-decoration: none !important;
}
.woocommerce-page footer:has(.skg-foot-inner) a:hover {
	color: var(--skg-orange) !important;
}
.woocommerce-page footer:has(.skg-foot-inner) .skg-foot-logo,
.woocommerce-page footer:has(.skg-foot-inner) .skg-foot-col h4 {
	color: #fff !important;
}
.woocommerce-page footer:has(.skg-foot-inner) .skg-foot-desc {
	color: #cfd6e2;
}
.woocommerce-page footer:has(.skg-foot-inner) .skg-foot-contact-item .skg-foot-cico {
	color: var(--skg-orange);
}
.woocommerce-page footer:has(.skg-foot-inner) .skg-foot-contact-item a {
	color: #cfd6e2 !important;
}
.woocommerce-page footer:has(.skg-foot-inner) .skg-foot-contact-item a:hover {
	color: var(--skg-orange) !important;
}
.woocommerce-page footer:has(.skg-foot-inner) .skg-foot-divider {
	border-color: #33405a;
}

/* ---------- buttons (block + classic) ---------- */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce .button,
.wc-block-components-button.contained,
.wp-block-button__link {
	background: var(--skg-orange);
	color: var(--skg-navy);
	border: 3px solid var(--skg-navy);
	border-radius: var(--skg-r-pill);
	font-weight: 800;
	letter-spacing: -.01em;
	box-shadow: none;
	transition: transform .12s ease, box-shadow .12s ease;
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce .button:hover,
.wc-block-components-button.contained:hover:not(:disabled),
.wp-block-button__link:hover {
	background: var(--skg-orange);
	color: var(--skg-navy);
	transform: translateY(-2px);
	box-shadow: 0 10px 22px -10px rgba(34, 45, 64, .6);
}

/* secondary / outline buttons */
.woocommerce a.button.wc-backward,
.wc-block-components-button.outlined {
	background: #fff;
	color: var(--skg-navy);
}

/* the place-order button - make it the loud primary action */
.wc-block-components-checkout-place-order-button {
	width: 100%;
	font-size: 1.05rem;
	padding-top: 14px;
	padding-bottom: 14px;
}

/* ---------- form fields ---------- */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
.wc-block-components-text-input input,
.wc-block-components-select select,
.wc-block-components-textarea {
	border: 2px solid var(--skg-line);
	border-radius: var(--skg-r-sm);
	background: #fff;
}

.woocommerce form .form-row input.input-text:focus,
.wc-block-components-text-input.is-active input,
.wc-block-components-text-input input:focus {
	border-color: var(--skg-blue);
	outline: none;
	box-shadow: 0 0 0 3px rgba(27, 152, 219, .15);
}

.wc-block-components-text-input.is-active label,
.wc-block-components-checkout-step__title {
	color: var(--skg-navy);
}

/* ---------- notices ---------- */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.wc-block-components-notice-banner {
	border: 3px solid var(--skg-navy);
	border-radius: var(--skg-r-sm);
	background: var(--skg-soft);
	color: var(--skg-navy);
	font-weight: 600;
}

.woocommerce-message::before,
.woocommerce-info::before { color: var(--skg-blue-deep); }
.wc-block-components-notice-banner.is-success { border-color: var(--skg-blue-deep); }
.wc-block-components-notice-banner.is-error { border-color: #c0392b; }

/* ---------- cart + checkout panels ---------- */
.wc-block-components-panel,
.wc-block-checkout__sidebar .wc-block-components-totals-wrapper,
.wc-block-cart__sidebar .wc-block-components-totals-wrapper {
	border-radius: var(--skg-r-sm);
}

.wc-block-cart__sidebar > .wc-block-components-sidebar,
.wc-block-checkout__sidebar > .wc-block-components-sidebar {
	background: var(--skg-soft);
	border: 3px solid var(--skg-navy);
	border-radius: var(--skg-r);
}

.wc-block-components-checkout-step {
	border-bottom: 1px solid var(--skg-line);
}

/* order total row - emphasised */
.wc-block-components-totals-footer-item,
.woocommerce-cart .cart_totals .order-total {
	font-weight: 900;
	color: var(--skg-navy);
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
	color: var(--skg-navy);
}

/* product titles + prices in the order summary */
.wc-block-components-product-name,
.woocommerce-cart-form .product-name a {
	color: var(--skg-navy);
	font-weight: 800;
}

.wc-block-components-product-price__value,
.woocommerce-Price-amount {
	color: var(--skg-navy);
	font-weight: 800;
}

/* coupon link / details toggles */
.wc-block-components-totals-coupon-link,
.wc-block-components-panel__button {
	color: var(--skg-blue-deep);
	font-weight: 700;
}

/* ---------- My Account ---------- */
.woocommerce-account .woocommerce-MyAccount-navigation ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.woocommerce-account .woocommerce-MyAccount-navigation li {
	border: 3px solid var(--skg-navy);
	border-radius: var(--skg-r-sm);
	background: #fff;
}

.woocommerce-account .woocommerce-MyAccount-navigation li a {
	display: block;
	padding: 12px 18px;
	font-weight: 800;
	color: var(--skg-navy);
}

.woocommerce-account .woocommerce-MyAccount-navigation li.is-active {
	background: var(--skg-navy);
	border-color: var(--skg-navy);
}

.woocommerce-account .woocommerce-MyAccount-navigation li.is-active a {
	color: #fff;
}

.woocommerce-account .woocommerce-MyAccount-content {
	border: 3px solid var(--skg-navy);
	border-radius: var(--skg-r);
	background: #fff;
	padding: 28px;
}

/* account orders / tables */
.woocommerce table.shop_table {
	border: 3px solid var(--skg-navy);
	border-radius: var(--skg-r-sm);
	border-collapse: separate;
	border-spacing: 0;
	overflow: hidden;
}

.woocommerce table.shop_table thead th {
	background: var(--skg-soft);
	color: var(--skg-navy);
	font-weight: 800;
}

/* Round the corner <th>s so the soft-grey thead background follows
   the table's outer border-radius (without this the thead bg is
   square and pokes into the rounded outer corners). The radius is
   the table's --skg-r-sm minus the 3px border. */
.woocommerce table.shop_table thead tr th:first-child {
	border-top-left-radius: calc(var(--skg-r-sm) - 3px);
}
.woocommerce table.shop_table thead tr th:last-child {
	border-top-right-radius: calc(var(--skg-r-sm) - 3px);
}
.woocommerce table.shop_table tbody tr:last-child td:first-child,
.woocommerce table.shop_table tfoot tr:last-child td:first-child {
	border-bottom-left-radius: calc(var(--skg-r-sm) - 3px);
}
.woocommerce table.shop_table tbody tr:last-child td:last-child,
.woocommerce table.shop_table tfoot tr:last-child td:last-child {
	border-bottom-right-radius: calc(var(--skg-r-sm) - 3px);
}

/* ---------- classic cart: keep it within the screen on mobile ----------
   The /cart/ page uses the classic [woocommerce_cart] shortcode. Its
   responsive table sizes itself to its content, so on narrow screens it
   pushed wider than the viewport and the page scrolled sideways - made
   worse by the apply-coupon button ("Χρήση κουπονιού"), which inherited the
   generic pill styling and forced a fixed, oversized width on a single row.

   Fix: force the cart table to a plain block layout capped at 100% width so
   it can never out-grow the screen, and let the coupon row wrap instead of
   forcing a fixed width - each button stays single-line at its natural size
   (not the tall, full-width two-line blob the pill styling produced). */
@media (max-width: 768px) {
	.woocommerce-cart table.cart,
	.woocommerce-cart table.cart tbody,
	.woocommerce-cart table.cart tr {
		display: block;
		width: 100%;
		max-width: 100%;
	}

	.woocommerce-cart table.cart td {
		display: block;
		width: 100% !important;
		max-width: 100%;
		box-sizing: border-box;
	}

	.woocommerce-cart .cart .actions .coupon {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		align-items: center;
	}

	/* input takes the full row; the apply button wraps onto its own line
	   below it, so its label can never be clipped on narrow screens. */
	.woocommerce-cart .cart .actions .coupon #coupon_code,
	.woocommerce-cart .cart .actions .coupon .input-text {
		flex: 1 1 100%;
		min-width: 0;
		width: auto;
		margin: 0;
	}

	/* apply-coupon (inside .coupon) + update-cart (the sibling button):
	   single line, sized to fit their label (min-width:max-content stops the
	   last character being clipped), height matched to the coupon input. */
	.woocommerce-cart .cart .actions .coupon .button,
	.woocommerce-cart .cart .actions > .button {
		flex: 0 0 auto;
		width: auto;
		min-width: max-content;
		white-space: nowrap;
		padding: 12px 18px;
		font-size: .9rem;
		line-height: 1.2;
	}

	/* update-cart sits on its own line below the coupon row */
	.woocommerce-cart .cart .actions > .button {
		margin-top: 10px;
	}
}
