@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&family=Vazirmatn:wght@300;400;500;600;700;800&family=Tajawal:wght@300;400;500;700;800&display=swap');

/**
 * Gulf Prayer Times Widget Stylesheet - Horizontal Redesign
 * Visually replicates the clean, horizontal, bento-inspired layout of reference "عکس دوم"
 * Fully responsive, supports RTL naturally, and comes with beautiful high-fidelity styling.
 */

.gpt-container {
	--gpt-bg-main: #ffffff;
	--gpt-border-color: #cbd5e1;
	--gpt-text-primary: #0f172a; /* Deep elegant navy slate */
	--gpt-text-secondary: #475569;
	--gpt-text-muted: #94a3b8;
	--gpt-gold: #0da29b; /* Elegant brand teal matching user site */
	--gpt-gold-bg: rgba(13, 162, 155, 0.07); /* Brand teal light background */
	--gpt-font-sans: 'Inter', 'Vazirmatn', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
	--gpt-font-mono: 'JetBrains Mono', ui-monospace, monospace;
	--gpt-radius: 12px;
	
	background: var(--gpt-bg-main);
	color: var(--gpt-text-primary);
	font-family: var(--gpt-font-sans);
	border: 1px solid var(--gpt-border-color);
	border-radius: var(--gpt-radius);
	padding: 24px 32px;
	max-width: 100%;
	margin: 20px auto;
	box-shadow: 0 4px 20px -2px rgba(148, 163, 184, 0.08);
	position: relative;
	overflow: visible;
	direction: rtl !important; /* Force RTL layout naturally to match reference site */
	box-sizing: border-box;
}

/* Theme Dark override */
.gpt-container.gpt-theme-dark {
	--gpt-bg-main: #0f172a;
	--gpt-border-color: #334155;
	--gpt-text-primary: #f8fafc;
	--gpt-text-secondary: #cbd5e1;
	--gpt-text-muted: #64748b;
	--gpt-gold: #0da29b;
}

.gpt-container *, 
.gpt-container *::before, 
.gpt-container *::after {
	box-sizing: border-box;
}

/* Loading Overlay */
.gpt-loader-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.85);
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
	border-radius: var(--gpt-radius);
}

.gpt-theme-dark .gpt-loader-overlay {
	background: rgba(15, 23, 42, 0.85);
}

.gpt-container.gpt-loading .gpt-loader-overlay {
	opacity: 1;
	pointer-events: auto;
}

.gpt-loader-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid rgba(198, 154, 80, 0.1);
	border-top-color: var(--gpt-gold);
	border-radius: 50%;
	animation: gpt-spin 0.8s linear infinite;
}

@keyframes gpt-spin {
	to { transform: rotate(360deg); }
}

/* Header Section */
.gpt-title-section {
	text-align: center;
	padding-bottom: 12px;
}

.gpt-title-text {
	font-size: 20px;
	font-weight: 700;
	color: var(--gpt-text-primary);
	margin: 0;
	letter-spacing: -0.02em;
}

.gpt-divider {
	height: 2px;
	background-color: var(--gpt-text-primary); /* Bold header accent line matching reference site */
	opacity: 1;
	margin: 0 0 24px 0;
	width: 100%;
}

/* Main Split Layout */
.gpt-content-layout {
	display: flex;
	flex-direction: row !important; /* Force Dropdowns on the right, Timings on the left under direction: rtl */
	gap: 40px;
	align-items: flex-start;
	justify-content: space-between;
}

@media (min-width: 769px) {
	.gpt-selectors-side {
		order: 1; /* Selector is on the right in RTL desktop */
	}
	.gpt-timings-side {
		order: 2; /* Timings are on the left in RTL desktop */
	}
}

/* Left Timings Area */
.gpt-timings-side {
	flex: 1;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	grid-template-rows: repeat(3, auto);
	grid-auto-flow: column;
	gap: 16px 32px;
}

.gpt-timing-item {
	display: flex;
	align-items: center;
	flex-direction: row; /* Natural flex layout: Icon right, Text center, Time left in RTL */
	justify-content: flex-start; /* Bring clock times closer to their labels */
	gap: 12px;
	background: #ffffff; /* Explicit white box background in light theme */
	padding: 10px 16px; /* Elegant padding for box feel */
	border-radius: var(--gpt-radius);
	border: 1px solid var(--gpt-border-color); /* Visible box border around each item */
	transition: all 0.2s;
}

.gpt-theme-dark .gpt-timing-item {
	background: #1e293b; /* Dark theme card background */
	border-color: #334155;
}

