/**
 * Asna3 Fi Albait (اصنع في البيت) - Stylesheet
 * Scoped styles perfectly harmonized with A7la7ayat Design System (#ED217C, #8CC63F)
 *
 * @package A7la7ayat_Asna3_Fi_Albait
 */

.a7wmah-app {
	--a7wmah-primary: #ED217C;
	--a7wmah-primary-hover: #D81B60;
	--a7wmah-primary-light: #FFF0F6;
	--a7wmah-primary-gradient: linear-gradient(135deg, #ED217C 0%, #D81B60 100%);

	--a7wmah-green: #8CC63F;
	--a7wmah-green-hover: #7AB42F;
	--a7wmah-green-light: #F4FBEA;
	--a7wmah-green-gradient: linear-gradient(135deg, #8CC63F 0%, #78B031 100%);

	--a7wmah-bg: #FFFFFF;
	--a7wmah-surface: #FAFAFA;
	--a7wmah-surface-hover: #F1F5F9;
	--a7wmah-text: #1E293B;
	--a7wmah-text-secondary: #475569;
	--a7wmah-muted: #94A3B8;
	--a7wmah-border: #E2E8F0;
	--a7wmah-border-focus: #ED217C;

	--a7wmah-radius: 18px;
	--a7wmah-radius-sm: 10px;
	--a7wmah-radius-pill: 9999px;

	--a7wmah-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
	--a7wmah-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05), 0 4px 12px -2px rgba(0, 0, 0, 0.02);
	--a7wmah-shadow-hover: 0 16px 36px -4px rgba(237, 33, 124, 0.14), 0 6px 16px -2px rgba(0, 0, 0, 0.04);
	--a7wmah-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans Arabic", "Cairo", sans-serif;

	font-family: var(--a7wmah-font);
	color: var(--a7wmah-text);
	max-width: 1060px;
	margin: 0 auto;
	padding: 20px 15px;
	box-sizing: border-box;
	direction: rtl;
	text-align: right;
	line-height: 1.6;
}

.a7wmah-app *,
.a7wmah-app *::before,
.a7wmah-app *::after {
	box-sizing: border-box;
}

.a7wmah-hidden {
	display: none !important;
}

/* ==========================================================================
   Header & Branding
   ========================================================================== */
.a7wmah-header {
	text-align: center;
	margin-bottom: 35px;
}

.a7wmah-brand-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--a7wmah-primary-light);
	color: var(--a7wmah-primary);
	font-size: 0.88rem;
	font-weight: 700;
	padding: 6px 16px;
	border-radius: var(--a7wmah-radius-pill);
	margin-bottom: 12px;
	border: 1px solid rgba(237, 33, 124, 0.18);
}

.a7wmah-brand-dot {
	width: 8px;
	height: 8px;
	background: var(--a7wmah-primary);
	border-radius: 50%;
	display: inline-block;
	box-shadow: 0 0 0 3px rgba(237, 33, 124, 0.25);
	animation: a7wmah-pulse 2s infinite;
}

@keyframes a7wmah-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(237, 33, 124, 0.4); }
	70%  { box-shadow: 0 0 0 6px rgba(237, 33, 124, 0); }
	100% { box-shadow: 0 0 0 0 rgba(237, 33, 124, 0); }
}

.a7wmah-title {
	color: var(--a7wmah-primary);
	background: var(--a7wmah-primary-gradient);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	font-size: clamp(2rem, 4vw, 2.6rem);
	font-weight: 900;
	margin: 0 0 10px 0;
	line-height: 1.25;
	letter-spacing: -0.5px;
}

.a7wmah-subtitle {
	color: var(--a7wmah-text-secondary);
	font-size: 1.08rem;
	max-width: 680px;
	margin: 0 auto;
	line-height: 1.7;
}

/* ==========================================================================
   Cards & Common Containers
   ========================================================================== */
