/*-------------------------------------------------------------------------*/
/* Header & Navigation Styles
/*-------------------------------------------------------------------------*/

/* =============================================================================
   HEADER & NAVBAR
   ============================================================================= */

/* Site Header */
.site-header {
	z-index: 1030;
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	transition: all 0.3s ease;
	border-bottom: 0.1rem solid var(--border);
	background-color: var(--bg-darker);
}

/* Navbar scrolled state */
.site-header.navbar-scrolled {
	box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
	background-color: rgba(14, 16, 22, 0.95);
}

/* Navbar */
.site-header .navbar {
	background-color: transparent;
	padding: 0.75rem 0;
	min-height: 70px;
}

/* Navbar Brand/Logo */
.navbar-brand {
	display: flex;
	align-items: center;
	margin-right: 0;
	padding: 0;
}

.navbar-brand img {
	filter: brightness(1);
	transition: all 0.3s ease;
}

.navbar-brand:hover img {
	filter: brightness(1.2) drop-shadow(0 0 8px rgba(255, 193, 7, 0.3));
}

/* Navigation Links */
.navbar-nav .nav-link {
	position: relative;
	transition: all 0.1s ease;
	margin: 0 0.25rem;
	padding: 0.75rem 1rem !important;
	color: var(--txt-secondary) !important;
	font-weight: 500;
	font-size: 0.95rem;
	font-family: 'Poppins', sans-serif;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

.navbar-nav .nav-link.active {
	color: var(--txt-primary) !important;
}

.navbar-nav .nav-link i {
	margin-right: 0.5rem;
	font-size: 0.9rem;
}

.navbar-dark .navbar-nav .nav-link:hover {
	border-radius: 0.1rem !important;
	background-color: var(--bg-dark) !important;
	color: var(--txt-primary) !important;
}

.nav-pills .nav-link:hover {
	border-radius: 0;
	background-color: var(--bg-darker) !important;
	color: #fff !important;
}

/* Dropdown Menus */
.navbar-nav .dropdown-menu {
	margin-top: 0;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
	border: 0.1rem solid var(--border);
	border-radius: 0;
	background-color: var(--bg-dark);
	padding: 0;
	min-width: 200px;
}

.navbar-nav .dropdown-item {
	transition: all 0.3s ease;
	border: none;
	padding: 0.75rem 1.5rem;
	color: var(--txt-secondary);
	font-weight: 500;
	font-size: 0.9rem;
	font-family: 'Poppins', sans-serif;
	text-transform: uppercase;
}

.navbar-nav .dropdown-item:hover {
	background-color: var(--bg-darker);
	color: var(--txt-primary);
}

.navbar-nav .dropdown-item i {
	margin-right: 0.75rem;
	width: 16px;
	text-align: center;
}

.dropdown-divider {
	margin: 0;
}

/* Dropdown Toggle Arrow */
.navbar-nav .dropdown-toggle::after {
	transition: transform 0.3s ease;
	margin-left: 0.5rem;
}

.navbar-nav .dropdown.show .dropdown-toggle::after {
	transform: rotate(180deg);
}

/* Remove focus outline from dropdown toggles */
.navbar-nav .dropdown-toggle:focus {
	outline: none;
	box-shadow: none;
}

/* User Authentication Section */
.navbar-auth {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

/* User Dropdown Styling - Match navbar dropdown appearance */
.navbar-auth .dropdown-menu {
	margin-top: 0;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
	border: 0.1rem solid var(--border);
	border-radius: 0;
	background-color: var(--bg-dark);
	padding: 0;
	min-width: 200px;
}

.navbar-auth .dropdown-item {
	transition: all 0.3s ease;
	border: none;
	padding: 0.75rem 1.5rem;
	color: var(--txt-secondary);
	font-weight: 500;
	font-size: 0.9rem;
	font-family: 'Poppins', sans-serif;
	text-transform: uppercase;
}

.navbar-auth .dropdown-item:hover {
	background-color: var(--bg-darker);
	color: var(--txt-primary);
}

.navbar-auth .dropdown-item i {
	margin-right: 0.75rem;
	width: 16px;
	color: #fff; /* Ensure all icons are white */
	text-align: center;
}

/* Hide dropdown arrow */
.navbar-auth .dropdown-toggle::after {
	display: none;
}

/* =============================================================================
   DESKTOP USER DROPDOWN
   ============================================================================= */
.navbar .user-avatar {
	border: 1px solid var(--bs-warning);
	border-radius: 0;
	aspect-ratio: 1 / 1;
	width: 3rem;
	height: 3rem;
	object-fit: contain;
}

.welcome-text {
	margin-bottom: 0.125rem;
	color: var(--txt-muted);
	font-size: 0.75rem;
	line-height: 1;
	font-family: 'Poppins', sans-serif;
}

.username {
	margin-bottom: 0.125rem;
	color: var(--txt-primary);
	font-weight: 600;
	font-size: 0.875rem;
	line-height: 1;
}

.user-points {
	font-size: 0.75rem;
	line-height: 1;
}

.dp-points {
	color: var(--txt-primary);
	font-weight: 500;
}

.vp-points {
	color: #ccc;
	font-weight: 500;
}

.user-points {
	color: var(--txt-muted);
	font-weight: 400;
	font-size: 0.85rem;
}

.nav-link {
	display: flex;
	padding: 0.5rem 1rem;
	color: #ccc;
	text-transform: uppercase;
}

/* Mobile Menu Toggle */
.navbar-toggler {
	border: 0.1rem solid var(--border);
	border-radius: 0.375rem;
	background-color: var(--bg-dark);
	padding: 0.5rem;
}

.navbar-toggler:focus {
	box-shadow: none;
}

.navbar-toggler-icon {
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23ffc107' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
	width: 1.5rem;
	height: 1.5rem;
}

.navbar-dark .navbar-toggler {
	color: #ccc;
}

.navbar-dark .navbar-toggler:hover {
	filter: saturate(0);
}

/* =============================================================================
   MOBILE NAVIGATION
   ============================================================================= */

/* Mobile Offcanvas - Full Screen */
.mobile-nav {
	transition: all 0.3s ease-in-out !important;
	border: none;
	background-color: var(--bg-darker);
	width: 100vw !important;
	max-width: none !important;
	/* Use full available viewport height */
	height: 100dvh !important;
	height: 100vh !important; /* Fallback for older browsers */
	/* Remove padding from container - handle in content */
	padding: 0;
	/* Ensure proper display */
	display: flex;
	flex-direction: column;
}

.mobile-nav .offcanvas-header {
	display: flex;
	position: relative;
	justify-content: space-between;
	align-items: center;
	z-index: 1;
	transition: all 0.3s ease-in-out;
	border-bottom: 0.1rem solid var(--border);
	background-color: var(--bg-dark);
	padding: 1rem;
	/* Ensure header height is flexible */
	min-height: 60px;
	flex-shrink: 0;
}

.mobile-nav .offcanvas-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	color: var(--txt-primary);
	font-weight: 600;
	font-size: 1.2rem;
	font-family: 'Poppins', sans-serif;
}

.mobile-nav .offcanvas-title img {
	width: auto;
	height: 24px;
}

.mobile-nav .offcanvas-body {
	display: flex;
	flex-direction: column;
	transition: all 0.3s ease-in-out;
	background-color: var(--bg-darker);
	padding: 1rem;
	/* Remove restrictive height - let content flow naturally */
	min-height: 0;
	max-height: none;
	height: auto;
	overflow-x: hidden;
	overflow-y: auto;
	/* Improve scrolling on mobile */
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	/* Take all available space */
	flex: 1 1 auto;
	/* Add bottom padding for safe areas and better UX */
	padding-bottom: calc(1rem + env(safe-area-inset-bottom, 20px));
}

/* Mobile User Section */
.mobile-user-section {
	margin: -1rem -1rem 1rem -1rem;
	border-bottom: 0.1rem solid var(--border);
	background-color: var(--bg-dark);
	padding: 1rem;
	/* Add safe area padding for better visual on notched devices */
	padding-left: max(1rem, env(safe-area-inset-left));
	padding-right: max(1rem, env(safe-area-inset-right));
}

.mobile-auth-section {
	margin: -1rem -1rem 1rem -1rem;
	border-bottom: 0.1rem solid var(--border);
	background-color: var(--bg-dark);
	padding: 1rem;
	/* Add safe area padding for better visual on notched devices */
	padding-left: max(1rem, env(safe-area-inset-left));
	padding-right: max(1rem, env(safe-area-inset-right));
}

.mobile-close-icon {
	display: flex;
	justify-content: center;
	align-items: center;
	opacity: 0.8;
	transition: opacity 0.3s ease;
	cursor: pointer;
	margin: 0;
	outline: none;
	border: none;
	background: none;
	padding: 0;
	color: white;
	font-size: 1.5rem;
}

.mobile-close-icon:hover {
	opacity: 1;
}

.mobile-close-icon i {
	color: white;
	font-size: 1.5rem;
}

.nav-pills .nav-link {
	border-radius: 0;
}

/* =============================================================================
   MOBILE USER SECTION
   ============================================================================= */
.mobile-user-avatar {
	border: 1px solid var(--bs-warning);
	border-radius: 0;
	aspect-ratio: 1 / 1;
	width: 3.5rem;
	height: 3.5rem;
	object-fit: contain;
}

/* Mobile User Info - Enhanced Layout */
.mobile-user-info {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1rem;
}

.mobile-avatar {
	flex-shrink: 0;
}

.mobile-user-details {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem;
}

.mobile-user-text {
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
}

.mobile-welcome-text {
	color: white;
	font-weight: 500;
	font-size: 0.75rem;
	line-height: 1;
	font-family: 'Poppins', sans-serif;
	text-transform: uppercase;
}

.mobile-username {
	color: var(--txt-primary);
	font-weight: 600;
	font-size: 0.875rem;
	line-height: 1;
	text-transform: uppercase;
}

.mobile-user-points {
	display: flex;
	gap: 0.5rem;
}

/* Points section with visual separation */
.mobile-dp-points,
.mobile-vp-points {
	border: 1px solid var(--border);
	border-radius: 0.25rem;
	background-color: var(--bg-darker);
	padding: 0.25rem 0.5rem;
	font-weight: 500;
	font-size: 0.75rem;
	text-transform: uppercase;
}

.mobile-dp-points {
	color: var(--txt-primary);
}

.mobile-vp-points {
	color: #ccc;
}

/* Mobile Auth Section */
.mobile-auth-section {
	border-bottom: 0.1rem solid var(--border);
	background-color: var(--bg-dark);
	padding: 1rem;
}

/* Mobile Menu */
.mobile-menu {
	flex-grow: 1;
	margin: 0;
	background-color: var(--bg-dark);
	padding: 0 0 1rem 0; /* Add bottom padding */
	overflow: visible; /* Allow dropdowns to expand */
	list-style: none;
	/* Ensure enough space for expanded content */
	min-height: min-content;
	/* Allow natural content flow */
	max-height: none;
}

.mobile-menu-item {
	border-bottom: 0.05rem solid var(--border);
}

.mobile-menu-link {
	display: block;
	transition: all 0.3s ease-in-out;
	padding: 0.8rem;
	color: var(--txt-secondary);
	font-weight: 500;
	font-size: 0.9rem;
	font-family: 'Poppins', sans-serif;
	text-decoration: none;
	text-transform: uppercase;
}

.mobile-menu-link:hover {
	background-color: var(--bg-dark);
	color: var(--txt-primary);
	text-decoration: none;
}

.mobile-menu-link.active {
	background-color: var(--bg-dark);
	color: var(--txt-primary);
}

.mobile-menu-link i {
	margin-right: 0.75rem;
	width: 18px;
	font-size: 0.85rem;
	text-align: center;
}

/* Mobile Dropdown - Real Icon Element */
.mobile-nav .mobile-dropdown .dropdown-toggle {
	display: flex;
	position: relative;
	justify-content: space-between;
	align-items: center;
	padding-right: 2.5rem !important;
}

/* Hide any default Bootstrap dropdown arrows */
.mobile-nav .mobile-dropdown .dropdown-toggle::after,
.mobile-nav .mobile-dropdown .dropdown-toggle::before {
	display: none !important;
}

/* Style the actual chevron icon */
.mobile-dropdown-icon {
	position: absolute !important;
	right: 1rem !important;
	transition: transform 0.3s ease !important;
	color: white !important;
	font-size: 0.8rem !important;
}

.mobile-nav .mobile-dropdown .dropdown-toggle[aria-expanded='true'] .mobile-dropdown-icon {
	transform: rotate(90deg) !important;
}

.mobile-submenu {
	transition: max-height 0.3s ease-in-out;
	margin: 0;
	background-color: var(--bg);
	padding: 0;
	max-height: 0;
	overflow: hidden;
	list-style: none;
}

.mobile-submenu.show {
	max-height: 1000px; /* Increased to accommodate more items */
	/* Ensure smooth scrolling when submenu opens */
	scroll-margin-top: 1rem;
}

.mobile-submenu-link {
	display: block;
	transition: all 0.3s ease;
	border-bottom: 0.05rem solid var(--border);
	padding: 0.625rem 1rem 0.625rem 2.5rem;
	color: var(--txt-muted);
	font-weight: 500;
	font-size: 0.9rem;
	font-family: 'Poppins', sans-serif;
	text-decoration: none;
	text-transform: uppercase;
}

.mobile-submenu-link:last-child {
	border-bottom: none;
}

.mobile-submenu-link:hover {
	background-color: var(--bg-dark);
	color: var(--txt-primary);
	text-decoration: none;
}

/* Mobile Social Section */
.mobile-social-section {
	margin-top: auto;
	border-top: 0.1rem solid var(--border);
	background-color: transparent;
	/* Add significant bottom padding to prevent cutoff */
	padding: 1.5rem 0 calc(2rem + env(safe-area-inset-bottom, 20px)) 0;
	/* Ensure it's never cut off */
	margin-bottom: 0;
	flex-shrink: 0;
}

.mobile-social-section h6 {
	color: var(--txt-primary);
	font-weight: 600;
	font-size: 1rem;
	letter-spacing: 0.5px;
	text-align: center;
	text-transform: uppercase;
}

.mobile-social-section .social-links {
	display: flex;
	justify-content: center;
	gap: 1rem;
}

.mobile-social-section a {
	transition: color 0.3s ease;
	padding: 0.5rem;
	color: var(--txt-muted);
	font-size: 1.1rem;
}

.mobile-social-section a:hover {
	color: var(--txt-primary);
	text-decoration: none;
}

/* =============================================================================
   RESPONSIVE STYLES
   ============================================================================= */

/* Mobile Responsiveness */
@media (max-width: 991.98px) {
	.site-header .navbar {
		padding: 0.5rem 0;
		min-height: 60px;
	}

	.navbar-brand img {
		height: 35px;
	}

	.navbar-auth {
		gap: 0.5rem;
	}

	/* Remove all restrictive height calculations for mobile menu */
	.mobile-nav .offcanvas-body {
		/* Let content flow naturally without height restrictions */
		height: auto !important;
		min-height: 0 !important;
		max-height: none !important;
		/* Ensure proper padding for all content */
		padding-bottom: calc(2rem + env(safe-area-inset-bottom, 30px)) !important;
	}

	/* Ensure menu items are touch-friendly */
	.mobile-menu-link {
		min-height: 48px; /* WCAG minimum touch target */
		display: flex;
		align-items: center;
	}

	.mobile-submenu-link {
		min-height: 44px; /* Slightly smaller for sub-items */
		display: flex;
		align-items: center;
	}

	/* Ensure social section is always visible */
	.mobile-social-section {
		padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 30px)) !important;
		margin-bottom: 0 !important;
	}
}

