/**
 * MyGasztro Shopping List Design Layer
 *
 * Bevasarlolista (myShopping) stilusai - editor es publikus nezet.
 * Fuggoseg: myg-global.css
 *
 * STABIL KAPASZKODOK:
 * - .myg-shopping-editor
 * - .myg-shopping-header
 * - .myg-shopping-list-selector
 * - .myg-shopping-list-actions
 * - .myg-shopping-share-info
 * - .myg-shopping-add
 * - .myg-shopping-items
 * - .myg-shopping-item
 * - .myg-shopping-empty
 * - .myg-shopping-public
 * - .myg-bulk-actions
 * - .myg-share-btn
 *
 * @package MyGasztro
 * @since 2.2.0
 * @layer design
 */

/* ==========================================================================
   SHOPPING LIST EDITOR
   ========================================================================== */

.myg-shopping-editor {
	max-width: var(--myg-max-width-narrow);
	margin: 0 auto;
	padding: var(--myg-spacing-lg);
	font-family: var(--myg-font-family);
}

.myg-shopping-header {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: var(--myg-spacing-md);
	margin-bottom: var(--myg-spacing-lg);
	padding-bottom: var(--myg-spacing-md);
	border-bottom: 1px solid var(--myg-border-color);
}

.myg-shopping-list-selector {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1;
	min-width: 200px;
}

.myg-shopping-select {
	flex: 1;
	padding: 10px 15px;
	border: 1px solid var(--myg-border-color);
	border-radius: var(--myg-border-radius);
	font-size: var(--myg-font-size-base);
	font-family: inherit;
}

.myg-shopping-list-actions {
	display: flex;
	gap: var(--myg-spacing-sm);
	flex-wrap: wrap;
}

/* ==========================================================================
   MEGOSZTASI INFO BAR
   A megosztasi gombok (.myg-share-*) stilusai a myg-global.css-ben vannak.
   Itt csak a shopping-specifikus wrapper marad.
   ========================================================================== */

.myg-shopping-share-info {
	background: var(--myg-info-light);
	padding: var(--myg-spacing-md);
	border-radius: var(--myg-border-radius);
	margin-bottom: var(--myg-spacing-lg);
}

.myg-share-disable-row {
	padding-top: 12px;
	border-top: 1px solid #b8d4e3;
}

/* ==========================================================================
   URES ALLAPOT
   ========================================================================== */

.myg-shopping-empty {
	text-align: center;
	padding: 60px var(--myg-spacing-lg);
	background: var(--myg-bg-muted);
	border-radius: var(--myg-border-radius-lg);
}

.myg-shopping-empty__icon {
	font-size: 64px;
	margin-bottom: var(--myg-spacing-lg);
}

.myg-shopping-empty__title {
	color: var(--myg-text-color);
	margin-bottom: 10px;
}

.myg-shopping-empty__text {
	color: var(--myg-text-muted);
	margin-bottom: 25px;
}

/* ==========================================================================
   KERESES / HOZZAADAS SZEKCIO
   ========================================================================== */

.myg-shopping-add {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin-bottom: var(--myg-spacing-lg);
}

.myg-shopping-search-wrapper {
	position: relative;
	flex: 1;
}

#myg-free-item-btn {
	white-space: nowrap;
	flex-shrink: 0;
}

.myg-shopping-search-input {
	width: 100%;
	padding: 12px 16px;
	border: 2px solid var(--myg-border-color);
	border-radius: var(--myg-border-radius);
	font-size: 15px;
	font-family: inherit;
	transition: border-color var(--myg-transition-normal);
}

.myg-shopping-search-input:focus {
	outline: none;
	border-color: var(--myg-primary-color);
}

.myg-shopping-autocomplete {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: var(--myg-bg-color);
	border: 1px solid var(--myg-border-color);
	border-top: none;
	border-radius: 0 0 var(--myg-border-radius) var(--myg-border-radius);
	max-height: 300px;
	overflow-y: auto;
	z-index: var(--myg-z-dropdown);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	display: none;
}

/* ==========================================================================
   SHOPPING LISTA ELEMEK
   ========================================================================== */

.myg-shopping-items {
	list-style: none;
	padding: 0;
	margin: 0;
}

.myg-shopping-item {
	display: flex;
	align-items: center;
	padding: 12px 15px;
	background: var(--myg-bg-color);
	border: 1px solid var(--myg-border-light);
	border-radius: var(--myg-border-radius);
	margin-bottom: var(--myg-spacing-sm);
	gap: 12px;
	transition: background var(--myg-transition-normal);
}

.myg-shopping-item:hover {
	background: var(--myg-bg-muted);
}

.myg-shopping-item--checked {
	background: #f0f0f0;
}