/* Light indicator for active prayer (Task 6) */
.gpt-timing-item.active {
	background: transparent !important; /* No background */
	border-color: var(--gpt-gold) !important; /* Visible green border */
	border-width: 1.5px;
}

.gpt-item-text {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: var(--gpt-text-primary);
	/* flex: 1 removed to bring the clock/time closer to the label */
}

.gpt-item-label {
	font-weight: 600;
	color: var(--gpt-text-secondary);
}

.gpt-item-colon {
	color: var(--gpt-text-muted);
}

.gpt-item-time-group {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	direction: ltr; /* Ensure English reading order: AM/PM on left, time on right */
}

.gpt-item-time {
	font-weight: 700;
	font-family: var(--gpt-font-sans);
	color: var(--gpt-text-primary);
}

.gpt-item-ampm {
	font-size: 11px;
	font-weight: 700;
	padding: 2px 6px;
	border-radius: 4px;
	color: var(--gpt-text-muted);
	background: rgba(148, 163, 184, 0.1);
	border: 1px solid transparent;
	transition: all 0.2s ease;
	min-width: 28px;
	text-align: center;
}



.gpt-item-icon {
	color: var(--gpt-gold);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
}

.gpt-svg {
	width: 18px;
	height: 18px;
	stroke: var(--gpt-gold);
}

/* Right Selectors Area */
.gpt-selectors-side {
	width: 320px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* Clock Card Styles */
.gpt-clock-card {
	background: rgba(13, 162, 155, 0.05);
	border: 1px solid var(--gpt-border-color);
	border-radius: 8px;
	padding: 16px;
	text-align: center;
	transition: all 0.3s ease;
}

.gpt-clock-label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--gpt-text-muted);
	margin-bottom: 6px;
	letter-spacing: 0.05em;
}

.gpt-clock-time {
	font-size: 28px;
	font-weight: 800;
	font-family: var(--gpt-font-sans);
	color: var(--gpt-gold);
	direction: ltr !important;
	unicode-bidi: embed;
	display: inline-block;
}

.gpt-clock-location {
	font-size: 11px;
	font-weight: 600;
	color: var(--gpt-text-muted);
	margin-top: 6px;
}

.gpt-theme-dark .gpt-clock-card {
	background: rgba(13, 162, 155, 0.08);
	border-color: #334155;
}

/* Input Fields outline style */
.gpt-select-field {
	position: relative;
	width: 100%;
}

.gpt-field-label {
	position: absolute;
	top: -9px;
	right: 12px;
	background: var(--gpt-bg-main);
	padding: 0 6px;
	font-size: 11px;
	font-weight: 600;
	color: var(--gpt-text-muted);
	z-index: 10;
	pointer-events: none;
	transition: color 0.2s;
}

.gpt-select-field:focus-within .gpt-field-label {
	color: var(--gpt-gold);
}

