/* ==========================================================================
   pos_bridge.css — POS Awesome UI styling & UCM Category Card Grid
   ========================================================================== */

/* 1. Desktop Responsive Column Proportions */
@media (min-width: 1100px) {
	.dynamic-col--selector {
		flex: 0 0 54% !important;
		max-width: 54% !important;
	}
	.dynamic-col--invoice {
		flex: 0 0 46% !important;
		max-width: 46% !important;
	}
}

/* 2. Cart Table Text Wrapping & Smooth Scrolling */
.dynamic-col--invoice .v-table__wrapper,
.dynamic-col--invoice .items-table .v-table__wrapper,
.posa-cart-table .v-table__wrapper {
	overflow-y: auto !important;
	overflow-x: auto !important;
	max-width: 100% !important;
	width: 100% !important;
	box-sizing: border-box !important;
	scrollbar-width: thin !important;
	overscroll-behavior-y: contain !important;
}

.dynamic-col--invoice td[data-column-key='item_name'],
.dynamic-col--invoice td:first-child,
.items-table td[data-column-key='item_name'],
.posa-cart-table td[data-column-key='item_name'] {
	white-space: normal !important;
	word-break: break-word !important;
	overflow-wrap: anywhere !important;
	min-width: 0 !important;
}

.posa-cart-table th,
.posa-cart-table td,
.items-table th,
.items-table td {
	padding: 4px 4px !important;
	box-sizing: border-box !important;
}

/* Attached Dish Add-on Row with Tree Arrow */
.posa-cart-addon-row {
	background-color: rgba(var(--v-theme-primary, 25, 118, 210), 0.04) !important;
	border-left: 3.5px solid var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210))) !important;
}

.posa-cart-addon-row td[data-column-key='item_name'] .d-flex,
.posa-cart-addon-row td[data-column-key='item_name'],
.posa-cart-addon-row td:first-child .d-flex,
.posa-cart-addon-row td:first-child {
	padding-left: 18px !important;
	font-size: 0.85rem !important;
	color: var(--pos-text-secondary, #4b5563) !important;
}

.posa-addon-tree-symbol {
	color: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210))) !important;
	font-weight: 900 !important;
	font-size: 1.15rem !important;
	line-height: 1 !important;
	margin-right: 6px !important;
	flex-shrink: 0 !important;
	display: inline-block !important;
	vertical-align: middle !important;
}

.posa-cart-table .posa-cart-table__qty-counter,
.items-table .posa-cart-table__qty-counter {
	min-width: 0 !important;
	max-width: 88px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 2px !important;
}

.posa-cart-table .posa-cart-table__qty-display,
.items-table .posa-cart-table__qty-display {
	min-width: 24px !important;
	max-width: 36px !important;
	height: 22px !important;
	font-size: 0.75rem !important;
	padding: 0 2px !important;
	text-align: center !important;
}

.posa-cart-table .qty-control-btn,
.items-table .qty-control-btn {
	width: 20px !important;
	height: 20px !important;
	min-width: 20px !important;
	padding: 0 !important;
}

.posa-cart-table td[data-column-key='rate'],
.posa-cart-table td[data-column-key='amount'],
.items-table td[data-column-key='rate'],
.items-table td[data-column-key='amount'] {
	white-space: nowrap !important;
	font-size: 0.85rem !important;
	padding: 4px 2px !important;
	text-align: right !important;
}

.posa-cart-table td[data-column-key='actions'],
.items-table td[data-column-key='actions'] {
	width: 32px !important;
	min-width: 32px !important;
	max-width: 36px !important;
	padding: 0 2px !important;
	text-align: center !important;
}

.posa-cart-table td[data-column-key='actions'] .v-btn,
.items-table td[data-column-key='actions'] .v-btn,
.dynamic-col--invoice .v-btn--icon {
	width: 24px !important;
	height: 24px !important;
	min-width: 24px !important;
	padding: 0 !important;
}

/* 3. Toggle buttons overrides */
.ucm-view-toggle-btn {
	transition: background-color .15s, color .15s, opacity .15s !important;
}

