/* ═══════════════════════════════════════════════════════════════
   INTELLEGY HUB — Popups, Drawers & Modals
   ═══════════════════════════════════════════════════════════════ */

/* SHARED OVERLAY */
.ihl-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 3000;
	display: none;
	opacity: 0;
	transition: opacity var(--transition-base);
}
.ihl-overlay.is-open { display: flex; opacity: 1; }

/* CENTERED MODAL */
.ihl-modal {
	margin: auto;
	background: rgba(14, 18, 24, 0.98);
	border: 1px solid var(--color-border-accent);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg);
	width: 100%;
	max-width: 420px;
	padding: var(--space-8);
	position: relative;
	animation: scaleIn var(--transition-base);
}
.ihl-modal--wide { max-width: 920px; }

.ihl-modal-close,
.popup-close {
	position: absolute;
	top: 14px;
	right: 16px;
	background: none;
	border: none;
	color: var(--color-text-muted);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: color var(--transition-fast);
}
.ihl-modal-close:hover,
.popup-close:hover { color: var(--color-text); }

/* FORM ELEMENTS */
.ihl-field { margin-bottom: var(--space-4); }
.ihl-field label {
	display: block;
	font-size: 12px;
	color: var(--color-text-muted);
	margin-bottom: 6px;
	font-family: var(--font-heading);
	text-transform: uppercase;
	letter-spacing: 1px;
}
.ihl-input {
	width: 100%;
	background: var(--color-bg-card);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 12px 14px;
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: 15px;
	transition: border-color var(--transition-fast);
}
.ihl-input:focus { outline: none; border-color: var(--color-primary); }
.ihl-input::placeholder { color: var(--color-text-muted); }

/* TABS */
.popup-tabs { display: flex; gap: var(--space-4); margin-bottom: var(--space-6); border-bottom: 1px solid var(--color-border); }
.popup-tab {
	background: none;
	border: none;
	color: var(--color-text-muted);
	font-family: var(--font-heading);
	font-weight: 600;
	font-size: 15px;
	padding: 10px 0;
	cursor: pointer;
	position: relative;
	border-bottom: 2px solid transparent;
	transition: color var(--transition-fast);
}
.popup-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.popup-tab-content { display: none; }
.popup-tab-content.active { display: block; animation: fadeIn var(--transition-base); }

/* MESSAGE */
.ihl-msg { font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm); margin-top: var(--space-3); display: none; }
.ihl-msg.is-error { display: block; background: rgba(244, 67, 54, 0.1); border: 1px solid rgba(244, 67, 54, 0.3); color: #ff8a80; }
.ihl-msg.is-success { display: block; background: rgba(76, 175, 80, 0.1); border: 1px solid rgba(76, 175, 80, 0.3); color: #a5d6a7; }

/* USER PROFILE CARD (logged in) */
.user-profile-card { text-align: center; }
.user-profile-card img { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto var(--space-4); display: block; border: 2px solid var(--color-border-accent); }
.user-profile-card h4 { font-family: var(--font-heading); font-size: 18px; margin-bottom: 4px; }
.user-profile-card .user-email { color: var(--color-text-muted); font-size: 13px; margin-bottom: var(--space-6); }
.user-profile-links { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-6); }
.user-profile-links a {
	color: var(--color-text-body);
	text-decoration: none;
	padding: 10px 14px;
	border-radius: var(--radius-sm);
	background: var(--color-bg-card);
	border: 1px solid var(--color-border);
	transition: all var(--transition-fast);
	font-size: 14px;
}
.user-profile-links a:hover { border-color: var(--color-border-accent); color: var(--color-text); }

/* BUTTON FULL WIDTH IN POPUP */
.ihl-modal .btn,
.ihl-modal .btn-ghost { width: 100%; justify-content: center; margin-top: var(--space-2); }

/* LOADING SPINNER */
.ihl-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
	vertical-align: middle;
}

/* ═══ MINI-CART DRAWER ═══ */
.mini-cart-overlay { justify-content: flex-end; }
.mini-cart-drawer {
	width: 100%;
	max-width: 400px;
	height: 100%;
	background: var(--color-bg-secondary);
	border-left: 1px solid var(--color-border);
	display: flex;
	flex-direction: column;
	animation: slideInRight var(--transition-base);
	margin: 0;
}
.mini-cart-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--space-6);
	border-bottom: 1px solid var(--color-border);
}

.mini-cart-header div { 
	margin: 0;
	font-family: var(--font-heading);
    font-size: clamp(1.1rem, 2vw, 1.375rem);
    margin-bottom: var(--space-3);
    font-weight: 600;
    color: var(--color-text);

}

.mini-cart-items { flex: 1; overflow-y: auto; padding: var(--space-6); }
.mini-cart-items .woocommerce-mini-cart__empty-message { color: var(--color-text-muted); }
.mini-cart-footer {
	padding: var(--space-6);
	border-top: 1px solid var(--color-border);
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}
.mini-cart-footer .btn,
.mini-cart-footer .btn-ghost { width: 100%; justify-content: center; }

/* ═══ GALLERY LIGHTBOX ═══ */
.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.92);
	z-index: 4000;
	display: none;
	align-items: center;
	justify-content: center;
}
.modal-overlay.active { display: flex; animation: fadeIn var(--transition-base); }
.modal-content { position: relative; max-width: 90vw; max-height: 90vh; }
.modal-img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius-md); display: block; }
.modal-close {
	position: absolute;
	top: -40px;
	right: 0;
	background: none;
	border: none;
	color: #fff;
	font-size: 34px;
	cursor: pointer;
	line-height: 1;
}
.modal-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(74, 144, 226, 0.2);
	border: 1px solid var(--color-border-accent);
	color: #fff;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	font-size: 20px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--transition-fast);
}
.modal-nav:hover { background: rgba(74, 144, 226, 0.5); }
.modal-prev { left: -70px; }
.modal-next { right: -70px; }

/* ═══ PRODUCT QUICK-VIEW ═══ */
.product-modal-inner { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8); }
.product-gallery .gallery-main img { width: 100%; border-radius: var(--radius-md); border: 1px solid var(--color-border); }
.product-gallery .gallery-thumbs { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.product-gallery .gallery-thumbs img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--color-border); cursor: pointer; opacity: 0.6; transition: opacity var(--transition-fast); }
.product-gallery .gallery-thumbs img.active,
.product-gallery .gallery-thumbs img:hover { opacity: 1; border-color: var(--color-primary); }
.product-summary h2 { margin-bottom: var(--space-3); }
.product-summary .product-price { font-family: var(--font-heading); font-size: 22px; color: var(--color-primary); font-weight: 700; margin-bottom: var(--space-4); }

@media (max-width: 768px) {
	.ihl-modal { max-width: 100%; height: 100%; border-radius: 0; margin: 0; max-height: 100vh; overflow-y: auto; }
	.modal-prev { left: 10px; }
	.modal-next { right: 10px; }
	.modal-close { top: 10px; right: 10px; }
	.product-modal-inner { grid-template-columns: 1fr; }
}