.myg-shopping-item--checked .myg-shopping-item__name {
	text-decoration: line-through;
	color: var(--myg-text-light);
}

.myg-shopping-item--selected {
	background: var(--myg-warning-light);
	border-color: #ffcc80;
}

/* Drag & Drop states */
.myg-shopping-item--dragging {
	opacity: 0.5;
	background: var(--myg-bg-muted);
}

.myg-shopping-item--drag-over {
	border-color: var(--myg-primary-color);
	border-style: dashed;
	background: var(--myg-primary-light);
}

/* Reorder buttons (up/down) */
.myg-shopping-item__reorder {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex-shrink: 0;
}

.myg-shopping-item__move-up,
.myg-shopping-item__move-down {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 24px;
	padding: 0;
	background: var(--myg-bg-white);
	border: 1px solid var(--myg-border-color);
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	color: var(--myg-text-light);
	transition: background var(--myg-transition-normal), color var(--myg-transition-normal), border-color var(--myg-transition-normal);
}

.myg-shopping-item__move-up:hover:not(:disabled),
.myg-shopping-item__move-down:hover:not(:disabled) {
	background: var(--myg-bg-muted);
	color: var(--myg-text-color);
	border-color: var(--myg-primary-color);
}

.myg-shopping-item__move-up:disabled,
.myg-shopping-item__move-down:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.myg-shopping-item__move-up:focus,
.myg-shopping-item__move-down:focus {
	outline: 2px solid var(--myg-primary-color);
	outline-offset: 1px;
}

.myg-shopping-item__select {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.myg-item-checkbox {
	width: 18px;
	height: 18px;
	cursor: pointer;
	accent-color: var(--myg-primary-color);
}

.myg-shopping-item__main {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.myg-shopping-item__name {
	font-weight: 500;
	color: var(--myg-text-color);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.myg-shopping-item__qty {
	background: var(--myg-info-light);
	color: var(--myg-info-color);
	padding: 6px 12px;
	border-radius: 6px;
	font-size: var(--myg-font-size-sm);
	font-weight: 500;
	border: none;
	cursor: pointer;
	transition: background var(--myg-transition-normal);
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
}

.myg-shopping-item__qty:hover {
	background: #d5e9f2;
}

.myg-shopping-item__qty-main {
	font-size: var(--myg-font-size-base);
	font-weight: 600;
	color: #1a5f7a;
}

.myg-shopping-item__qty-detail {
	font-size: var(--myg-font-size-xs);
	color: var(--myg-text-muted);
	font-weight: 400;
}

.myg-shopping-item__remove {
	background: none;
	border: none;
	color: var(--myg-text-light);
	cursor: pointer;
	font-size: 20px;
	padding: 4px 8px;
	border-radius: var(--myg-border-radius-sm);
	transition: all var(--myg-transition-normal);
	flex-shrink: 0;
}

.myg-shopping-item__remove:hover {
	background: var(--myg-danger-light);
	color: var(--myg-danger-color);
}

/* Nincs elem uzenet */
.myg-shopping-no-items {
	text-align: center;
	padding: var(--myg-spacing-2xl) var(--myg-spacing-lg);
	color: var(--myg-text-muted);
	background: var(--myg-bg-muted);
	border-radius: var(--myg-border-radius);
}

/* Login uzenet */
.myg-shopping-login-notice {
	text-align: center;
	padding: var(--myg-spacing-2xl) var(--myg-spacing-lg);
	background: var(--myg-warning-light);
	border-radius: var(--myg-border-radius);
}

/* ==========================================================================
   LOADING OVERLAY
   ========================================================================== */

.myg-shopping-loading {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.9);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 50;
}

.myg-shopping-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid #f0f0f0;
	border-top-color: var(--myg-primary-color);
	border-radius: 50%;
	animation: myg-spin 1s linear infinite;
}

/* ==========================================================================
   PUBLIKUS NEZET
   ========================================================================== */

.myg-shopping-public {
	min-height: 100vh;
	background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
	padding: var(--myg-spacing-lg);
	font-family: var(--myg-font-family);
}

.myg-shopping-public__container {
	max-width: 500px;
	margin: 0 auto;
	background: var(--myg-bg-color);
	border-radius: var(--myg-border-radius-lg);
	box-shadow: var(--myg-box-shadow);
	overflow: hidden;
}

.myg-shopping-public__header {
	padding: 25px 20px;
	background: linear-gradient(135deg, var(--myg-primary-color) 0%, #e67722 100%);
	color: white;
	text-align: center;
}

.myg-shopping-public__title {
	margin: 0 0 10px 0;
	font-size: 1.5em;
}

.myg-shopping-public__meta {
	margin: 0;
	opacity: 0.9;
	font-size: var(--myg-font-size-base);
}

/* Progress bar */
.myg-shopping-public__progress {
	padding: 15px 20px;
	background: var(--myg-bg-muted);
	border-bottom: 1px solid var(--myg-border-light);
}

.myg-shopping-public__progress-bar {
	height: 8px;
	background: #e0e0e0;
	border-radius: 4px;
	overflow: hidden;
	margin-bottom: 8px;
}

.myg-shopping-public__progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--myg-success-color), #8bc34a);
	border-radius: 4px;
	transition: width var(--myg-transition-slow);
	width: 0;
}

