/*
Theme Name:        Warranty Management Theme
Theme URI:         https://gwarancja.zimet.sklep.pl
Description:       Purpose-built theme for the Pfaff & Husqvarna Viking Warranty Portal. Cream/white base with orange (#EA5A00) accent. Pairs with the Warranty Management System plugin.
Version:           1.1.0
Requires at least: 6.0
Tested up to:      6.7
Requires PHP:      8.0
Author:            Huzaifa Qureshi
Author URI:        https://huzaifaqureshi.com/
License:           GPL-2.0-or-later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       warranty-theme
Tags:              custom-menu, custom-logo, full-site-editing
*/

/* =============================================================
   DESIGN TOKENS
   All colors, fonts, spacing driven from WordPress Customizer.
   These :root values are the DEFAULTS — overridden at runtime
   by inc/customizer.php writing inline <style> to wp_head.
   ============================================================= */
:root {
	/* Brand */
	--wt-accent:          #EA5A00;   /* Orange — sparingly only */
	--wt-accent-hover:    #c44d00;   /* Darker orange for hover */
	--wt-accent-light:    #fff3ed;   /* Very pale orange tint for backgrounds */

	/* Surfaces */
	--wt-bg:              #f2f2f7;   /* Page background — iOS system gray */
	--wt-bg-alt:          #e5e5ea;   /* Slightly darker for hover/alt areas */
	--wt-surface:         #ffffff;   /* Card / panel surface — pure white */
	--wt-surface-border:  rgba(0,0,0,.08);  /* Subtle transparent border */

	/* Text */
	--wt-text:            #1a1a1a;   /* Primary text */
	--wt-text-muted:      #6b7280;   /* Labels, metadata */
	--wt-text-faint:      #9ca3af;   /* Placeholder, disabled */
	--wt-link:            #1a1a1a;   /* Links default to text color */
	--wt-link-hover:      #EA5A00;   /* Links show orange on hover */

	/* Header */
	--wt-header-bg:       #ffffff;
	--wt-header-border:   #ece9e4;
	--wt-header-height:   70px;

	/* Footer */
	--wt-footer-bg:       #1a1a1a;
	--wt-footer-text:     #d1d5db;
	--wt-footer-link:     #9ca3af;
	--wt-footer-link-hover: #EA5A00;

	/* Navigation */
	--wt-nav-text:        #374151;
	--wt-nav-text-hover:  #EA5A00;
	--wt-nav-active:      #EA5A00;

	/* Typography */
	--wt-font-heading:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--wt-font-body:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--wt-font-size-base:  16px;
	--wt-line-height:     1.6;

	/* Spacing */
	--wt-radius:          10px;
	--wt-radius-lg:       16px;
	--wt-shadow-sm:       0 2px 8px rgba(0,0,0,.06);
	--wt-shadow-md:       0 4px 16px rgba(0,0,0,.08);
	--wt-shadow-xl:       0 16px 40px rgba(0,0,0,.10);
	--wt-border:          rgba(0,0,0,.08);

	/* Status colours (used by badges, alerts — separate from accent) */
	--wt-status-success:  #16a34a;
	--wt-status-warning:  #d97706;
	--wt-status-error:    #dc2626;
	--wt-status-info:     #EA5A00;
}

/* =============================================================
   BASE RESET
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; }

html {
	font-size: var(--wt-font-size-base);
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	padding: 0;
	font-family: var(--wt-font-body);
	font-size: 1rem;
	line-height: var(--wt-line-height);
	color: var(--wt-text);
	background-color: var(--wt-bg);
	-webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--wt-link); text-decoration: none; transition: color .15s; }
a:hover { color: var(--wt-link-hover); }

h1, h2, h3, h4, h5, h6 {
	font-family: var(--wt-font-heading);
	font-weight: 700;
	line-height: 1.25;
	color: var(--wt-text);
	margin: 0 0 .75rem;
}

p { margin: 0 0 1rem; }

ul, ol { margin: 0 0 1rem; padding-left: 1.5rem; }

/* =============================================================
   LAYOUT
   ============================================================= */
