/**
 * ============================================================================
 * BAYROX TOPTAN — MOBILE APP NAVIGATION V2 (2027 Native App Experience)
 * Scoped strictly to mobile viewports (<= 768px).
 * Desktop Mega Menu is completely untouched and isolated.
 * ============================================================================
 */

:root {
	--bx-app-primary: #17395E;
	--bx-app-dark: #102A46;
	--bx-app-accent: #0788DF;
	--bx-app-accent-soft: #EAF5FF;
	--bx-app-bg: #F7F9FC;
	--bx-app-border: #E5EBF2;
	--bx-app-orange: #F97316;
	--bx-app-text: #1E293B;
	--bx-app-muted: #64748B;
	--bx-app-card: #FFFFFF;
}

/* ----------------------------------------------------------------------------
   DESKTOP SAFEGUARD: Never show the mobile app panel on screens > 768px
   ---------------------------------------------------------------------------- */
@media (min-width: 769px) {
	.bx-app-nav,
	.bx-app-backdrop {
		display: none !important;
		visibility: hidden !important;
	}
}

/* ----------------------------------------------------------------------------
   MOBILE APP NAVIGATION (<= 768px)
   ---------------------------------------------------------------------------- */
@media (max-width: 768px) {

	/* Hide the old legacy mobile drawer inside #bx-nav */
	.bx-drawer-head,
	.bx-drawer-search,
	.bx-mobile-subpanel,
	.bx-drawer-app-footer {
		display: none !important;
	}

	/* Prevent background scroll when app nav is open */
	body.bx-app-open {
		overflow: hidden !important;
		touch-action: none !important;
		overscroll-behavior: contain !important;
	}

	/* Hide mobile bottom dock & cookie banner while menu is open (Section 1 & 10) */
	body.bx-app-open [data-bx-dock],
	body.bx-app-open .bx-tab-dock,
	body.bx-app-open .bx-tab-sheet,
	body.bx-app-open .bx-cookie-banner,
	body.bx-app-open .cookie {
		transform: translateY(100%) !important;
		opacity: 0 !important;
		pointer-events: none !important;
		visibility: hidden !important;
		display: none !important;
		transition: transform 0.22s ease, opacity 0.22s ease !important;
	}

	/* Backdrop */
	.bx-app-backdrop {
		position: fixed;
		inset: 0;
		background: rgba(16, 42, 70, 0.48);
		backdrop-filter: blur(2px);
		-webkit-backdrop-filter: blur(2px);
		z-index: 2147483640 !important;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.26s ease;
	}
	body.bx-app-open .bx-app-backdrop {
		opacity: 1;
		pointer-events: auto;
	}

	/* Panel Shell: Slides from left, full width, 100dvh (Section 1) */
	.bx-app-nav {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: 100vw;
		max-width: 100%;
		height: 100vh;
		height: 100dvh;
		background: #ffffff;
		z-index: 2147483647 !important;
		display: flex;
		flex-direction: column;
		overflow: hidden;
		box-sizing: border-box;
		transform: translateX(-100%);
		transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
		visibility: hidden;
		box-shadow: 18px 0 48px rgba(16, 42, 70, 0.24);
	}

	.bx-app-nav.is-open,
	body.bx-app-open .bx-app-nav {
		transform: translateX(0);
		visibility: visible;
	}

	/* ------------------------------------------------------------------------
	   2. ÜST BAŞLIK (Fixed Header ~72px, safe-area-inset-top)
	   ------------------------------------------------------------------------ */
	.bx-app-head {
		height: 72px;
		min-height: 72px;
		padding: max(12px, env(safe-area-inset-top, 12px)) 16px 12px;
		background: #ffffff;
		border-bottom: 1px solid var(--bx-app-border);
		display: flex;
		align-items: center;
		justify-content: space-between;
		flex-shrink: 0;
		box-sizing: border-box;
		z-index: 20;
	}

	.bx-app-brand {
		display: flex;
		flex-direction: column;
		justify-content: center;
		gap: 2px;
	}

	.bx-app-logo {
		height: 26px;
		width: auto;
		max-width: 140px;
		object-fit: contain;
		display: block;
	}

	.bx-app-subtitle {
		font-size: 11px;
		font-weight: 600;
		color: var(--bx-app-accent);
		letter-spacing: 0.05em;
		text-transform: uppercase;
		line-height: 1;
	}

	.bx-app-close {
		width: 44px;
		height: 44px;
		min-width: 44px;
		border-radius: 50%;
		background: #F1F5F9;
		border: 0;
		padding: 0;
		margin: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		color: var(--bx-app-primary);
		cursor: pointer;
		transition: background-color 0.15s ease, transform 0.12s ease;
		-webkit-tap-highlight-color: transparent;
	}

	.bx-app-close:active {
		background: #E2E8F0;
		transform: scale(0.94);
	}

	/* ------------------------------------------------------------------------
	   3. ARAMA ALANI (Tam genişlikte, 48-52px, 14px radius, filtreleme)
	   ------------------------------------------------------------------------ */
	.bx-app-search-wrap {
		padding: 10px 16px 12px;
		background: #ffffff;
		border-bottom: 1px solid var(--bx-app-border);
		flex-shrink: 0;
		box-sizing: border-box;
		z-index: 15;
	}

	.bx-app-search-box {
		width: 100%;
		height: 50px;
		border-radius: 14px;
		background: var(--bx-app-bg);
		border: 1.5px solid var(--bx-app-border);
		display: flex;
		align-items: center;
		padding: 0 14px;
		gap: 10px;
		box-sizing: border-box;
		transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
	}

	.bx-app-search-box:focus-within {
		border-color: var(--bx-app-accent);
		background: #ffffff;
		box-shadow: 0 0 0 3px rgba(7, 136, 223, 0.12);
	}

	.bx-app-search-ico {
		color: #94A3B8;
		flex-shrink: 0;
	}

	.bx-app-search-input {
		flex: 1;
		width: 100%;
		height: 100%;
		border: 0;
		background: transparent;
		padding: 0;
		margin: 0;
		font-family: inherit;
		font-size: 14.5px;
		font-weight: 500;
		color: var(--bx-app-text);
		outline: none;
		box-shadow: none;
		-webkit-appearance: none;
	}

	.bx-app-search-input::placeholder {
		color: #94A3B8;
		font-weight: 400;
	}

	.bx-app-search-clear {
		width: 28px;
		height: 28px;
		border-radius: 50%;
		background: #E2E8F0;
		border: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #475569;
		cursor: pointer;
		padding: 0;
		margin: 0;
		flex-shrink: 0;
	}

	.bx-app-search-clear[hidden] {
		display: none !important;
	}

	/* ------------------------------------------------------------------------
	   VIEWPORT & SLIDING SCREENS (Section 1 & 5)
	   ------------------------------------------------------------------------ */
	.bx-app-viewport {
		flex: 1 1 auto;
		position: relative;
		overflow: hidden;
		background: #ffffff;
		width: 100%;
	}

	.bx-app-deck {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
	}

	.bx-app-screen {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		-webkit-overflow-scrolling: touch;
		background: #ffffff;
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		padding-bottom: max(24px, env(safe-area-inset-bottom, 20px));
		transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
	}

	/* Screen 1 (Root): Sits at 0, shifts slightly left when sub is active */
	.bx-app-screen-root {
		transform: translateX(0);
		z-index: 1;
		opacity: 1;
		pointer-events: auto;
	}

	.bx-app-screen-root.is-pushed {
		transform: translateX(-24%);
		opacity: 0.55;
		pointer-events: none;
	}

	/* Screen 2 (Subcategory Screen): Slides in from right */
	.bx-app-screen-sub {
		transform: translateX(100%);
		z-index: 2;
		opacity: 0;
		pointer-events: none;
		background: #ffffff;
	}

	.bx-app-screen-sub.is-active {
		transform: translateX(0);
		opacity: 1;
		pointer-events: auto;
	}

	/* ------------------------------------------------------------------------
	   6. KAMPANYALAR (Kompakt Vurgulu Bağlantı)
	   ------------------------------------------------------------------------ */
	.bx-app-campaign {
		display: flex;
		align-items: center;
		gap: 12px;
		margin: 12px 16px 8px;
		padding: 12px 14px;
		border-radius: 14px;
		background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
		border: 1px solid #FED7AA;
		text-decoration: none !important;
		transition: transform 0.15s ease, box-shadow 0.15s ease;
		flex-shrink: 0;
	}

	.bx-app-campaign:active {
		transform: scale(0.98);
		background: #FFEDD5;
	}

	.bx-app-campaign-badge {
		width: 36px;
		height: 36px;
		min-width: 36px;
		border-radius: 10px;
		background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
		color: #ffffff;
		display: flex;
		align-items: center;
		justify-content: center;
		box-shadow: 0 4px 10px rgba(249, 115, 22, 0.28);
	}

	.bx-app-campaign-info {
		flex: 1;
		min-width: 0;
		display: flex;
		flex-direction: column;
		gap: 1px;
	}

	.bx-app-campaign-title {
		font-size: 13.5px;
		font-weight: 700;
		color: #9A3412;
		line-height: 1.25;
	}

	.bx-app-campaign-sub {
		font-size: 11.5px;
		font-weight: 500;
		color: #C2410C;
	}

	/* ------------------------------------------------------------------------
	   SECTION LABELS
	   ------------------------------------------------------------------------ */
	.bx-app-section-label {
		padding: 14px 16px 6px;
		font-size: 11px;
		font-weight: 700;
		color: #94A3B8;
		letter-spacing: 0.06em;
		text-transform: uppercase;
		flex-shrink: 0;
	}

	/* ------------------------------------------------------------------------
	   4. KATEGORİ LİSTESİ (Min 68px, 46x46 görsel, metin 2 satıra sarabilir)
	   ------------------------------------------------------------------------ */
	.bx-app-list {
		list-style: none !important;
		margin: 0 !important;
		padding: 0 !important;
		display: flex;
		flex-direction: column;
		flex: 1 0 auto;
	}

	.bx-app-item {
		width: 100%;
		min-height: 68px;
		padding: 10px 16px;
		display: flex;
		align-items: center;
		gap: 14px;
		border-bottom: 1px solid var(--bx-app-border);
		background: #ffffff;
		text-decoration: none !important;
		box-sizing: border-box;
		cursor: pointer;
		user-select: none;
		-webkit-tap-highlight-color: transparent;
		transition: background-color 0.12s ease;
	}

	.bx-app-item:active {
		background-color: #F8FAFC;
	}

	.bx-app-thumb {
		width: 46px;
		height: 46px;
		min-width: 46px;
		border-radius: 12px;
		background: #F8FAFC;
		border: 1px solid #E2E8F0;
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 3px;
		box-sizing: border-box;
		overflow: hidden;
		flex-shrink: 0;
	}

	.bx-app-thumb.is-icon-badge {
		background: linear-gradient(135deg, #17395E 0%, #0A4373 100%) !important;
		border-color: #17395E !important;
		box-shadow: 0 4px 10px rgba(23, 57, 94, 0.18) !important;
		padding: 9px !important;
	}

	.bx-app-thumb.is-icon-badge img {
		filter: brightness(0) invert(1) !important;
	}

	.bx-app-thumb img {
		width: 100%;
		height: 100%;
		object-fit: contain;
		display: block;
		border-radius: 8px;
	}

	.bx-app-thumb-glyph {
		width: 24px;
		height: 24px;
		color: var(--bx-app-primary);
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.bx-app-name {
		flex: 1;
		min-width: 0;
		font-size: 14.5px;
		font-weight: 600;
		color: var(--bx-app-text);
		line-height: 1.35;
		word-break: break-word;
		/* Asla kesilmesin, 2 satıra sarabilsin */
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.bx-app-count {
		font-size: 11.5px;
		font-weight: 600;
		color: #94A3B8;
		background: #F1F5F9;
		padding: 3px 8px;
		border-radius: 12px;
		margin-right: -4px;
	}

	.bx-app-chevron {
		color: #94A3B8;
		flex-shrink: 0;
		transition: transform 0.15s ease, color 0.15s ease;
	}

	.bx-app-item:active .bx-app-chevron {
		color: var(--bx-app-accent);
		transform: translateX(2px);
	}

	/* ------------------------------------------------------------------------
	   5. SUB-CATEGORY SCREEN (Drill-Down / Back Button / Hero Card)
	   ------------------------------------------------------------------------ */
	.bx-app-sub-topbar {
		padding: 10px 16px;
		background: #ffffff;
		border-bottom: 1px solid var(--bx-app-border);
		position: sticky;
		top: 0;
		z-index: 10;
		display: flex;
		align-items: center;
		flex-shrink: 0;
	}

	.bx-app-back-btn {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		height: 40px;
		padding: 0 16px 0 12px;
		border-radius: 20px;
		background: #F1F5F9;
		border: 0;
		color: var(--bx-app-primary);
		font-family: inherit;
		font-size: 13.5px;
		font-weight: 700;
		cursor: pointer;
		transition: background-color 0.15s ease, transform 0.12s ease;
		-webkit-tap-highlight-color: transparent;
	}

	.bx-app-back-btn:active {
		background: #E2E8F0;
		transform: scale(0.96);
	}

	.bx-app-back-btn svg {
		color: var(--bx-app-accent);
		flex-shrink: 0;
	}

	.bx-app-back-text {
		max-width: 220px;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.bx-app-sub-hero {
		padding: 16px;
		background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
		border-bottom: 1px solid var(--bx-app-border);
		display: flex;
		flex-direction: column;
		gap: 12px;
		flex-shrink: 0;
	}

	.bx-app-sub-title-row {
		display: flex;
		align-items: center;
		gap: 12px;
	}

	.bx-app-sub-hero-img {
		width: 44px;
		height: 44px;
		border-radius: 10px;
		background: #ffffff;
		border: 1px solid #E2E8F0;
		object-fit: contain;
		padding: 3px;
	}

	.bx-app-sub-hero-img[hidden] {
		display: none !important;
	}

	.bx-app-sub-badge {
		font-size: 10.5px;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.05em;
		color: var(--bx-app-accent);
		display: block;
		margin-bottom: 2px;
	}

	.bx-app-sub-title {
		margin: 0;
		font-size: 17px;
		font-weight: 800;
		color: var(--bx-app-primary);
		line-height: 1.25;
		word-break: break-word;
	}

	/* "Tüm [Kategori] Ürünleri" link (Section 5) */
	.bx-app-all-link {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 13px 16px;
		border-radius: 12px;
		background: linear-gradient(135deg, #0788DF 0%, #0570B8 100%);
		color: #ffffff !important;
		font-size: 14px;
		font-weight: 700;
		text-decoration: none !important;
		box-shadow: 0 4px 14px rgba(7, 136, 223, 0.28);
		transition: transform 0.12s ease, box-shadow 0.12s ease;
	}

	.bx-app-all-link:active {
		transform: translateY(1px);
		box-shadow: 0 2px 8px rgba(7, 136, 223, 0.22);
	}

	/* ------------------------------------------------------------------------
	   EMPTY STATE
	   ------------------------------------------------------------------------ */
	.bx-app-empty {
		padding: 40px 24px;
		text-align: center;
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 8px;
	}

	.bx-app-empty[hidden] {
		display: none !important;
	}

	.bx-app-empty-icon {
		font-size: 36px;
		margin-bottom: 4px;
	}

	.bx-app-empty-title {
		font-size: 15px;
		font-weight: 700;
		color: var(--bx-app-primary);
	}

	.bx-app-empty-desc {
		font-size: 13px;
		color: var(--bx-app-muted);
		margin: 0 0 10px;
	}

	.bx-app-empty-btn {
		height: 38px;
		padding: 0 16px;
		border-radius: 19px;
		background: #EAF5FF;
		border: 1px solid #BAE0FD;
		color: var(--bx-app-accent);
		font-family: inherit;
		font-size: 13px;
		font-weight: 700;
		cursor: pointer;
	}

	/* ------------------------------------------------------------------------
	   7. ALT HESAP VE YARDIMCI ALANI (Kompakt, 48px satırlar)
	   ------------------------------------------------------------------------ */
	.bx-app-footer-nav {
		margin: 20px 16px 28px;
		border-radius: 16px;
		background: var(--bx-app-bg);
		border: 1px solid var(--bx-app-border);
		overflow: hidden;
		flex-shrink: 0;
	}

	.bx-app-footer-link {
		width: 100%;
		min-height: 48px;
		padding: 10px 14px;
		display: flex;
		align-items: center;
		gap: 12px;
		border-bottom: 1px solid var(--bx-app-border);
		text-decoration: none !important;
		color: #334155 !important;
		font-size: 13.5px;
		font-weight: 600;
		box-sizing: border-box;
		transition: background-color 0.12s ease;
	}

	.bx-app-footer-link:last-child {
		border-bottom: 0;
	}

	.bx-app-footer-link:active {
		background: #E2E8F0;
	}

	.bx-app-foot-ico {
		width: 32px;
		height: 32px;
		border-radius: 8px;
		background: #ffffff;
		border: 1px solid #E2E8F0;
		display: flex;
		align-items: center;
		justify-content: center;
		color: var(--bx-app-accent);
		flex-shrink: 0;
	}

	.bx-app-foot-ico svg {
		width: 18px;
		height: 18px;
	}

	.bx-app-foot-title {
		flex: 1;
		min-width: 0;
	}

	.bx-app-foot-val {
		font-size: 12.5px;
		font-weight: 700;
		color: var(--bx-app-accent);
		margin-left: auto;
	}
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
	.bx-app-nav,
	.bx-app-backdrop,
	.bx-app-screen,
	.bx-app-close,
	.bx-app-campaign,
	.bx-app-all-link {
		transition: none !important;
	}
}