.myg-shopping-public__progress-text {
	margin: 0;
	font-size: var(--myg-font-size-sm);
	color: var(--myg-text-muted);
	text-align: center;
}

/* Publikus lista elemek */
.myg-shopping-public__items {
	list-style: none;
	padding: 0;
	margin: 0;
}

.myg-shopping-public__item {
	border-bottom: 1px solid #f0f0f0;
}

.myg-shopping-public__item:last-child {
	border-bottom: none;
}

.myg-shopping-public__item-label {
	display: flex;
	align-items: center;
	padding: 15px 20px;
	cursor: pointer;
	gap: 15px;
	transition: background var(--myg-transition-normal);
}

.myg-shopping-public__item-label:hover {
	background: #fafafa;
}

.myg-shopping-public__item--checked .myg-shopping-public__item-label {
	background: var(--myg-bg-alt);
}

.myg-shopping-public__item--checked .myg-shopping-public__item-name {
	text-decoration: line-through;
	color: var(--myg-text-light);
}

/* Custom checkbox */
.myg-shopping-public__checkbox {
	position: absolute;
	opacity: 0;
	cursor: pointer;
}

.myg-shopping-public__checkmark {
	width: 24px;
	height: 24px;
	border: 2px solid #ccc;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: all var(--myg-transition-normal);
}

.myg-shopping-public__checkbox:checked + .myg-shopping-public__checkmark {
	background: var(--myg-success-color);
	border-color: var(--myg-success-color);
}

.myg-shopping-public__checkbox:checked + .myg-shopping-public__checkmark::after {
	content: '\2713';
	color: white;
	font-size: var(--myg-font-size-base);
	font-weight: bold;
}

.myg-shopping-public__checkbox:focus + .myg-shopping-public__checkmark {
	box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

.myg-shopping-public__item-content {
	flex: 1;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
}

.myg-shopping-public__item-name {
	font-weight: 500;
	color: var(--myg-text-color);
}

.myg-shopping-public__item-qty {
	color: var(--myg-text-muted);
	font-size: var(--myg-font-size-base);
	white-space: nowrap;
}

/* Publikus akciok */
.myg-shopping-public__actions {
	padding: 15px 20px;
	border-top: 1px solid var(--myg-border-light);
	text-align: center;
}

/* Publikus ures allapot */
.myg-shopping-public__empty {
	padding: var(--myg-spacing-2xl) var(--myg-spacing-lg);
	text-align: center;
	color: var(--myg-text-muted);
}

/* Publikus footer */
.myg-shopping-public__footer {
	padding: 15px 20px;
	background: var(--myg-bg-muted);
	text-align: center;
	font-size: var(--myg-font-size-sm);
	color: var(--myg-text-muted);
}

.myg-shopping-public__footer a {
	color: var(--myg-primary-color);
	text-decoration: none;
	font-weight: 600;
}

/* ==========================================================================
   BULK ACTIONS BAR
   ========================================================================== */

.myg-bulk-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--myg-spacing-md);
	padding: 12px 15px;
	background: var(--myg-bg-muted);
	border-radius: var(--myg-border-radius);
	margin-bottom: var(--myg-spacing-md);
	flex-wrap: wrap;
}

.myg-bulk-actions__select {
	display: flex;
	align-items: center;
	gap: 12px;
}

.myg-checkbox-label {
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	font-size: var(--myg-font-size-base);
	color: var(--myg-text-color);
}

.myg-checkbox-label input[type="checkbox"] {
	width: 18px;
	height: 18px;
	cursor: pointer;
	accent-color: var(--myg-primary-color);
}

.myg-checkbox-text {
	font-weight: 500;
}

.myg-bulk-actions__count {
	color: var(--myg-text-muted);
	font-size: var(--myg-font-size-sm);
}

