/*
 * DaazMarkets PRO — Indices Widget
 * World stock market index cards, grouped by geographic region.
 * Inherits CSS variables from the base plugin's style.css (--gmp-*).
 */

/* ── Outer wrapper ───────────────────────────────────────────────────────── */
.gmp-indices-wrap {
	font-family: var(--gmp-font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif);
	color: var(--gmp-text-primary, #111827);
}

/* ── Regional group ──────────────────────────────────────────────────────── */
.gmp-indices-group {
	margin-bottom: 28px;
}
.gmp-indices-group:last-child {
	margin-bottom: 0;
}

/* ── Section divider label ───────────────────────────────────────────────── */
.gmp-indices-group-label {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--gmp-text-tertiary, #9ca3af);
	margin-bottom: 12px;
	white-space: nowrap;
}
.gmp-indices-group-label::after {
	content: '';
	flex: 1;
	height: 1px;
	background: var(--gmp-border, #e5e7eb);
}

/* ── Card grid ───────────────────────────────────────────────────────────── */
.gmp-indices-grid {
	display: grid;
	gap: 12px;
}
.gmp-indices-cols-1 { grid-template-columns: 1fr; }
.gmp-indices-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gmp-indices-cols-3 { grid-template-columns: repeat(3, 1fr); }
.gmp-indices-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Individual card ─────────────────────────────────────────────────────── */
.gmp-idx-card {
	background: var(--gmp-bg-primary, #ffffff);
	border: 1px solid var(--gmp-border, #e5e7eb);
	border-radius: 10px;
	padding: 16px;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
	cursor: default;
}
.gmp-idx-card:hover {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

/* ── Card header: icon + name/region ─────────────────────────────────────── */
.gmp-idx-header {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 14px;
}

.gmp-idx-icon {
	font-size: 1.3rem;
	line-height: 1;
	flex-shrink: 0;
	margin-top: 1px;
}

.gmp-idx-title {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.gmp-idx-name {
	font-weight: 700;
	font-size: 0.88rem;
	color: var(--gmp-text-primary, #111827);
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.gmp-idx-sub {
	font-size: 0.72rem;
	color: var(--gmp-text-tertiary, #9ca3af);
	white-space: nowrap;
}

/* ── Price ───────────────────────────────────────────────────────────────── */
.gmp-idx-price {
	font-size: 1.25rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--gmp-text-primary, #111827);
	letter-spacing: -0.02em;
	margin-bottom: 6px;
	line-height: 1.2;
}

/* ── % Change ────────────────────────────────────────────────────────────── */
.gmp-idx-change {
	font-size: 0.82rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}
.gmp-idx-up      { color: #16c784; }
.gmp-idx-down    { color: #ea3943; }
.gmp-idx-neutral { color: var(--gmp-text-tertiary, #9ca3af); }

/* ── Dark mode — auto (via CSS variables) ────────────────────────────────── */
/* Cards already inherit --gmp-bg-primary which flips in dark mode.
   The explicit .gmp-indices-dark class forces dark regardless of theme.      */
.gmp-indices-dark .gmp-idx-card {
	background: var(--gmp-bg-secondary, #1f2937);
	border-color: var(--gmp-border, #374151);
}
.gmp-indices-dark .gmp-indices-group-label::after {
	background: var(--gmp-border, #374151);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
	.gmp-indices-cols-4 {
		grid-template-columns: repeat(3, 1fr);
	}
}
@media (max-width: 640px) {
	.gmp-indices-cols-3,
	.gmp-indices-cols-4 {
		grid-template-columns: repeat(2, 1fr);
	}
}
@media (max-width: 400px) {
	.gmp-indices-cols-2,
	.gmp-indices-cols-3,
	.gmp-indices-cols-4 {
		grid-template-columns: 1fr;
	}
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.gmp-idx-card {
		transition: none;
	}
}
