/**
 * Header Styles for Errand Theme
 */

/* =============================================================================
   Header Layout
   ============================================================================= */

.site-header {
	background: #ffffff;
	border-bottom: 1px solid #e1e5e9;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	position: sticky;
	top: 0;
	z-index: 999;
	transition: all 0.3s ease;
}

/* Header Scroll Effects */
.site-header.header-scrolled {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(10px);
}

.site-header.header-hidden {
	transform: translateY(-100%);
}

.site-header .container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
}

.header-content {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 2rem;
	min-height: 70px;
	padding: 20px 0;
}

/* =============================================================================
   Logo Column
   ============================================================================= */

.header-logo {
	display: flex;
	align-items: center;
}

.header-logo-link {
	display: inline-block;
	text-decoration: none;
	transition: opacity 0.3s ease;
}

.header-logo-link:hover {
	opacity: 0.8;
}

.header-logo-image {
	max-height: 50px;
	width: auto;
	display: block;
	transition: transform 0.3s ease;
}

.header-logo-link:hover .header-logo-image {
	transform: scale(1.05);
}

/* Site Title Fallback */
.site-branding .site-title {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.2;
}

.site-branding .site-title a {
	color: #2c3e50;
	text-decoration: none;
	transition: color 0.3s ease;
}

.site-branding .site-title a:hover {
	color: #0073aa;
}

/* =============================================================================
   Navigation Column
   ============================================================================= */

.header-navigation {
	display: flex;
	justify-content: center;
}

.main-navigation {
	position: relative;
}

.menu-toggle {
	display: none;
	background: none;
	border: none;
	padding: 0.5rem;
	cursor: pointer;
	border-radius: 4px;
	transition: background-color 0.3s ease;
}

.menu-toggle:hover,
.menu-toggle:focus {
	background-color: #f8f9fa;
}

.menu-toggle-icon {
	display: block;
	width: 24px;
	height: 18px;
	position: relative;
}

.menu-toggle-icon::before,
.menu-toggle-icon::after,
.menu-toggle-icon {
	background: #333;
	height: 2px;
	border-radius: 1px;
	transition: all 0.3s ease;
}

.menu-toggle-icon::before,
.menu-toggle-icon::after {
	content: '';
	position: absolute;
	left: 0;
	width: 100%;
}

.menu-toggle-icon::before {
	top: -6px;
}

.menu-toggle-icon::after {
	bottom: -6px;
}

/* Primary Menu */
.primary-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.primary-menu li {
	position: relative;
}

.primary-menu a {
	display: block;
	padding: 0.75rem 1rem;
	color: #4a5568;
	text-decoration: none;
	font-weight: 500;
	font-size: 0.95rem;
	border-radius: 6px;
	transition: all 0.3s ease;
	position: relative;
}

.primary-menu a:hover,
.primary-menu a:focus {
	color: #0073aa;
	background-color: #f7fafc;
	transform: translateY(-1px);
}

.primary-menu .current-menu-item > a,
.primary-menu .current-menu-ancestor > a {
	color: #0073aa;
	background-color: #e3f2fd;
}

/* Dropdown Menus */
.primary-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	background: #ffffff;
	border: 1px solid #e1e5e9;
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
	min-width: 200px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px);
	transition: all 0.3s ease;
	z-index: 1000;
}

.primary-menu li:hover > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.primary-menu .sub-menu a {
	padding: 0.75rem 1.25rem;
	border-radius: 0;
	font-size: 0.9rem;
}

.primary-menu .sub-menu a:hover {
	background-color: #f8f9fa;
	transform: none;
}

/* =============================================================================
   User Status Column
   ============================================================================= */

.header-user-status {
	display: flex;
	justify-content: flex-end;
	align-items: center;
}

/* Not Logged In State */
.user-not-logged-in {
	display: flex;
	align-items: center;
	padding: 8px 16px;
	background: #e8f4f8;
	border-radius: 25px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
	transition: all 0.3s ease;
	height: auto;
	min-height: 36px;
	box-sizing: border-box;
}

.user-not-logged-in:hover {
	background: #d6edf5;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
	transform: translateY(-1px);
}

.login-link,
.register-link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 4px 8px;
	color: #4a5568 !important;
	text-decoration: none !important;
	font-weight: 500;
	font-size: 0.9rem;
	border-radius: 15px;
	transition: all 0.3s ease;
	position: relative;
	height: auto;
	overflow: hidden;
}

.login-link::before,
.register-link::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
	transition: left 0.5s ease;
}

