/* Visual language intentionally mirrors the original taqwim-gratuity-calculator
   design (dark gradient banner header, thick brand-colored outer border,
   tinted inset section blocks) rather than the newer thin-border/white-card
   pattern used elsewhere on the site — this was an explicit, deliberate
   choice for this widget. */

.tq-imsakiya {
	--tq-brand: #4a6b5a;
	--tq-brand-dark: #3a5548;
	--tq-brand-light: #eef4f1;
	--tq-brand-border: rgba(74, 107, 90, 0.16);
	--tq-section-border: rgba(74, 107, 90, 0.4);
	--tq-text: #22302b;
	--tq-muted: #57685f;
	--tq-border: #d7e3de;
	--tq-radius: 16px;

	font-family: 'IBM Plex Sans Arabic', Tahoma, Arial, sans-serif;
	color: var(--tq-text);
	width: 100%;
	max-width: 100%;
	margin: 0 auto;
	box-sizing: border-box;
	border: 3px solid var(--tq-brand);
	border-radius: var(--tq-radius);
	overflow: hidden;
	background: #ffffff;
}
.tq-imsakiya * {
	box-sizing: border-box;
}

/* Header — full-bleed dark gradient banner */
.tq-imsakiya-header {
	background: linear-gradient(135deg, #5c7d6c 0%, var(--tq-brand) 100%);
	color: #ffffff;
	text-align: center;
	padding: 14px 20px;
}
.tq-imsakiya-header-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}
.tq-imsakiya-header-icon {
	display: inline-flex;
	width: 22px;
	height: 22px;
	color: #ffffff;
	flex-shrink: 0;
}
.tq-imsakiya-header-title {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
}
.tq-imsakiya-header-subtitle {
	margin: 6px 0 0;
	font-size: 14px;
	font-weight: 400;
	opacity: 0.9;
}

/* Country picker — tinted inset block, same as the gratuity "country block" */
.tq-imsakiya-country-picker {
	margin: 16px 20px 0;
	padding: 16px;
	background: var(--tq-brand-light);
	border: 2px solid var(--tq-section-border);
	border-radius: 14px;
	text-align: center;
}
.tq-imsakiya-country-picker label {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0 0 10px;
	font-size: 15px;
	font-weight: 700;
	color: var(--tq-brand-dark);
}
.tq-imsakiya-step-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--tq-brand);
	color: #ffffff;
	flex-shrink: 0;
}
.tq-imsakiya-country-picker select {
	display: block;
	width: 100%;
	appearance: none;
	background: #ffffff url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2357685f' stroke-width='1.8'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat left 14px center / 16px 16px;
	border: 1.5px solid var(--tq-border);
	border-radius: 10px;
	padding: 12px 40px;
	font-family: inherit;
	font-size: clamp(13.5px, 3.8vw, 16px);
	font-weight: 600;
	color: var(--tq-text);
	text-align: center;
	text-align-last: center;
	cursor: pointer;
}
.tq-imsakiya-country-picker select:focus {
	outline: none;
	border-color: var(--tq-brand);
}

/* Body wrapper */
.tq-imsakiya-body {
	background: #ffffff;
	padding: 20px;
}

/* Hero card — tinted inset block, same recipe as a gratuity section-card */
.tq-imsakiya-hero {
	background: var(--tq-brand-light);
	border: 2px solid var(--tq-section-border);
	border-radius: 14px;
	padding: 20px 16px;
	text-align: center;
	margin-bottom: 18px;
}
.tq-imsakiya-hero-title {
	margin: 0 0 10px;
	font-weight: 700;
	color: var(--tq-brand-dark);
	font-size: clamp(11px, 4vw, 17px);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
}
.tq-imsakiya-hero-label {
	margin: 0 0 14px;
	color: var(--tq-brand-dark);
	font-weight: 700;
	font-size: 13.5px;
}
.tq-imsakiya-hero-countdown {
	display: flex;
	align-items: stretch;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
	margin: 0 0 4px;
}
.tq-imsakiya-cd-box {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-width: 58px;
	background: #ffffff;
	border: 1.5px solid var(--tq-section-border);
	border-radius: 10px;
	padding: 8px 6px;
}
.tq-imsakiya-cd-num {
	font-weight: 800;
	color: var(--tq-brand-dark);
	font-size: clamp(18px, 4vw, 24px);
	line-height: 1;
	font-variant-numeric: tabular-nums;
}
/* The days box is the headline figure — visibly bigger and bolder than
   hours/minutes/seconds, since "how many days left" is what people scan
   for first. */