.wt-container {
	max-width: 1180px;
	margin: 0 auto;
	padding: 0 24px;
}

.wt-site {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.wt-main {
	flex: 1;
	background: var( --wt-bg );
}

/* =============================================================
   PORTAL PAGE TEMPLATE
   Full-width wrapper — overrides blog-content constraints.
   ============================================================= */
.wt-portal-wrap {
	width: 100%;
}

.wt-portal-content {
	width: 100%;
	max-width: 1060px;
	margin: 0 auto;
	padding: 40px 24px 60px;
	min-height: calc( 100vh - var(--wt-header-height) - 180px );
}

/* Full-bleed variant — used by landing page so hero sections span the viewport */
.wt-portal-content--full {
	max-width: none;
	padding: 0;
}

@media ( max-width: 640px ) {
	.wt-portal-content {
		padding: 24px 16px 40px;
	}
}

/* Scope blog entry-content width only to standard page.php context */
.page-template-default .wt-entry-content {
	max-width: 740px;
}

/* Override: portal template gets full width */
.page-template-page-portal .wt-entry-content {
	max-width: none;
}

/* =============================================================
   HEADER
   ============================================================= */
.wt-header {
	position: sticky;
	top: 0;
	z-index: 100;
	height: var(--wt-header-height);
	background: var(--wt-header-bg);
	border-bottom: 1px solid var(--wt-header-border);
	box-shadow: var(--wt-shadow-sm);
	transition: box-shadow .2s ease;
}

/* Scroll-aware shadow — added by theme-ui.js when scrollY > 10 */
.wt-header.is-scrolled {
	box-shadow: 0 2px 20px rgba(0,0,0,.09), 0 1px 4px rgba(0,0,0,.05);
}

/* WordPress admin bar — push sticky header below the 32px fixed bar */
.admin-bar .wt-header {
	top: 32px;
}
@media screen and ( max-width: 782px ) {
	.admin-bar .wt-header {
		top: 46px;
	}
}

/* Make the container fill header height so align-items:center works correctly */
.wt-header .wt-container {
	height: 100%;
}

.wt-header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 100%;
	gap: 24px;
}

/* Logo */
.wt-logo a {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
}

.wt-logo img {
	height: 40px;
	width: auto;
}

.wt-logo-text {
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--wt-text);
	white-space: nowrap;
}

/* Header Nav Wrapper — flex container that centres the nav between logo and actions */
.wt-header-nav {
	display: flex;
	align-items: center;
	flex: 1;
	justify-content: center;
}

/* Primary Navigation */
.wt-nav {
	display: flex;
	align-items: center;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.wt-nav li a {
	display: block;
	padding: 6px 14px;
	font-size: .9rem;
	font-weight: 500;
	color: var(--wt-nav-text);
	border-radius: var(--wt-radius);
	transition: color .15s, background-color .15s;
}

.wt-nav li a:hover,
.wt-nav li.current-menu-item > a {
	color: var(--wt-nav-active);
	background: var(--wt-accent-light);
}

/* Header Actions (notification bell + user account) */
.wt-header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

/* ── Header Layout Variants ──────────────────────────────────────────────── */

/* Logo Centered: three-column grid — nav | logo | actions */
.wt-header-layout-center {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	justify-items: start;
}
.wt-header-layout-center .wt-header-nav {
	grid-column: 1;
	justify-content: flex-start;
}
.wt-header-layout-center .wt-logo {
	grid-column: 2;
}
.wt-header-layout-center .wt-header-actions {
	grid-column: 3;
	justify-self: end;
}

/* Logo Right: nav first, logo last */
.wt-header-layout-right .wt-logo         { order: 3; flex-shrink: 0; }
.wt-header-layout-right .wt-header-nav   { order: 1; flex: 1; justify-content: flex-start; }
.wt-header-layout-right .wt-header-actions { order: 2; }

.wt-notif-btn {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	background: none;
	border: 1px solid var(--wt-header-border);
	border-radius: var(--wt-radius);
	color: var(--wt-text);
	cursor: pointer;
	transition: background .15s, border-color .15s, color .15s;
	padding: 0;
}

.wt-notif-btn:hover {
	background: var(--wt-accent-light);
	border-color: var(--wt-accent);
	color: var(--wt-accent);
}

/* Notification unread badge — orange dot on bell */
.wt-notif-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	background: var(--wt-accent);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	border-radius: 9px;
	border: 2px solid var(--wt-header-bg);
	pointer-events: none;
}

