/**
 * Israeli Privacy Consent – Frontend Base Styles
 * גיליון סגנונות בסיסי לבאנר הסכמת עוגיות
 *
 * @package IsraeliPrivacyConsent
 * @version 2.0.0
 *
 * משתני CSS מוגדרים דינמית מ-PHP:
 * --ipc-bg-color, --ipc-text-color, --ipc-title-color,
 * --ipc-primary-btn-bg, --ipc-primary-btn-text,
 * --ipc-secondary-btn-bg, --ipc-secondary-btn-text,
 * --ipc-checkbox-text-color, --ipc-border-radius,
 * --ipc-font-size, --ipc-shadow-opacity, --ipc-bg-opacity,
 * --ipc-max-width, --ipc-fab-bg, --ipc-fab-color, --ipc-fab-size
 */

/* ==========================================================================
   1. ברירות מחדל למשתנים (fallbacks)
   ========================================================================== */

:root {
	--ipc-bg-color: #ffffff;
	--ipc-text-color: #333333;
	--ipc-title-color: #1B2B5B;
	--ipc-primary-btn-bg: #0EA5A0;
	--ipc-primary-btn-text: #ffffff;
	--ipc-secondary-btn-bg: #e5e7eb;
	--ipc-secondary-btn-text: #374151;
	--ipc-checkbox-text-color: #333333;
	--ipc-border-radius: 12px;
	--ipc-font-size: 14px;
	--ipc-shadow-opacity: 15;
	--ipc-bg-opacity: 100;
	--ipc-max-width: 420px;
	--ipc-fab-bg: #0EA5A0;
	--ipc-fab-color: #ffffff;
	--ipc-fab-size: 48px;
}

/* ==========================================================================
   2. סגנונות בסיס לבאנר (משותף לכל התבניות)
   ========================================================================== */