/* Small mobile devices */
@media (max-width: 575.98px) {
	.mobile-nav .offcanvas-body {
		padding: 0.75rem;
		/* Extra bottom padding for small screens */
		padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 40px)) !important;
	}

	.mobile-nav .offcanvas-header {
		padding: 0.75rem;
		min-height: 56px;
	}

	/* Ensure safe area is respected on small screens */
	.mobile-user-section,
	.mobile-auth-section {
		padding-left: max(0.75rem, env(safe-area-inset-left));
		padding-right: max(0.75rem, env(safe-area-inset-right));
	}

	/* Extra spacing for social section on small screens */
	.mobile-social-section {
		padding-bottom: calc(3rem + env(safe-area-inset-bottom, 40px)) !important;
	}
}

/* Very small screens (older iPhones, etc.) */
@media (max-width: 374px) {
	.mobile-nav .offcanvas-body {
		/* Maximum bottom padding for very small screens */
		padding-bottom: calc(3rem + env(safe-area-inset-bottom, 50px)) !important;
	}

	.mobile-social-section {
		padding-bottom: calc(3.5rem + env(safe-area-inset-bottom, 50px)) !important;
	}
}

/* Landscape orientation on mobile */
@media (max-width: 991.98px) and (orientation: landscape) {
	.mobile-nav .offcanvas-body {
		/* Less bottom padding in landscape due to limited height */
		padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 20px)) !important;
	}

	.mobile-nav .offcanvas-header {
		min-height: 50px;
		padding: 0.5rem 1rem;
	}

	.mobile-social-section {
		padding-bottom: calc(2rem + env(safe-area-inset-bottom, 20px)) !important;
	}
}