.view-toggle-btn button.ucm-view-toggle-btn--active,
.view-toggle-btn.ucm-mode-active button.ucm-view-toggle-btn,
[data-theme='dark'] .view-toggle-btn.ucm-mode-active button.ucm-view-toggle-btn {
	background: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210))) !important;
	background-color: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210))) !important;
	color: #fff !important;
	opacity: 1 !important;
}

.view-toggle-btn button.ucm-view-toggle-btn--active .v-btn__content,
.view-toggle-btn.ucm-mode-active button.ucm-view-toggle-btn .v-btn__content {
	color: #fff !important;
}

.view-toggle-btn button.ucm-view-toggle-btn--active .v-btn__overlay,
.view-toggle-btn.ucm-mode-active button.ucm-view-toggle-btn .v-btn__overlay {
	opacity: 0.15 !important;
}

.view-toggle-btn.ucm-mode-active button:not(.ucm-view-toggle-btn),
.view-toggle-btn.ucm-mode-active button.v-btn--selected:not(.ucm-view-toggle-btn),
.pos-ucm-mode-active .view-toggle-btn button:not(.ucm-view-toggle-btn),
.pos-ucm-mode-active .view-toggle-btn button.v-btn--selected:not(.ucm-view-toggle-btn),
[data-theme='dark'] .view-toggle-btn.ucm-mode-active button:not(.ucm-view-toggle-btn),
[data-theme='dark'] .view-toggle-btn.ucm-mode-active button.v-btn--selected:not(.ucm-view-toggle-btn) {
	background: transparent !important;
	background-color: transparent !important;
	color: inherit !important;
	box-shadow: none !important;
	opacity: 0.65 !important;
}

.view-toggle-btn.ucm-mode-active button:not(.ucm-view-toggle-btn) .v-btn__content,
.view-toggle-btn.ucm-mode-active button.v-btn--selected:not(.ucm-view-toggle-btn) .v-btn__content,
[data-theme='dark'] .view-toggle-btn.ucm-mode-active button:not(.ucm-view-toggle-btn) .v-btn__content,
[data-theme='dark'] .view-toggle-btn.ucm-mode-active button.v-btn--selected:not(.ucm-view-toggle-btn) .v-btn__content {
	color: inherit !important;
}

.view-toggle-btn.ucm-mode-active button:not(.ucm-view-toggle-btn) .v-btn__overlay,
.view-toggle-btn.ucm-mode-active button.v-btn--selected:not(.ucm-view-toggle-btn) .v-btn__overlay,
[data-theme='dark'] .view-toggle-btn.ucm-mode-active button:not(.ucm-view-toggle-btn) .v-btn__overlay,
[data-theme='dark'] .view-toggle-btn.ucm-mode-active button.v-btn--selected:not(.ucm-view-toggle-btn) .v-btn__overlay {
	opacity: 0 !important;
}

.view-toggle-btn:not(.ucm-mode-active) button.ucm-view-toggle-btn,
[data-theme='dark'] .view-toggle-btn:not(.ucm-mode-active) button.ucm-view-toggle-btn {
	background: transparent !important;
	background-color: transparent !important;
	color: inherit !important;
	box-shadow: none !important;
	opacity: 0.65 !important;
}

.view-toggle-btn:not(.ucm-mode-active) button.ucm-view-toggle-btn .v-btn__content,
[data-theme='dark'] .view-toggle-btn:not(.ucm-mode-active) button.ucm-view-toggle-btn .v-btn__content {
	color: inherit !important;
}

.view-toggle-btn:not(.ucm-mode-active) button.ucm-view-toggle-btn .v-btn__overlay {
	opacity: 0 !important;
}

/* 4. UCM Fullscreen Card Container Overlay */
.pos-ucm-mode-active .selection-card {
	overflow: hidden !important;
}

.ucm-groups-overlay {
	position: absolute;
	inset: 0;
	z-index: 5;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--pos-surface, #ffffff);
	padding: 14px;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
}

/* Header Bar */
.ucm-header-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
	padding-bottom: 10px;
	flex-shrink: 0;
	border-bottom: 1px solid var(--pos-border-light, #e5e7eb);
}

.ucm-header-title {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--pos-text-primary, #1f2937);
	display: flex;
	align-items: center;
	gap: 8px;
}