/* Also support old class name for backwards compat */
.wms-notif-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	background: var(--wt-accent);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	border-radius: 9px;
	border: 2px solid var(--wt-header-bg);
	pointer-events: none;
}

/* Notification dropdown */
.wt-notif-wrap {
	position: relative;
}

.wt-notif-dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: 320px;
	max-height: 400px;
	background: #fff;
	border: 1px solid var(--wt-header-border, #e5e7eb);
	border-radius: var(--wt-radius, 10px);
	box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
	z-index: 999;
	overflow: hidden;
	flex-direction: column;
}
.wt-notif-dropdown.is-open {
	display: flex;
}

.wt-notif-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px 12px;
	font-size: 13px;
	font-weight: 700;
	color: var(--wt-text, #111827);
	border-bottom: 1px solid var(--wt-header-border, #e5e7eb);
	flex-shrink: 0;
}

.wt-notif-mark-read {
	background: none;
	border: none;
	color: var(--wt-accent, #EA5A00);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	padding: 0;
	text-decoration: underline;
}
.wt-notif-mark-read:hover { opacity: .75; }

.wt-notif-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px;
	flex: 1;
}

.wt-notif-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 32px 16px;
	font-size: 13px;
	color: #9ca3af;
	text-align: center;
	flex: 1;
}

.wt-notif-list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	flex: 1;
}