/* Tablet Styles */
@media (min-width: 768px) and (max-width: 991.98px) {
	.navbar-nav .nav-link {
		padding: 0.625rem 0.875rem !important;
		font-size: 0.9rem;
	}
}

/* Desktop Styles */
@media (min-width: 992px) {
	.site-header .navbar {
		padding: 1rem 0;
	}

	.navbar-brand img {
		height: 40px;
	}
}

/* Large Desktop */
@media (min-width: 1200px) {
	.navbar-nav .nav-link {
		padding: 0.75rem 1.25rem !important;
	}
}

/* =============================================================================
   ANIMATION OVERRIDES
   ============================================================================= */

/* Smooth Offcanvas Animation */
.offcanvas {
	transition: all 0.3s ease-in-out !important;
}

.offcanvas.offcanvas-fullscreen {
	top: 0 !important;
	left: 0 !important;
	transform: translateX(-100%) !important;
	width: 100vw !important;
	max-width: none !important;
	height: 100dvh !important;
	height: 100vh !important; /* Fallback */
}

.offcanvas.offcanvas-fullscreen.show {
	transform: translateX(0) !important;
}

.offcanvas.offcanvas-fullscreen.hiding {
	transform: translateX(-100%) !important;
}

/* Mobile submenu animations with scroll consideration */
.mobile-submenu {
	transition: max-height 0.3s ease-in-out;
	max-height: 0;
	overflow: hidden;
}