.myg-bulk-actions__buttons {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

/* ==========================================================================
   MENNYISEG SZERKESZTES MODAL
   ========================================================================== */

.myg-quantity-edit {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.myg-quantity-edit label {
	margin-bottom: 0 !important;
	font-weight: 500;
}

.myg-quantity-edit__inputs {
	display: flex;
	align-items: center;
	gap: 10px;
}

.myg-input--unit {
	width: auto;
	min-width: 80px;
	padding: 8px 12px;
	border: 1px solid var(--myg-border-color);
	border-radius: var(--myg-border-radius);
	font-size: var(--myg-font-size-base);
	background-color: var(--myg-bg-color);
	cursor: pointer;
}

.myg-input--unit:focus {
	outline: none;
	border-color: var(--myg-primary-color);
	box-shadow: 0 0 0 2px rgba(var(--myg-primary-rgb), 0.2);
}

.myg-edit-item-name {
	font-weight: 600;
	color: var(--myg-text-color);
	margin-bottom: var(--myg-spacing-md);
}

.myg-edit-unit {
	color: var(--myg-text-muted);
}

/* ==========================================================================
   LISTA KIVALASZTO MODAL
   ========================================================================== */

.myg-list-select-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: var(--myg-z-modal);
	display: flex;
	align-items: center;
	justify-content: center;
}

.myg-list-select-modal__overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
}

.myg-list-select-modal__content {
	position: relative;
	background: var(--myg-bg-color);
	border-radius: var(--myg-border-radius-lg);
	padding: 24px;
	max-width: 400px;
	width: 90%;
	max-height: 80vh;
	overflow-y: auto;
	box-shadow: var(--myg-box-shadow-lg);
}

.myg-list-select-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	background: none;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: var(--myg-text-muted);
	line-height: 1;
}

.myg-list-select-modal__close:hover {
	color: var(--myg-text-color);
}

.myg-list-select-modal__title {
	margin: 0 0 20px;
	font-size: 1.3em;
	color: var(--myg-text-color);
}

.myg-list-options {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 16px;
}

.myg-list-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background: var(--myg-bg-muted);
	border: 2px solid transparent;
	border-radius: var(--myg-border-radius);
	cursor: pointer;
	transition: all var(--myg-transition-normal);
}

.myg-list-option:hover {
	background: #e9ecef;
	border-color: var(--myg-primary-color);
}

.myg-list-option--selected {
	border-color: var(--myg-primary-color);
	background: rgba(76, 175, 80, 0.08);
}

.myg-list-option__name {
	font-weight: 500;
	color: var(--myg-text-color);
}

.myg-list-option__count {
	font-size: var(--myg-font-size-xs);
	color: var(--myg-text-muted);
	background: #e9ecef;
	padding: 2px 8px;
	border-radius: 12px;
}

.myg-list-select-modal__divider {
	display: flex;
	align-items: center;
	margin: 16px 0;
	color: var(--myg-text-muted);
}

.myg-list-select-modal__divider::before,
.myg-list-select-modal__divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: #e0e0e0;
}

.myg-list-select-modal__divider span {
	padding: 0 12px;
	font-size: var(--myg-font-size-sm);
}

.myg-list-select-modal__new {
	display: flex;
	gap: 8px;
}

.myg-list-select-modal__new input {
	flex: 1;
	padding: 10px 14px;
	border: 1px solid var(--myg-border-color);
	border-radius: 6px;
	font-size: var(--myg-font-size-base);
}

.myg-list-select-modal__new input:focus {
	outline: none;
	border-color: var(--myg-primary-color);
}

.myg-list-select-modal__new .myg-btn {
	padding: 10px 16px;
	background: var(--myg-primary-color);
	color: white;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-weight: 500;
	white-space: nowrap;
}

.myg-list-select-modal__new .myg-btn:hover {
	background: var(--myg-primary-hover);
}

.myg-list-empty {
	text-align: center;
	color: var(--myg-text-muted);
	padding: 20px;
}

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

@media (max-width: 600px) {
	.myg-shopping-header {
		flex-direction: column;
		align-items: stretch;
	}

	.myg-shopping-list-selector {
		flex-direction: column;
	}

	.myg-shopping-list-selector .myg-btn {
		width: 100%;
	}

	.myg-shopping-list-actions {
		justify-content: center;
	}

	.myg-shopping-add {
		flex-direction: column;
	}

	#myg-free-item-btn {
		width: 100%;
	}

	.myg-shopping-share-info p {
		flex-direction: column;
		align-items: stretch;
	}

	.myg-share-url-input {
		width: 100%;
	}

	.myg-shopping-public__item-content {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
}

@media (max-width: 480px) {
	.myg-bulk-actions {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
	}

	.myg-bulk-actions__select {
		justify-content: space-between;
	}

	.myg-bulk-actions__buttons {
		justify-content: center;
	}

	.myg-bulk-actions__buttons .myg-btn {
		flex: 1;
		min-width: 0;
		text-align: center;
	}
}