.a7wmah-card {
	background: var(--a7wmah-bg);
	border: 1px solid var(--a7wmah-border);
	border-radius: var(--a7wmah-radius);
	padding: 28px;
	margin-bottom: 30px;
	box-shadow: var(--a7wmah-shadow);
	transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.a7wmah-card-header {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	margin-bottom: 22px;
}

.a7wmah-icon-bubble {
	width: 44px;
	height: 44px;
	min-width: 44px;
	border-radius: 12px;
	background: linear-gradient(135deg, #FFF0F6 0%, #FCE7F3 100%);
	color: var(--a7wmah-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.35rem;
	border: 1px solid rgba(237, 33, 124, 0.15);
}

.a7wmah-section-title {
	font-size: 1.3rem;
	font-weight: 800;
	color: var(--a7wmah-text);
	margin: 0 0 6px 0;
	line-height: 1.3;
}

.a7wmah-section-desc {
	font-size: 0.95rem;
	color: var(--a7wmah-text-secondary);
	margin: 0;
	line-height: 1.55;
}

/* ==========================================================================
   Input & Form Controls
   ========================================================================== */
.a7wmah-field-group {
	margin-bottom: 20px;
}

.a7wmah-label {
	display: block;
	font-weight: 700;
	font-size: 0.96rem;
	color: var(--a7wmah-text);
	margin-bottom: 8px;
}

.a7wmah-required-mark {
	color: var(--a7wmah-primary);
	margin-right: 4px;
}

.a7wmah-input-wrapper {
	position: relative;
	display: flex;
	align-items: center;
}

.a7wmah-input {
	width: 100%;
	padding: 14px 18px;
	padding-left: 45px;
	border: 2px solid var(--a7wmah-border);
	border-radius: var(--a7wmah-radius-sm);
	font-size: 1.05rem;
	font-family: inherit;
	color: var(--a7wmah-text);
	background: var(--a7wmah-surface);
	transition: all 0.2s ease;
	outline: none;
}

.a7wmah-input:focus {
	border-color: var(--a7wmah-primary);
	background: #FFFFFF;
	box-shadow: 0 0 0 4px rgba(237, 33, 124, 0.12);
}

.a7wmah-clear-btn {
	position: absolute;
	left: 14px;
	background: #CBD5E1;
	color: #475569;
	border: none;
	border-radius: 50%;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75rem;
	cursor: pointer;
	transition: all 0.2s;
}

.a7wmah-clear-btn:hover {
	background: var(--a7wmah-primary);
	color: #fff;
}

/* Chips */
.a7wmah-chips-section {
	margin-bottom: 24px;
}

.a7wmah-chips-title {
	display: block;
	font-size: 0.86rem;
	font-weight: 600;
	color: var(--a7wmah-muted);
	margin-bottom: 10px;
}

.a7wmah-chips-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.a7wmah-chip {
	background: var(--a7wmah-surface);
	border: 1px solid var(--a7wmah-border);
	border-radius: var(--a7wmah-radius-pill);
	padding: 6px 14px;
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--a7wmah-text);
	cursor: pointer;
	transition: all 0.2s ease;
	font-family: inherit;
}

.a7wmah-chip:hover {
	background: var(--a7wmah-primary-light);
	border-color: var(--a7wmah-primary);
	color: var(--a7wmah-primary);
	transform: translateY(-1px);
}

/* Buttons */
.a7wmah-actions {
	display: flex;
	gap: 12px;
}

.a7wmah-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 24px;
	border-radius: 12px;
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.2s ease;
	border: none;
	font-family: inherit;
	text-decoration: none;
}

.a7wmah-btn-sm {
	padding: 8px 16px;
	font-size: 0.88rem;
	border-radius: 8px;
}

.a7wmah-btn-primary {
	background: var(--a7wmah-primary-gradient);
	color: #FFFFFF !important;
	box-shadow: 0 4px 14px rgba(237, 33, 124, 0.28);
}

.a7wmah-btn-primary:hover {
	background: var(--a7wmah-primary-hover);
	transform: translateY(-2px);
	box-shadow: 0 6px 18px rgba(237, 33, 124, 0.35);
}

.a7wmah-btn-secondary {
	background: #1E293B;
	color: #FFFFFF;
}

.a7wmah-btn-secondary:hover {
	background: #0F172A;
	transform: translateY(-1px);
}

.a7wmah-btn-outline {
	background: #FFFFFF;
	border: 1px solid var(--a7wmah-border);
	color: var(--a7wmah-text);
}

.a7wmah-btn-outline:hover {
	background: var(--a7wmah-surface);
	border-color: var(--a7wmah-primary);
	color: var(--a7wmah-primary);
}

.a7wmah-btn-ghost {
	background: transparent;
	color: var(--a7wmah-text-secondary);
}

.a7wmah-btn-ghost:hover {
	background: var(--a7wmah-surface);
	color: var(--a7wmah-text);
}

.a7wmah-btn-icon {
	font-size: 1.15rem;
}

.a7wmah-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: a7wmah-spin 0.6s linear infinite;
}