.gpt-select-container {
	position: relative;
	width: 100%;
	border: 1px solid var(--gpt-border-color);
	border-radius: 8px;
	background: transparent;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.gpt-select-field:focus-within .gpt-select-container {
	border-color: var(--gpt-gold);
	box-shadow: 0 0 0 3px rgba(13, 162, 155, 0.08);
}

.gpt-select-element {
	width: 100%;
	background: transparent;
	border: none;
	outline: none;
	padding: 12px 14px;
	padding-left: 36px; /* Space for chevron on left in RTL */
	padding-right: 14px;
	font-size: 14px;
	font-weight: 600;
	color: var(--gpt-text-primary);
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	font-family: var(--gpt-font-sans);
}

/* In LTR, reverse select padding */
[dir="ltr"] .gpt-select-element {
	padding-left: 14px;
	padding-right: 36px;
}

.gpt-select-element.has-left-icons {
	padding-left: 72px; /* Extra space for clears/pins on left */
}

[dir="ltr"] .gpt-select-element.has-left-icons {
	padding-right: 72px;
	padding-left: 14px;
}

.gpt-chevron {
	position: absolute;
	top: 50%;
	left: 12px;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	color: var(--gpt-text-muted);
	pointer-events: none;
	display: flex;
	align-items: center;
	justify-content: center;
}

[dir="ltr"] .gpt-chevron {
	left: auto;
	right: 12px;
}

.gpt-chevron svg {
	width: 100%;
	height: 100%;
	stroke: currentColor;
}

/* Left decoration icons in dropdown */
.gpt-select-left-icons {
	position: absolute;
	top: 50%;
	left: 32px;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	gap: 6px;
	z-index: 5;
	pointer-events: none;
}

[dir="ltr"] .gpt-select-left-icons {
	left: auto;
	right: 32px;
}

.gpt-icon-clear {
	font-size: 14px;
	color: var(--gpt-text-muted);
	cursor: pointer;
	opacity: 0.6;
	font-weight: 700;
}

.gpt-icon-user {
	width: 14px;
	height: 14px;
	color: var(--gpt-text-muted);
	display: flex;
	align-items: center;
}

.gpt-icon-user svg {
	width: 100%;
	height: 100%;
	stroke: currentColor;
}

/* Custom Dropdown Styling to Prevent Overlapping with Input Fields */
.gpt-custom-dropdown {
	position: relative;
	width: 100%;
}

.gpt-custom-trigger {
	display: flex;
	align-items: center;
	width: 100%;
	background: transparent;
	border: none;
	outline: none;
	height: 44px;
	position: relative;
	cursor: pointer;
}

/* In RTL (default), actions are on the left, input on the right */
[dir="rtl"] .gpt-custom-trigger {
	flex-direction: row-reverse;
}

[dir="ltr"] .gpt-custom-trigger {
	flex-direction: row;
}

.gpt-custom-search-input {
	flex: 1;
	width: 100%;
	height: 100%;
	background: transparent;
	border: none;
	outline: none;
	font-size: 14px;
	font-weight: 600;
	color: var(--gpt-text-primary) !important;
	padding: 0 14px;
	font-family: var(--gpt-font-sans);
	text-align: right; /* RTL default */
}

[dir="ltr"] .gpt-custom-search-input {
	text-align: left;
}

.gpt-input-actions {
	display: flex;
	flex-direction: row !important; /* Force left-to-right flow so Chevron is leftmost and Clear is to its right */
	align-items: center;
	gap: 6px;
	padding: 0 12px;
}

.gpt-clear-btn {
	background: transparent;
	border: none;
	outline: none;
	padding: 4px;
	cursor: pointer;
	color: var(--gpt-text-muted);
	display: none; /* Managed by JS */
	align-items: center;
	justify-content: center;
	transition: color 0.2s;
}

.gpt-clear-btn:hover {
	color: var(--gpt-text-primary);
}

.gpt-clear-svg {
	width: 14px;
	height: 14px;
}

.gpt-chevron {
	color: var(--gpt-text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	transition: transform 0.2s;
}

/* Rotate chevron when dropdown is open */
.gpt-custom-dropdown.open .gpt-chevron {
	transform: rotate(180deg);
}

.gpt-custom-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin-top: 4px;
	background: var(--gpt-bg-main);
	border: 1px solid var(--gpt-border-color);
	border-radius: 8px;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
	z-index: 1000;
	max-height: 240px;
	overflow-y: auto;
}

/* Elegant scrollbar for dropdown menus */
.gpt-custom-menu::-webkit-scrollbar {
	width: 5px;
}
.gpt-custom-menu::-webkit-scrollbar-track {
	background: transparent;
}
.gpt-custom-menu::-webkit-scrollbar-thumb {
	background: rgba(156, 163, 175, 0.3);
	border-radius: 9999px;
}
.gpt-custom-menu::-webkit-scrollbar-thumb:hover {
	background: rgba(156, 163, 175, 0.5);
}

.gpt-custom-dropdown.open .gpt-custom-menu {
	display: block;
}

.gpt-custom-item {
	padding: 10px 14px;
	font-size: 13px;
	font-weight: 500;
	color: var(--gpt-text-secondary);
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
	text-align: right;
}

[dir="ltr"] .gpt-custom-item {
	text-align: left;
}

.gpt-custom-item:hover {
	background-color: #f1f5f9;
	color: var(--gpt-text-primary);
}

.gpt-custom-item.selected {
	background-color: #f1f5f9;
	color: var(--gpt-text-primary);
	font-weight: 700;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
	.gpt-container {
		padding: 20px 24px;
	}
	.gpt-content-layout {
		flex-direction: column !important; /* Stack selectors on top on mobile, timings below */
		gap: 24px;
	}
	.gpt-selectors-side {
		width: 100%;
	}
	.gpt-timings-side {
		width: 100%;
	}
}

@media (max-width: 576px) {
	.gpt-timings-side {
		grid-template-columns: 1fr;
		grid-template-rows: none;
		grid-auto-flow: row;
		gap: 12px;
	}
	.gpt-container {
		padding: 16px;
	}
}