.mobile-submenu.show {
	max-height: 1000px;
	/* Ensure the parent container can scroll to show the expanded content */
	scroll-margin-top: 1rem;
	scroll-margin-bottom: 1rem;
}

/* Ensure smooth scrolling when submenu opens */
.mobile-menu-item:has(.mobile-submenu.show) {
	scroll-margin-top: 2rem;
}

/* Improve scroll behavior for the entire mobile menu */
.mobile-nav .offcanvas-body {
	scroll-behavior: smooth;
}

/* Add focus management for keyboard navigation */
.mobile-menu-link:focus,
.mobile-submenu-link:focus {
	outline: 2px solid var(--bs-warning);
	outline-offset: 2px;
	scroll-margin: 2rem;
}

/* Notification Bar */
.notice-bar {
	z-index: 1040;
	border-bottom: 0.1rem solid var(--border) !important;
	background-color: var(--bg-darker) !important;
}

.notice-bar h6 {
	color: var(--txt-primary);
	font-weight: 500;
	text-transform: none;
}

.notice-bar .close {
	transition: all 0.3s ease;
	color: var(--txt-primary);
	text-decoration: none;
}

.notice-bar .close:hover {
	color: var(--txt-secondary);
}

/* Bootstrap Offcanvas Override for Full Screen Mobile Nav */
.offcanvas.offcanvas-fullscreen {
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	visibility: visible !important;
	z-index: 1055 !important;
	border: none !important;
	border-radius: 0 !important;
	width: 100vw !important;
	max-width: none !important;
	/* Use full viewport height */
	height: 100dvh !important;
	height: 100vh !important; /* Fallback */
	max-height: none !important;
	/* Handle safe areas in padding */
	padding-top: env(safe-area-inset-top, 0) !important;
	padding-bottom: 0 !important; /* Handle in content */
	padding-left: env(safe-area-inset-left, 0) !important;
	padding-right: env(safe-area-inset-right, 0) !important;
	/* Ensure proper flex layout */
	display: flex !important;
	flex-direction: column !important;
	box-sizing: border-box !important;
}

/* Enhanced backdrop for full screen overlay */
.offcanvas-backdrop {
	z-index: 1050 !important;
	transition: opacity 0.3s ease-in-out !important;
	background-color: rgba(0, 0, 0, 0.8) !important;
}

/* Ensure all elements within offcanvas animate together */
.mobile-nav * {
	transition: all 0.3s ease-in-out !important;
}

/* Override Bootstrap's default animation timing */
.offcanvas {
	transition: transform 0.3s ease-in-out !important;
}

.offcanvas.show {
	transition: transform 0.3s ease-in-out !important;
}