.a7wmah-btn.is-loading .a7wmah-spinner {
	display: inline-block;
}
.a7wmah-btn.is-loading .a7wmah-btn-icon {
	display: none;
}

@keyframes a7wmah-spin {
	to { transform: rotate(360deg); }
}

/* Feedback message */
.a7wmah-feedback {
	margin-top: 14px;
	font-size: 0.92rem;
	font-weight: 600;
	display: none;
}
.a7wmah-feedback.is-error {
	display: block;
	color: #E11D48;
}

/* ==========================================================================
   Loading State Card
   ========================================================================== */
.a7wmah-loading-card {
	text-align: center;
	padding: 45px 24px;
}

.a7wmah-spinner-wrap {
	display: flex;
	justify-content: center;
	margin-bottom: 20px;
}

.a7wmah-spinner-big {
	width: 50px;
	height: 50px;
	border: 4px solid var(--a7wmah-primary-light);
	border-top-color: var(--a7wmah-primary);
	border-radius: 50%;
	animation: a7wmah-spin 0.8s linear infinite;
}

.a7wmah-loading-title {
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--a7wmah-text);
	margin: 0 0 8px 0;
}

.a7wmah-loading-subtitle {
	font-size: 0.92rem;
	color: var(--a7wmah-text-secondary);
	margin: 0 auto 24px;
	max-width: 480px;
}

.a7wmah-progress-bar {
	height: 6px;
	background: #F1F5F9;
	border-radius: 9999px;
	overflow: hidden;
	max-width: 380px;
	margin: 0 auto;
}

.a7wmah-progress-fill {
	height: 100%;
	width: 30%;
	background: var(--a7wmah-primary-gradient);
	border-radius: 9999px;
	animation: a7wmah-pulse-bar 2s ease-in-out infinite;
}

@keyframes a7wmah-pulse-bar {
	0% { width: 15%; }
	50% { width: 85%; }
	100% { width: 15%; }
}

/* ==========================================================================
   Results & Product Cards
   ========================================================================== */
.a7wmah-results-header {
	margin-bottom: 24px;
}

.a7wmah-filters-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--a7wmah-border);
}

.a7wmah-filter-btn {
	background: var(--a7wmah-surface);
	border: 1px solid var(--a7wmah-border);
	border-radius: var(--a7wmah-radius-pill);
	padding: 5px 14px;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--a7wmah-text-secondary);
	cursor: pointer;
	transition: all 0.2s;
	font-family: inherit;
}

.a7wmah-filter-btn.is-active,
.a7wmah-filter-btn:hover {
	background: var(--a7wmah-primary);
	border-color: var(--a7wmah-primary);
	color: #FFFFFF;
}

.a7wmah-products-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 20px;
	margin-bottom: 30px;
}

.a7wmah-product-card {
	background: #FFFFFF;
	border: 1px solid var(--a7wmah-border);
	border-radius: var(--a7wmah-radius-sm);
	padding: 22px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	box-shadow: var(--a7wmah-shadow-sm);
	transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
	position: relative;
	border-top: 4px solid var(--a7wmah-primary);
}

.a7wmah-product-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--a7wmah-shadow-hover);
	border-color: rgba(237, 33, 124, 0.3);
}

.a7wmah-card-top {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 14px;
}