.tq-imsakiya-cd-box.is-days {
	background: var(--tq-brand);
	border-color: var(--tq-brand);
	min-width: 70px;
}
.tq-imsakiya-cd-box.is-days .tq-imsakiya-cd-num {
	color: #ffffff;
	font-size: clamp(24px, 5.5vw, 32px);
	font-weight: 800;
}
.tq-imsakiya-cd-box.is-days .tq-imsakiya-cd-label {
	color: rgba(255, 255, 255, 0.85);
}
.tq-imsakiya-cd-label {
	font-size: 11px;
	font-weight: 700;
	color: var(--tq-muted);
}
.tq-imsakiya-hero-meta {
	margin: 14px 0 0;
	color: var(--tq-brand-dark);
	font-size: 14px;
	font-weight: 800;
}

/* Table wrapper — same tinted-section recipe, table itself stays white inside it */
.tq-imsakiya-table-wrap {
	background: var(--tq-brand-light);
	border: 2px solid var(--tq-section-border);
	border-radius: 14px;
	overflow: hidden;
}
.tq-imsakiya-table-header {
	display: flex;
	align-items: center;
	gap: 6px;
	background: var(--tq-brand);
	color: #ffffff;
	padding: 12px 16px;
	font-weight: 700;
	font-size: clamp(11px, 4vw, 17px);
}
.tq-imsakiya-table-header svg {
	flex-shrink: 0;
}
.tq-imsakiya-title-text {
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tq-imsakiya-scroll-hint {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: var(--tq-brand);
	color: #ffffff;
	font-weight: 700;
	font-size: 0.8rem;
	padding: 8px;
	margin: 8px 12px;
	border: 1.5px solid #ffffff;
	border-radius: 8px;
	overflow: hidden;
}
.tq-imsakiya-scroll-hint span {
	display: inline-block;
	animation: tq-imsakiya-scroll-nudge 1.4s ease-in-out infinite;
}
.tq-imsakiya-scroll-hint span:last-child {
	animation-delay: 0.15s;
}
@keyframes tq-imsakiya-scroll-nudge {
	0%, 100% { transform: translateX(0); }
	50% { transform: translateX(-4px); }
}
@media (prefers-reduced-motion: reduce) {
	.tq-imsakiya-scroll-hint span {
		animation: none;
	}
}
.tq-imsakiya-table {
	width: 100%;
	background: #ffffff;
	border-collapse: collapse;
	font-size: 13.5px;
}
.tq-imsakiya-table th,
.tq-imsakiya-table td {
	padding: 10px 8px;
	text-align: center;
	white-space: nowrap;
	border-bottom: 1.5px solid var(--tq-border);
	color: var(--tq-text);
}
.tq-imsakiya-table thead th {
	background: var(--tq-brand-light);
	color: var(--tq-brand-dark);
	font-weight: 700;
	position: sticky;
	top: 0;
}
.tq-imsakiya-table thead th:first-child {
	text-align: right;
}
.tq-imsakiya-table tbody tr:last-child td {
	border-bottom: none;
}
.tq-imsakiya-table tbody tr:nth-child(odd) td {
	background: #ffffff;
}
.tq-imsakiya-table tbody tr:nth-child(even) td {
	background: #fafcfb;
}
.tq-imsakiya-table tbody tr.is-today td {
	background: var(--tq-brand-light);
	font-weight: 700;
}
.tq-imsakiya-table tbody tr:hover td {
	background: #eef4f1;
}
.tq-imsakiya-table tbody tr.is-today:hover td {
	background: #e4eee9;
}

.tq-imsakiya-table td.tq-imsakiya-date-cell {
	text-align: right;
	font-weight: 700;
}
.tq-imsakiya-date-text {
	display: inline-block;
}
.tq-imsakiya-badge {
	display: inline-block;
	border-radius: 999px;
	padding: 2px 10px;
	font-size: 0.78em;
	font-weight: 700;
	color: #fff;
	margin-inline-end: 6px;
}
.tq-imsakiya-badge-today {
	background: var(--tq-brand);
}
.tq-imsakiya-badge-tomorrow {
	background: #8a9990;
}

.tq-imsakiya-ampm {
	font-size: 0.75em;
	color: var(--tq-muted);
	margin-inline-start: 3px;
}
.tq-imsakiya-tentative {
	color: #b45309;
	cursor: help;
}
.tq-imsakiya-footnote {
	padding: 10px 14px;
	margin: 0;
	font-size: 12.5px;
	color: var(--tq-muted);
	background: #ffffff;
	border-top: 1px solid var(--tq-brand-border);
}
.tq-imsakiya-error {
	color: var(--tq-muted);
	text-align: center;
	padding: 20px;
}

/* Loading state while an AJAX country switch is in flight. */
.tq-imsakiya-body.is-loading {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

/* Year badge next to the widget/table title — makes it unambiguous which
   Gregorian year the dates belong to, without relying on the reader to
   spot it from the individual day rows. */
.tq-imsakiya-year-badge {
	display: inline-block;
	flex-shrink: 0;
	font-weight: 800;
	border-radius: 6px;
	padding: 1px 8px;
	font-size: 0.78em;
	letter-spacing: 0.2px;
	white-space: nowrap;
}
.tq-imsakiya-table-header .tq-imsakiya-year-badge {
	background: rgba(255, 255, 255, 0.22);
	color: #ffffff;
}
.tq-imsakiya-hero-title .tq-imsakiya-year-badge {
	background: var(--tq-brand);
	color: #ffffff;
}

/* Floating "go to today" button — appears only once the visitor scrolls
   the widget into view on their own, and only if today's row isn't
   already visible. Deliberately no auto-scroll on page load. */
.tq-imsakiya-goto-today {
	position: fixed;
	left: 50%;
	bottom: 20px;
	transform: translateX(-50%);
	z-index: 9999;
	display: flex;
	align-items: center;
	gap: 6px;
	background: var(--tq-brand, #4a6b5a);
	color: #ffffff;
	border: none;
	border-radius: 999px;
	padding: 10px 18px;
	font-family: 'IBM Plex Sans Arabic', Tahoma, Arial, sans-serif;
	font-size: 14px;
	font-weight: 700;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	animation: tq-imsakiya-goto-in 0.25s ease;
}
.tq-imsakiya-goto-today:hover {
	background: var(--tq-brand-dark, #3a5548);
}
.tq-imsakiya-goto-today span:last-child {
	font-size: 15px;
}
@keyframes tq-imsakiya-goto-in {
	from { opacity: 0; transform: translateX(-50%) translateY(10px); }
	to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
	.tq-imsakiya-goto-today {
		animation: none;
	}
}

/* Table becomes horizontally scrollable on narrow screens instead of
   wrapping/breaking, with a visible hint above it, matching the mobile
   pattern of the site's own prayer-times pages. */
@media (max-width: 640px) {
	.tq-imsakiya-scroll-hint {
		display: flex;
	}
	.tq-imsakiya-table-scroll {
		overflow-x: auto;
	}
	.tq-imsakiya-table {
		min-width: 640px;
	}
	/* The date column is the tightest one on a phone screen, so on mobile
	   the "اليوم/غدًا" badge moves to its own line above the date instead
	   of sitting inline next to it — otherwise it visibly crowds the
	   neighbouring time column. */
	.tq-imsakiya-badge {
		display: block;
		width: fit-content;
		margin: 0 0 4px;
	}
	/* The table-header title (icon + country/city + year badge) needs to
	   stay on one line on a phone screen. The icon and badge take a fixed
	   chunk of width no matter how small the screen gets, so on narrow
	   phones there wasn't enough left for the text and it either wrapped
	   or got chopped to a letter or two. Shrink the icon, the badge, the
	   gaps and the font itself on narrow screens so the whole row — icon,
	   full title, year — fits without wrapping or truncating.
	   text-overflow: ellipsis (set above) stays only as a safety net for
	   an unusually long country/city name pair. */
	.tq-imsakiya-table-header {
		gap: 4px;
		padding: 10px 12px;
		font-size: clamp(10px, 3.6vw, 17px);
	}
	.tq-imsakiya-table-header svg {
		width: 14px;
		height: 14px;
	}
	.tq-imsakiya-table-header .tq-imsakiya-year-badge {
		font-size: 0.72em;
		padding: 1px 6px;
	}
}

/* On wider screens there's spare room around the countdown, so the boxes
   scale up instead of sitting small in the middle of a wide card. */
@media (min-width: 641px) {
	.tq-imsakiya-cd-box {
		min-width: 84px;
		padding: 14px 10px;
	}
	.tq-imsakiya-cd-box.is-days {
		min-width: 100px;
	}
	.tq-imsakiya-cd-num {
		font-size: 30px;
	}
	.tq-imsakiya-cd-box.is-days .tq-imsakiya-cd-num {
		font-size: 42px;
	}
	.tq-imsakiya-cd-label {
		font-size: 13px;
	}
}