.ucm-header-badge {
	font-size: 0.8125rem;
	font-weight: 600;
	padding: 3px 10px;
	border-radius: 12px;
	background: var(--pos-surface-muted, #f3f4f6);
	color: var(--pos-text-secondary, #6b7280);
}

/* Categories Grid */
.ucm-categories-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 14px;
	padding-bottom: 8px;
}

/* Category Card */
.ucm-category-card {
	background: var(--pos-surface, #ffffff);
	border: 1px solid var(--pos-border-light, #e5e7eb);
	border-radius: 12px;
	overflow: hidden;
	cursor: pointer;
	transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
	display: flex;
	flex-direction: column;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
	position: relative;
}

.ucm-category-card:hover {
	transform: translateY(-3px);
	border-color: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210)));
	box-shadow: 0 6px 16px rgba(var(--v-theme-primary, 25, 118, 210), 0.2);
}

.ucm-category-card:active {
	transform: scale(0.98);
}

.ucm-category-card__image {
	height: 120px;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	background-color: var(--pos-surface-muted, #f3f4f6);
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ucm-category-card__image-placeholder {
	font-size: 2.4rem;
	opacity: 0.4;
}

.ucm-category-card__body {
	padding: 10px 12px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	background: var(--pos-surface, #ffffff);
}

.ucm-category-card__title {
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--pos-text-primary, #1f2937);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ucm-category-card__count {
	font-size: 0.75rem;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 10px;
	background: rgba(var(--v-theme-primary, 25, 118, 210), 0.12);
	color: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210)));
	white-space: nowrap;
}

/* Category Detail View (Fullscreen Dishes View) */
.ucm-detail-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--pos-border-light, #e5e7eb);
	flex-wrap: wrap;
}

.ucm-back-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	font-size: 0.875rem;
	font-weight: 700;
	color: #ffffff;
	background: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210)));
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.15s, transform 0.1s;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ucm-back-btn:hover {
	filter: brightness(1.1);
	transform: translateY(-1px);
}

.ucm-back-btn:active {
	transform: scale(0.97);
}

.ucm-detail-title-wrap {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 150px;
}

.ucm-detail-title {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--pos-text-primary, #1f2937);
}

.ucm-detail-search-wrap {
	position: relative;
	min-width: 180px;
}

.ucm-detail-search {
	width: 100%;
	padding: 7px 12px 7px 32px;
	border: 1px solid var(--pos-border-light, #e5e7eb);
	border-radius: 8px;
	font-size: 0.875rem;
	background: var(--pos-surface, #ffffff);
	color: var(--pos-text-primary, #1f2937);
	outline: none;
	box-sizing: border-box;
}

.ucm-detail-search:focus {
	border-color: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210)));
}

.ucm-detail-search-icon {
	position: absolute;
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
	opacity: 0.4;
	font-size: 0.8125rem;
	pointer-events: none;
}

/* Dishes Grid */
.ucm-dishes-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 12px;
	padding-bottom: 24px;
}

/* Dish Card */
.ucm-dish-card {
	background: var(--pos-surface, #ffffff);
	border: 1px solid var(--pos-border-light, #e5e7eb);
	border-radius: 10px;
	overflow: hidden;
	cursor: pointer;
	transition: all 0.15s ease-in-out;
	display: flex;
	flex-direction: column;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
	position: relative;
}

.ucm-dish-card:hover {
	border-color: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210)));
	transform: translateY(-2px);
	box-shadow: 0 5px 14px rgba(var(--v-theme-primary, 25, 118, 210), 0.18);
}

.ucm-dish-card:active {
	transform: scale(0.97);
}