.a7wmah-product-icon {
	font-size: 2rem;
	line-height: 1;
	background: var(--a7wmah-primary-light);
	width: 48px;
	height: 48px;
	min-width: 48px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.a7wmah-product-info {
	flex: 1;
}

.a7wmah-product-cat {
	display: inline-block;
	font-size: 0.76rem;
	font-weight: 700;
	color: var(--a7wmah-primary);
	background: var(--a7wmah-primary-light);
	padding: 2px 8px;
	border-radius: 4px;
	margin-bottom: 4px;
}

.a7wmah-product-name {
	font-size: 1.12rem;
	font-weight: 800;
	color: var(--a7wmah-text);
	margin: 0;
	line-height: 1.35;
}

.a7wmah-product-desc {
	font-size: 0.9rem;
	color: var(--a7wmah-text-secondary);
	margin: 0 0 16px 0;
	line-height: 1.55;
	flex-grow: 1;
}

.a7wmah-meta-badges {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	background: var(--a7wmah-surface);
	padding: 10px 12px;
	border-radius: 8px;
	margin-bottom: 16px;
}

.a7wmah-meta-item {
	font-size: 0.78rem;
	color: var(--a7wmah-text-secondary);
	display: flex;
	align-items: center;
	gap: 4px;
}

.a7wmah-meta-item strong {
	color: var(--a7wmah-text);
}

.a7wmah-card-action {
	margin-top: auto;
}

.a7wmah-view-recipe-btn {
	width: 100%;
	background: var(--a7wmah-primary-light);
	color: var(--a7wmah-primary);
	border: 1px solid rgba(237, 33, 124, 0.2);
	font-weight: 700;
	padding: 10px 16px;
	border-radius: 10px;
	font-size: 0.95rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: all 0.2s;
	font-family: inherit;
}

.a7wmah-view-recipe-btn:hover {
	background: var(--a7wmah-primary);
	color: #FFFFFF;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(237, 33, 124, 0.25);
}

.a7wmah-footer-actions {
	display: flex;
	justify-content: center;
	padding-top: 20px;
	border-top: 1px solid var(--a7wmah-border);
}

/* ==========================================================================
   Recipe Detail Modal
   ========================================================================== */
.a7wmah-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(15, 23, 42, 0.75);
	backdrop-filter: blur(4px);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	overflow-y: auto;
	animation: a7wmah-fade-in 0.2s ease;
}

@keyframes a7wmah-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

.a7wmah-modal-dialog {
	width: 100%;
	max-width: 820px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	animation: a7wmah-scale-up 0.25s ease;
}

@keyframes a7wmah-scale-up {
	from { transform: scale(0.95); opacity: 0; }
	to { transform: scale(1); opacity: 1; }
}

.a7wmah-modal-content {
	background: #FFFFFF;
	border-radius: var(--a7wmah-radius);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: var(--a7wmah-shadow);
}

.a7wmah-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	background: #FFFFFF;
	border-bottom: 1px solid var(--a7wmah-border);
}

.a7wmah-modal-title-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
}

.a7wmah-modal-icon {
	font-size: 1.8rem;
}

.a7wmah-modal-title {
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--a7wmah-text);
	margin: 0;
}

.a7wmah-modal-close {
	background: var(--a7wmah-surface);
	border: 1px solid var(--a7wmah-border);
	border-radius: 50%;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1rem;
	color: var(--a7wmah-text-secondary);
	cursor: pointer;
	transition: all 0.2s;
}

.a7wmah-modal-close:hover {
	background: var(--a7wmah-primary-light);
	color: var(--a7wmah-primary);
	border-color: var(--a7wmah-primary);
}

.a7wmah-modal-body {
	padding: 24px;
	overflow-y: auto;
	max-height: calc(90vh - 140px);
}

.a7wmah-modal-footer {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 16px 24px;
	background: var(--a7wmah-surface);
	border-top: 1px solid var(--a7wmah-border);
}

/* Modal Internal Sections */
.a7wmah-recipe-banner {
	background: linear-gradient(135deg, #FFF0F6 0%, #FAFAFA 100%);
	border: 1px solid rgba(237, 33, 124, 0.15);
	border-radius: 12px;
	padding: 18px;
	margin-bottom: 24px;
}

.a7wmah-recipe-banner-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
}

.a7wmah-badge {
	font-size: 0.8rem;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: var(--a7wmah-radius-pill);
	background: #FFFFFF;
	border: 1px solid var(--a7wmah-border);
	color: var(--a7wmah-text);
}