.wt-notif-item {
	border-bottom: 1px solid #f3f4f6;
	transition: background .12s;
}
.wt-notif-item:last-child { border-bottom: none; }
.wt-notif-item--unread {
	background: #fff7f0;
	border-left: 3px solid var(--wt-accent, #EA5A00);
}
.wt-notif-item-link {
	display: block;
	padding: 12px 16px;
	text-decoration: none;
	color: inherit;
}
.wt-notif-item:not(:has(.wt-notif-item-link)) {
	padding: 12px 16px;
}
.wt-notif-item:hover { background: #f9fafb; }
.wt-notif-item--unread:hover { background: #fde8d8; }

.wt-notif-item-msg {
	display: block;
	font-size: 13px;
	color: #111827;
	line-height: 1.45;
	margin-bottom: 4px;
}
.wt-notif-item-time {
	display: block;
	font-size: 11px;
	color: #9ca3af;
}

.wt-header-user {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 5px 12px 5px 6px;
	font-size: .875rem;
	font-weight: 500;
	color: var(--wt-text);
	border: 1px solid var(--wt-header-border);
	border-radius: 999px;
	text-decoration: none;
	transition: background .15s, border-color .15s, color .15s;
	white-space: nowrap;
}

.wt-header-user:hover {
	background: var(--wt-accent-light);
	border-color: var(--wt-accent);
	color: var(--wt-accent);
}

.wt-header-user:hover .wt-user-avatar {
	background: var(--wt-accent);
}

/* User initial avatar circle */
.wt-user-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	background: var(--wt-text);
	color: #fff;
	font-size: .75rem;
	font-weight: 700;
	border-radius: 50%;
	flex-shrink: 0;
	transition: background .15s;
}

.wt-user-name {
	max-width: 120px;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wt-header-logout {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 6px 12px;
	font-size: .875rem;
	font-weight: 500;
	color: var(--wt-text-muted);
	border: 1px solid var(--wt-header-border);
	border-radius: var(--wt-radius);
	text-decoration: none;
	transition: background .15s, border-color .15s, color .15s;
	white-space: nowrap;
}

.wt-header-logout:hover {
	background: #fef2f2;
	border-color: #dc2626;
	color: #dc2626;
}

.wt-header-logout svg {
	flex-shrink: 0;
}

.wt-btn-outline {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 18px;
	background: transparent;
	color: var(--wt-accent);
	border: 1.5px solid var(--wt-accent);
	font-size: .875rem;
	font-weight: 600;
	border-radius: var(--wt-radius);
	transition: background .15s, color .15s;
	white-space: nowrap;
	text-decoration: none;
	cursor: pointer;
}

.wt-btn-outline:hover {
	background: var(--wt-accent);
	color: #fff;
}

/* Header CTA — uses accent sparingly */
.wt-header-cta {
	flex-shrink: 0;
}

.wt-btn-accent {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 18px;
	background: var(--wt-accent);
	color: #fff;
	font-size: .875rem;
	font-weight: 600;
	border-radius: var(--wt-radius);
	transition: background .15s;
	white-space: nowrap;
}

.wt-btn-accent:hover {
	background: var(--wt-accent-hover);
	color: #fff;
}

/* Nav active state — clear orange indicator */
.wt-nav li.current-menu-item > a {
	color: var(--wt-nav-active);
	background: var(--wt-accent-light);
	font-weight: 600;
}

/* Mobile hamburger */
.wt-nav-toggle {
	display: none;
	background: none;
	border: 1px solid var(--wt-header-border);
	border-radius: var(--wt-radius);
	cursor: pointer;
	padding: 7px;
	width: 38px;
	height: 38px;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 4px;
	transition: background .15s, border-color .15s;
}

.wt-nav-toggle:hover {
	background: var(--wt-accent-light);
	border-color: var(--wt-accent);
}

.wt-nav-toggle span {
	display: block;
	width: 18px;
	height: 2px;
	background: var(--wt-text);
	border-radius: 2px;
	transition: transform .2s ease, opacity .2s ease;
	transform-origin: center;
}

/* Hamburger → X animation when open */
.wt-nav-toggle[aria-expanded="true"] span:nth-child(1) {
	transform: translateY(6px) rotate(45deg);
}
.wt-nav-toggle[aria-expanded="true"] span:nth-child(2) {
	opacity: 0;
	transform: scaleX(0);
}
.wt-nav-toggle[aria-expanded="true"] span:nth-child(3) {
	transform: translateY(-6px) rotate(-45deg);
}

/* =============================================================
   FOOTER — Light warm theme (Intercom-inspired)
   ============================================================= */
.wt-footer {
	background: var(--wt-bg-alt);
	color: var(--wt-text);
	border-top: 1px solid var(--wt-border);
	padding: 56px 0 0;
}

.wt-footer-grid {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr;
	gap: 48px;
	padding-bottom: 40px;
}

/* Brand column */
.wt-footer-brand {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.wt-footer-brand .wt-logo-text {
	color: var(--wt-text);
	font-size: 1.1rem;
	font-weight: 700;
	margin-bottom: 0;
	display: block;
}

.wt-footer-logo img {
	max-height: 36px;
	width: auto;
}

.wt-footer-brand p {
	font-size: .875rem;
	color: var(--wt-text-muted);
	margin: 0;
	line-height: 1.6;
	max-width: 280px;
}

/* Footer nav columns */
.wt-footer-col h4 {
	color: var(--wt-text);
	font-size: .75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	margin-bottom: 18px;
}

.wt-footer-col ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wt-footer-col ul li a {
	font-size: .875rem;
	color: var(--wt-text-muted);
	transition: color .15s;
}

.wt-footer-col ul li a:hover {
	color: var(--wt-accent);
}

/* Support CTA in footer */
.wt-footer-support-cta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 14px;
	padding: 8px 16px;
	background: var(--wt-accent);
	color: #fff;
	font-size: .8rem;
	font-weight: 600;
	border-radius: var(--wt-radius);
	text-decoration: none;
	transition: background .15s, transform .15s;
}

.wt-footer-support-cta:hover {
	background: var(--wt-accent-hover);
	color: #fff;
	transform: translateY(-1px);
}

/* Bottom bar */
.wt-footer-bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	padding: 20px 0;
	margin-top: 0;
	border-top: 1px solid var(--wt-border);
	font-size: .8rem;
	color: var(--wt-text-muted);
}

.wt-footer-bottom a {
	color: var(--wt-text-muted);
	transition: color .15s;
}

.wt-footer-bottom a:hover {
	color: var(--wt-accent);
}

.wt-footer-bottom-links {
	display: flex;
	gap: 20px;
}

/* Social icons */
.wt-social {
	display: flex;
	gap: 10px;
	margin-top: 6px;
}

.wt-social a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	background: var(--wt-surface);
	border: 1px solid var(--wt-border);
	border-radius: var(--wt-radius);
	color: var(--wt-text-muted);
	transition: background .15s, border-color .15s, color .15s;
}

.wt-social a:hover {
	background: var(--wt-accent-light);
	border-color: var(--wt-accent);
	color: var(--wt-accent);
}

/* Back to top button */
.wt-back-to-top {
	position: fixed;
	bottom: 28px;
	right: 28px;
	width: 44px;
	height: 44px;
	background: var(--wt-accent);
	color: #fff;
	border: none;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 90;
	opacity: 0;
	transform: translateY(12px);
	pointer-events: none;
	transition: opacity .2s ease, transform .2s ease, background .15s;
	box-shadow: 0 4px 14px rgba(234,90,0,.35);
}

.wt-back-to-top.is-visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.wt-back-to-top:hover {
	background: var(--wt-accent-hover);
}

/* =============================================================
   PAGE TEMPLATES
   ============================================================= */
.wt-page-content {
	padding: 48px 0;
}

.wt-entry-title {
	font-size: clamp(1.6rem, 4vw, 2.4rem);
	margin-bottom: 8px;
}

.wt-entry-meta {
	font-size: .85rem;
	color: var(--wt-text-muted);
	margin-bottom: 32px;
}

/* Scoped to blog / default page context only — portal template overrides to none */
.page-template-default .wt-entry-content,
body:not(.page-template-page-portal) .wt-entry-content {
	max-width: 740px;
}

.wt-entry-content p,
.wt-entry-content li {
	font-size: 1rem;
	color: var(--wt-text);
}

/* =============================================================
   404 PAGE
   ============================================================= */
.wt-404-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 80px 24px;
	min-height: 60vh;
}