.ucm-dish-card__image {
	height: 95px;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	background-color: var(--pos-surface-muted, #f3f4f6);
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ucm-dish-card__addon-badge {
	position: absolute;
	top: 6px;
	right: 6px;
	background: rgba(25, 118, 210, 0.92);
	color: #ffffff;
	font-size: 0.65rem;
	font-weight: 700;
	padding: 2px 6px;
	border-radius: 6px;
	backdrop-filter: blur(4px);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ucm-dish-card__info {
	padding: 8px 10px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
}

.ucm-dish-card__name {
	font-size: 0.8125rem;
	font-weight: 700;
	color: var(--pos-text-primary, #1f2937);
	line-height: 1.25;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	min-height: 2rem;
}

.ucm-dish-card__name-ar {
	font-size: 0.725rem;
	color: var(--pos-text-secondary, #6b7280);
	line-height: 1.2;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ucm-dish-card__price-row {
	margin-top: auto;
	padding-top: 6px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.ucm-dish-card__price {
	font-size: 0.875rem;
	font-weight: 700;
	color: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210)));
}

/* Mobile Responsiveness for UCM Grid Views */
@media (max-width: 600px) {
	.ucm-groups-overlay {
		padding: 8px;
	}
	.ucm-categories-grid {
		grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
		gap: 8px;
	}
	.ucm-category-card__image {
		height: 90px !important;
	}
	.ucm-category-card__body {
		padding: 8px 10px;
	}
	.ucm-dishes-grid {
		grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)) !important;
		gap: 8px !important;
	}
	.ucm-dish-card__image {
		height: 80px !important;
	}
}

/* Dark mode overrides */
[data-theme='dark'] .ucm-category-card,
[data-theme='dark'] .ucm-dish-card {
	background: var(--pos-surface, #1e1e1e);
	border-color: var(--pos-border, #374151);
}

[data-theme='dark'] .ucm-category-card__body {
	background: var(--pos-surface, #1e1e1e);
}

[data-theme='dark'] .ucm-header-title,
[data-theme='dark'] .ucm-category-card__title,
[data-theme='dark'] .ucm-detail-title,
[data-theme='dark'] .ucm-dish-card__name {
	color: var(--pos-text-primary, #f9fafb);
}

[data-theme='dark'] .ucm-header-badge {
	background: var(--pos-surface-muted, #374151);
	color: var(--pos-text-secondary, #9ca3af);
}

[data-theme='dark'] .ucm-detail-search {
	background: var(--pos-surface, #1e1e1e);
	border-color: var(--pos-border, #374151);
	color: #ffffff;
}

[data-theme='dark'] .ucm-groups-overlay {
	background: var(--pos-surface, #121212);
}

.ucm-refresh-btn {
	background: transparent;
	border: 1px solid var(--pos-border-light, #e5e7eb);
	border-radius: 8px;
	padding: 4px 8px;
	cursor: pointer;
	color: var(--pos-text-secondary, #6b7280);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all .18s ease;
}

.ucm-refresh-btn:hover {
	color: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210)));
	border-color: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210)));
	transform: rotate(60deg);
}

[data-theme='dark'] .ucm-refresh-btn {
	border-color: var(--pos-border, #374151);
	color: var(--pos-text-secondary, #9ca3af);
}

/* ==========================================================================
   Mobile POS Bottom Dock & Cart Badge Pill
   ========================================================================== */
.mobile-pos-dock {
	box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08) !important;
	border-top: 1px solid var(--pos-border-light, #e5e7eb) !important;
	background: var(--pos-surface, #ffffff) !important;
	z-index: 100 !important;
}

.mobile-pos-dock__item {
	position: relative !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 4px 8px !important;
}

.mobile-pos-dock__item--cart {
	position: relative !important;
}

.mobile-pos-dock__item span.mobile-pos-dock__pill {
	position: absolute !important;
	top: 2px !important;
	right: calc(50% - 20px) !important;
	left: auto !important;
	width: auto !important;
	min-width: 18px !important;
	height: 18px !important;
	padding: 0 5px !important;
	border-radius: 999px !important;
	background: var(--pos-primary, rgb(var(--v-theme-primary, 25, 118, 210))) !important;
	color: #ffffff !important;
	font-size: 0.65rem !important;
	font-weight: 700 !important;
	line-height: 18px !important;
	text-align: center !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) !important;
	z-index: 5 !important;
	pointer-events: none !important;
}

[dir="rtl"] .mobile-pos-dock__item span.mobile-pos-dock__pill,
.rtl-app-bar .mobile-pos-dock__item span.mobile-pos-dock__pill {
	right: auto !important;
	left: calc(50% - 20px) !important;
}

.mobile-pos-dock__item span:not(.mobile-pos-dock__pill) {
	margin-top: 2px !important;
	font-size: 0.72rem !important;
	font-weight: 600 !important;
}

[data-theme='dark'] .mobile-pos-dock {
	background: var(--pos-surface, #1e1e1e) !important;
	border-top-color: var(--pos-border, #374151) !important;
}