.a7wmah-badge-primary {
	background: var(--a7wmah-primary);
	color: #FFFFFF;
	border-color: var(--a7wmah-primary);
}

.a7wmah-badge-green {
	background: var(--a7wmah-green);
	color: #FFFFFF;
	border-color: var(--a7wmah-green);
}

.a7wmah-recipe-summary {
	font-size: 0.95rem;
	color: #334155;
	margin: 0;
	line-height: 1.6;
}

.a7wmah-recipe-section-title {
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--a7wmah-text);
	margin: 0 0 14px 0;
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Ingredients List */
.a7wmah-ingredients-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 10px;
	margin-bottom: 24px;
}

.a7wmah-ingredient-item {
	background: var(--a7wmah-surface);
	border: 1px solid var(--a7wmah-border);
	border-radius: 8px;
	padding: 10px 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.a7wmah-ing-name {
	font-weight: 700;
	font-size: 0.92rem;
	color: var(--a7wmah-text);
}

.a7wmah-ing-amount {
	font-size: 0.82rem;
	font-weight: 700;
	background: #FFFFFF;
	color: var(--a7wmah-primary);
	border: 1px solid rgba(237, 33, 124, 0.2);
	padding: 2px 8px;
	border-radius: 4px;
}

/* Steps */
.a7wmah-steps-list {
	list-style: none;
	padding: 0;
	margin: 0 0 24px 0;
	counter-reset: a7wmah-step-counter;
}

.a7wmah-step-item {
	counter-increment: a7wmah-step-counter;
	position: relative;
	padding-right: 48px;
	margin-bottom: 16px;
	font-size: 0.96rem;
	line-height: 1.65;
	color: #334155;
}

.a7wmah-step-item::before {
	content: counter(a7wmah-step-counter);
	position: absolute;
	right: 0;
	top: 0;
	width: 32px;
	height: 32px;
	background: var(--a7wmah-primary-gradient);
	color: #FFFFFF;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 0.9rem;
	box-shadow: 0 2px 6px rgba(237, 33, 124, 0.2);
}

/* Pro Tips & Storage Box */
.a7wmah-tips-box {
	background: var(--a7wmah-green-light);
	border: 1px solid rgba(140, 198, 63, 0.3);
	border-radius: 12px;
	padding: 16px;
	margin-bottom: 14px;
}

.a7wmah-tips-box h4 {
	color: #4D7C0F;
	font-size: 0.98rem;
	font-weight: 800;
	margin: 0 0 8px 0;
	display: flex;
	align-items: center;
	gap: 6px;
}

.a7wmah-tips-box p {
	font-size: 0.9rem;
	color: #365314;
	margin: 0;
	line-height: 1.55;
}

/* Toast */
.a7wmah-toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	background: #0F172A;
	color: #FFFFFF;
	padding: 10px 22px;
	border-radius: var(--a7wmah-radius-pill);
	font-size: 0.92rem;
	font-weight: 700;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
	z-index: 1000000;
	animation: a7wmah-fade-up 0.2s ease;
}

@keyframes a7wmah-fade-up {
	from { opacity: 0; transform: translate(-50%, 10px); }
	to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
   Print Stylesheet (A4)
   ========================================================================== */
@media print {
	body * {
		visibility: hidden;
	}

	.a7wmah-app,
	.a7wmah-modal-dialog,
	.a7wmah-modal-dialog * {
		visibility: visible;
	}

	.a7wmah-modal-overlay {
		position: static;
		background: none;
		padding: 0;
	}

	.a7wmah-modal-dialog {
		max-width: 100%;
		box-shadow: none;
	}

	.a7wmah-modal-header .a7wmah-modal-close,
	.a7wmah-modal-footer,
	.a7wmah-header,
	.a7wmah-form-section,
	.a7wmah-results-section {
		display: none !important;
	}
}

/* Responsive */
@media (max-width: 640px) {
	.a7wmah-products-grid {
		grid-template-columns: 1fr;
	}
	.a7wmah-modal-header {
		padding: 16px;
	}
	.a7wmah-modal-body {
		padding: 16px;
	}
}