.login-link:hover::before,
.register-link:hover::before {
	left: 100%;
}

.login-link:hover,
.register-link:hover {
	color: #2c5aa0 !important;
	background-color: rgba(255, 255, 255, 0.7);
	transform: translateY(-1px);
}

.login-link:hover .login-icon,
.register-link:hover .register-icon {
	transform: scale(1.1);
}

.login-icon,
.register-icon {
	display: inline-flex;
	align-items: center;
	font-size: 1em;
	transition: transform 0.3s ease;
}

.separator {
	color: #94a3b8;
	font-weight: 300;
	margin: 0 4px;
	font-size: 0.85rem;
}

/* Logged In State */
.user-logged-in {
	position: relative;
}

.user-center-link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 8px 16px;
	background: #e8f4f8;
	color: #4a5568 !important;
	text-decoration: none !important;
	font-weight: 500;
	font-size: 0.9rem;
	border-radius: 25px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
	transition: all 0.3s ease;
	position: relative;
	overflow: hidden;
	height: auto;
	min-height: 36px;
	box-sizing: border-box;
}

.user-center-link::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
	transition: left 0.5s ease;
}

.user-center-link:hover::before {
	left: 100%;
}

.user-center-link:hover {
	transform: translateY(-1px);
	background: #d6edf5;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
	color: #2c5aa0 !important;
}

.user-center-icon {
	display: inline-flex;
	align-items: center;
	font-size: 1em;
	transition: transform 0.3s ease;
}

.user-center-link:hover .user-center-icon {
	transform: scale(1.1) rotate(5deg);
}

/* User Dropdown Menu */
.user-dropdown {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(-10px);
	background: #ffffff;
	border: 1px solid #e1e5e9;
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
	min-width: 180px;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
	z-index: 1000;
	margin-top: 0.5rem;
}

.user-logged-in:hover .user-dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

.user-menu {
	list-style: none;
	margin: 0;
	padding: 0.5rem 0;
}

.user-menu li {
	border-bottom: 1px solid #f1f3f4;
}

.user-menu li:last-child {
	border-bottom: none;
}

.user-menu a {
	display: block;
	padding: 0.75rem 1.25rem;
	color: #4a5568;
	text-decoration: none;
	font-size: 0.9rem;
	transition: all 0.3s ease;
}

.user-menu a:hover {
	background-color: #f8f9fa;
	color: #0073aa;
}

/* =============================================================================
   Responsive Design
   ============================================================================= */

/* Tablet */
@media (max-width: 1024px) {
	.header-content {
		grid-template-columns: auto 1fr auto;
		gap: 1.5rem;
		padding: 15px 0;
	}

	.primary-menu {
		gap: 0.25rem;
	}

	.primary-menu a {
		padding: 0.65rem 0.8rem;
		font-size: 0.9rem;
	}
}

/* Mobile */
@media (max-width: 768px) {
	.site-header .container {
		padding: 0 15px;
	}

	.header-content {
		grid-template-columns: 1fr auto;
		gap: 1rem;
		min-height: 60px;
	}

	.header-navigation {
		order: 3;
		grid-column: 1 / -1;
		justify-content: flex-start;
		margin-top: 1rem;
		border-top: 1px solid #f1f3f4;
		padding-top: 1rem;
	}

	.menu-toggle {
		display: block;
		order: 2;
	}

	.primary-menu {
		display: none;
		flex-direction: column;
		width: 100%;
		gap: 0;
		background: #ffffff;
		border: 1px solid #e1e5e9;
		border-radius: 8px;
		padding: 0.5rem 0;
		margin-top: 0.5rem;
	}

	.primary-menu.toggled {
		display: flex;
	}

	.primary-menu li {
		width: 100%;
		border-bottom: 1px solid #f1f3f4;
	}

	.primary-menu li:last-child {
		border-bottom: none;
	}

	.primary-menu a {
		padding: 0.75rem 1.25rem;
		border-radius: 0;
		width: 100%;
	}

	.primary-menu .sub-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		border: none;
		border-radius: 0;
		background: #f8f9fa;
		margin-left: 1rem;
	}

	.user-not-logged-in {
		flex-wrap: wrap;
		gap: 0.25rem;
		padding: 6px 12px;
		background: #e8f4f8;
		border-radius: 20px;
		box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
		min-height: 32px;
	}

	.user-not-logged-in:hover {
		background: #d6edf5;
		box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
	}

	.login-link,
	.register-link {
		padding: 3px 6px;
		font-size: 0.85rem;
		border-radius: 12px;
		color: #4a5568 !important;
		text-decoration: none !important;
	}

	.login-link:hover,
	.register-link:hover {
		background-color: rgba(255, 255, 255, 0.7);
		color: #2c5aa0 !important;
	}

	.user-center-link {
		padding: 6px 12px;
		font-size: 0.85rem;
		background: #e8f4f8;
		border-radius: 20px;
		box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
		min-height: 32px;
		color: #4a5568 !important;
		text-decoration: none !important;
		box-sizing: border-box;
	}

	.user-center-link:hover {
		background: #d6edf5;
		box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
		color: #2c5aa0 !important;
	}

	.separator {
		display: none;
	}
}