.ipc-banner {
	position: fixed;
	z-index: 99999;
	box-sizing: border-box;
	direction: rtl;
	text-align: right;
	font-family: inherit;
	font-size: var(--ipc-font-size, 14px);
	line-height: 1.6;
	color: var(--ipc-text-color, #333333);
	background-color: var(--ipc-bg-color, #ffffff);
	border-radius: var(--ipc-border-radius, 12px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

/* רקע עם שקיפות - משתמשים ב-rgba לפי ערך bg-opacity */
.ipc-banner[data-bg-opacity] {
	background-color: var(--ipc-bg-color, #ffffff);
}

/* ==========================================================================
   3. כפתור סגירה
   ========================================================================== */

.ipc-close-btn {
	position: absolute;
	top: 10px;
	left: 12px;
	background: transparent;
	border: none;
	font-size: 22px;
	cursor: pointer;
	color: var(--ipc-text-color, #333333);
	padding: 4px 8px;
	opacity: 0.6;
	transition: opacity 0.2s ease, transform 0.2s ease;
	line-height: 1;
	border-radius: 4px;
	z-index: 1;
}

.ipc-close-btn:hover {
	opacity: 1;
	transform: scale(1.1);
}

.ipc-close-btn:focus-visible {
	outline: 2px solid var(--ipc-primary-btn-bg, #0EA5A0);
	outline-offset: 2px;
}

/* ==========================================================================
   4. תוכן הבאנר
   ========================================================================== */

.ipc-banner-content {
	margin-bottom: 12px;
}

.ipc-banner-content h4 {
	margin: 0 0 8px;
	padding: 0;
	font-size: calc(var(--ipc-font-size, 14px) + 4px);
	font-weight: 700;
	color: var(--ipc-title-color, #1B2B5B);
	line-height: 1.4;
}

.ipc-banner-content p {
	margin: 0 0 12px;
	padding: 0;
	font-size: var(--ipc-font-size, 14px);
	color: var(--ipc-text-color, #333333);
	line-height: 1.6;
}

.ipc-banner-content p:last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   5. כפתורים
   ========================================================================== */

.ipc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--ipc-border-radius, 12px);
	padding: 10px 20px;
	font-size: var(--ipc-font-size, 14px);
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	border: 1px solid transparent;
	transition: filter 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	white-space: nowrap;
	line-height: 1.4;
	box-sizing: border-box;
}

.ipc-btn:hover {
	filter: brightness(92%);
	transform: translateY(-1px);
}

.ipc-btn:active {
	filter: brightness(88%);
	transform: translateY(0);
}

.ipc-btn:focus-visible {
	outline: 2px solid var(--ipc-primary-btn-bg, #0EA5A0);
	outline-offset: 2px;
}

/* כפתור ראשי */
.ipc-btn-primary {
	background-color: var(--ipc-primary-btn-bg, #0EA5A0);
	color: var(--ipc-primary-btn-text, #ffffff);
	border-color: var(--ipc-primary-btn-bg, #0EA5A0);
}

/* כפתור משני */
.ipc-btn-secondary {
	background-color: var(--ipc-secondary-btn-bg, #e5e7eb);
	color: var(--ipc-secondary-btn-text, #374151);
	border-color: #d1d5db;
}

/* כפתור קישור (לניהול העדפות) */
.ipc-btn-link {
	background: transparent;
	color: var(--ipc-text-color, #333333);
	border: none;
	padding: 8px 12px;
	font-weight: 500;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ipc-btn-link:hover {
	filter: none;
	transform: none;
	opacity: 0.7;
}

/* כפתור קטן (עבור תבנית מינימלית) */
.ipc-btn-sm {
	padding: 6px 14px;
	font-size: calc(var(--ipc-font-size, 14px) - 1px);
	border-radius: calc(var(--ipc-border-radius, 12px) * 0.7);
}

/* ==========================================================================
   6. קישור למדיניות פרטיות
   ========================================================================== */

.ipc-privacy-link-wrapper {
	text-align: center;
	margin-top: 10px;
	padding-top: 8px;
}

.ipc-privacy-link-wrapper a {
	color: var(--ipc-text-color, #333333);
	font-size: calc(var(--ipc-font-size, 14px) - 1px);
	text-decoration: underline;
	text-underline-offset: 3px;
	opacity: 0.7;
	transition: opacity 0.2s ease;
}

.ipc-privacy-link-wrapper a:hover {
	opacity: 1;
}

/* ==========================================================================
   7. ערכות נושא (Themes)
   ========================================================================== */

/* ערכת נושא בהירה - ברירת מחדל */
.ipc-theme-light {
	background-color: var(--ipc-bg-color, #ffffff);
	color: var(--ipc-text-color, #333333);
}

.ipc-theme-light .ipc-btn-secondary {
	border-color: #d1d5db;
}

/* ערכת נושא כהה */
.ipc-theme-dark {
	background-color: var(--ipc-bg-color, #1f2937);
	color: var(--ipc-text-color, #e5e7eb);
}

.ipc-theme-dark .ipc-close-btn {
	color: var(--ipc-text-color, #e5e7eb);
}

.ipc-theme-dark .ipc-banner-content h4 {
	color: var(--ipc-title-color, #f3f4f6);
}

.ipc-theme-dark .ipc-banner-content p {
	color: var(--ipc-text-color, #d1d5db);
}

.ipc-theme-dark .ipc-btn-secondary {
	border-color: #4b5563;
}

.ipc-theme-dark .ipc-btn-link {
	color: var(--ipc-text-color, #d1d5db);
}

.ipc-theme-dark .ipc-privacy-link-wrapper a {
	color: var(--ipc-text-color, #d1d5db);
}

/* ==========================================================================
   8. תיבת סימון לטפסים (Form Consent Checkbox)
   ========================================================================== */

/* מעטפת כללית */
.ipc-form-consent-wrapper {
	display: flex;
	align-items: flex-start;
	gap: 0;
	margin: 12px 0;
	font-size: 14px;
	font-family: inherit;
	color: var(--ipc-checkbox-text-color, #333333);
	direction: rtl;
	text-align: right;
	line-height: 1.5;
}

/* הסתרת הצ'קבוקס המקורי */
.ipc-form-consent-wrapper input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
}

/* תווית עם צ'קבוקס מעוצב */
.ipc-form-consent-wrapper label {
	display: flex;
	align-items: flex-start;
	cursor: pointer;
	user-select: none;
	gap: 0;
	line-height: 1.5;
}

/* התיבה המעוצבת (pseudo-element) */
.ipc-form-consent-wrapper label::before {
	content: '';
	display: inline-block;
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	min-width: 20px;
	border: 2px solid #cbd5e1;
	border-radius: 4px;
	margin-left: 10px;
	margin-top: 1px;
	background-color: #ffffff;
	transition: all 0.2s ease;
	box-sizing: border-box;
}

/* מצב hover */
.ipc-form-consent-wrapper label:hover::before {
	border-color: var(--ipc-primary-btn-bg, #0EA5A0);
}

/* מצב checked - סימן V */
.ipc-form-consent-wrapper input[type="checkbox"]:checked + label::before {
	background-color: var(--ipc-primary-btn-bg, #0EA5A0);
	border-color: var(--ipc-primary-btn-bg, #0EA5A0);
	content: '\2713';
	color: #ffffff;
	font-size: 14px;
	font-weight: 700;
	text-align: center;
	line-height: 20px;
}

/* מצב focus */
.ipc-form-consent-wrapper input[type="checkbox"]:focus-visible + label::before {
	outline: 2px solid var(--ipc-primary-btn-bg, #0EA5A0);
	outline-offset: 2px;
}

/* קישורים בתוך התווית */
.ipc-form-consent-wrapper a {
	color: var(--ipc-primary-btn-bg, #0EA5A0);
	text-decoration: underline;
	text-underline-offset: 2px;
	transition: opacity 0.2s ease;
}

.ipc-form-consent-wrapper a:hover {
	opacity: 0.7;
}

/* --- סגנון נקי (ברירת מחדל) --- */
.ipc-checkbox-clean {
	/* ללא גבול או רקע נוסף */
}

/* --- סגנון מסגרת (boxed) --- */
.ipc-checkbox-boxed {
	background-color: #f8fafc;
	border: 1px solid #e2e8f0;
	padding: 12px 15px;
	border-radius: 8px;
}

.ipc-checkbox-boxed:hover {
	border-color: #cbd5e1;
}

/* --- סגנון אינליין --- */
.ipc-checkbox-inline {
	display: inline-flex;
	margin: 8px 0;
	font-size: 13px;
}

.ipc-checkbox-inline label::before {
	width: 16px;
	height: 16px;
	min-width: 16px;
	margin-left: 6px;
}

.ipc-checkbox-inline input[type="checkbox"]:checked + label::before {
	font-size: 11px;
	line-height: 16px;
}

/* ==========================================================================
   9. הודעת שגיאה לצ'קבוקס חובה
   ========================================================================== */

.ipc-consent-error {
	color: #dc2626;
	font-size: 12px;
	margin-top: 4px;
	display: none;
}

.ipc-form-consent-wrapper.ipc-error .ipc-consent-error {
	display: block;
}

.ipc-form-consent-wrapper.ipc-error label::before {
	border-color: #dc2626;
}

/* ==========================================================================
   10. רספונסיבי - מובייל
   ========================================================================== */

@media (max-width: 767px) {
	.ipc-banner {
		font-size: 13px;
	}

	.ipc-banner-content h4 {
		font-size: 16px;
	}

	.ipc-btn {
		padding: 9px 16px;
		font-size: 13px;
	}

	.ipc-btn-sm {
		padding: 6px 12px;
		font-size: 12px;
	}

	.ipc-form-consent-wrapper {
		font-size: 13px;
	}

	.ipc-form-consent-wrapper label::before {
		width: 18px;
		height: 18px;
		min-width: 18px;
	}

	.ipc-form-consent-wrapper input[type="checkbox"]:checked + label::before {
		font-size: 12px;
		line-height: 18px;
	}
}

/* ==========================================================================
   11. נגישות - מצב מיקוד גבוה
   ========================================================================== */

@media (forced-colors: active) {
	.ipc-banner {
		border: 2px solid currentColor;
	}

	.ipc-btn {
		border: 1px solid currentColor;
	}

	.ipc-form-consent-wrapper label::before {
		border: 2px solid currentColor;
	}
}

/* ==========================================================================
   12. הדפסה - הסתרת הבאנר
   ========================================================================== */

@media print {
	.ipc-banner,
	.ipc-overlay,
	.ipc-fab {
		display: none !important;
	}
}