.wt-404-code {
	font-size: clamp(4rem, 12vw, 8rem);
	font-weight: 800;
	color: var(--wt-surface-border);
	line-height: 1;
	margin-bottom: 16px;
}

.wt-404-title {
	font-size: 1.6rem;
	margin-bottom: 12px;
}

.wt-404-text {
	color: var(--wt-text-muted);
	margin-bottom: 32px;
	max-width: 440px;
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media ( max-width: 768px ) {
	.wt-nav-toggle { display: flex; flex-direction: column; }

	.wt-header-nav {
		display: none;
	}

	.wt-header-nav.is-open {
		display: flex;
		position: absolute;
		top: var(--wt-header-height);
		left: 0;
		right: 0;
		background: var(--wt-header-bg);
		border-bottom: 1px solid var(--wt-header-border);
		padding: 12px 24px 16px;
		z-index: 99;
		box-shadow: var(--wt-shadow-md);
		animation: wt-fade-down .15s ease;
	}

	.wt-header-nav.is-open .wt-nav {
		flex-direction: column;
		align-items: flex-start;
		width: 100%;
		gap: 2px;
	}

	.wt-nav li { width: 100%; }
	.wt-nav li a { width: 100%; padding: 10px 14px; }

	.wt-header-actions .wt-header-user span,
	.wt-header-logout span {
		display: none;
	}

	.wt-footer-grid {
		grid-template-columns: 1fr;
		gap: 32px;
	}

	.wt-footer-bottom {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}

	.wt-back-to-top {
		bottom: 16px;
		right: 16px;
	}
}