/* Small Mobile */
@media (max-width: 480px) {
	.header-content {
		gap: 0.75rem;
		min-height: 55px;
	}

	.header-logo-image {
		max-height: 40px;
	}

	.site-branding .site-title {
		font-size: 1.25rem;
	}

	.user-not-logged-in {
		flex-direction: column;
		align-items: flex-end;
		gap: 0.2rem;
		padding: 5px 10px;
		background: #e8f4f8;
		border-radius: 18px;
		box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
		min-height: 28px;
	}

	.user-not-logged-in:hover {
		background: #d6edf5;
		box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
	}

	.login-link,
	.register-link {
		padding: 2px 5px;
		font-size: 0.8rem;
		border-radius: 10px;
		color: #4a5568 !important;
		text-decoration: none !important;
	}

	.login-link:hover,
	.register-link:hover {
		background-color: rgba(255, 255, 255, 0.7);
		color: #2c5aa0 !important;
	}

	.user-center-link {
		padding: 5px 10px;
		font-size: 0.8rem;
		background: #e8f4f8;
		border-radius: 18px;
		box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
		min-height: 28px;
		color: #4a5568 !important;
		text-decoration: none !important;
		box-sizing: border-box;
	}

	.user-center-link:hover {
		background: #d6edf5;
		box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
		color: #2c5aa0 !important;
	}
}

/* =============================================================================
   Accessibility
   ============================================================================= */

.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	position: absolute !important;
	height: 1px;
	width: 1px;
	overflow: hidden;
}

.screen-reader-text:focus {
	background-color: #f1f1f1;
	border-radius: 3px;
	box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
	clip: auto !important;
	color: #21759b;
	display: block;
	font-size: 14px;
	font-size: 0.875rem;
	font-weight: bold;
	height: auto;
	left: 5px;
	line-height: normal;
	padding: 15px 23px 14px;
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 100000;
}

/* Focus Styles */
.login-link:focus,
.register-link:focus,
.user-center-link:focus,
.header-logo-link:focus,
.primary-menu a:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
	.site-header {
		border-bottom: 2px solid #000;
	}

	.primary-menu a,
	.login-link,
	.register-link {
		border: 1px solid #000;
	}

	.user-center-link,
	.user-not-logged-in {
		background: #000;
		border: 2px solid #000;
		color: #fff;
	}

	.user-not-logged-in .login-link,
	.user-not-logged-in .register-link {
		color: #fff;
	}
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
	.header-logo-image,
	.login-icon,
	.user-center-icon,
	.primary-menu a,
	.login-link,
	.register-link,
	.user-center-link,
	.user-dropdown,
	.primary-menu .sub-menu {
		transition: none;
	}
}

/* =============================================================================
   Dark Mode Support (Future)
   ============================================================================= */

@media (prefers-color-scheme: dark) {
	.site-header {
		background: #1a202c;
		border-bottom-color: #2d3748;
	}

	.site-branding .site-title a {
		color: #e2e8f0;
	}

	.primary-menu a {
		color: #cbd5e0;
	}

	.primary-menu a:hover {
		color: #63b3ed;
		background-color: #2d3748;
	}

	.login-link,
	.register-link {
		color: #cbd5e0;
	}

	.login-link:hover,
	.register-link:hover {
		color: #63b3ed;
		background-color: #2d3748;
	}

	.user-not-logged-in {
		background: #2d3748;
		border-color: #4a5568;
	}

	.user-not-logged-in:hover {
		background: #4a5568;
	}

	.user-center-link {
		background: #2d3748;
		border-color: #4a5568;
		color: #cbd5e0;
	}

	.user-center-link:hover {
		background: #4a5568;
		color: #63b3ed;
	}

	.primary-menu .sub-menu,
	.user-dropdown {
		background: #2d3748;
		border-color: #4a5568;
	}
}