/**
 * DaazMarkets PRO — BTC Correlation Widget
 * [daaz_gmp_btc_correlation]
 */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.daaz-corr-wrap {
	font-family: inherit;
	box-sizing: border-box;
}

.daaz-corr-title {
	font-size: 1rem;
	font-weight: 700;
	margin: 0 0 14px;
	color: #1e293b;
}

/* ── Grid ────────────────────────────────────────────────────────────────── */
.daaz-corr-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.daaz-corr-card {
	flex: 1 1 180px;
	min-width: 160px;
	background: #1e293b;
	border-radius: 12px;
	padding: 18px 20px 14px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

.daaz-corr-card-header {
	font-size: .85rem;
	font-weight: 600;
	color: #94a3b8;
	letter-spacing: .01em;
}

/* ── Body row (arrow + value) ────────────────────────────────────────────── */
.daaz-corr-card-body {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 4px;
}

/* Arrow icon box */
.daaz-corr-arrow {
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: #2563eb;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.daaz-corr-arrow svg {
	width: 18px;
	height: 18px;
	color: #fff;
}

.daaz-corr-arrow--neutral {
	background: #475569;
}

/* Correlation value */
.daaz-corr-value {
	font-size: 1.75rem;
	font-weight: 800;
	line-height: 1;
	letter-spacing: -.02em;
}

.daaz-corr-value--up      { color: #22c55e; }
.daaz-corr-value--down    { color: #ef4444; }
.daaz-corr-value--neutral { color: #94a3b8; }

/* ── Description ─────────────────────────────────────────────────────────── */
.daaz-corr-desc {
	font-size: .78rem;
	color: #94a3b8;
	margin-top: 2px;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.daaz-corr-footer {
	font-size: .72rem;
	color: #64748b;
	margin: 10px 0 0;
}

/* ── Error state ─────────────────────────────────────────────────────────── */
.daaz-corr-error {
	color: #ef4444;
	font-size: .85rem;
}

/* ================================================================
   THEME OVERRIDES
   ================================================================ */

/* Dark theme — same as default (cards are always dark by design) */
.daaz-corr-theme-dark .daaz-corr-title {
	color: #e2e8f0;
}

/* Light theme — cards with lighter background */
.daaz-corr-theme-light .daaz-corr-card {
	background: #f1f5f9;
	box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.daaz-corr-theme-light .daaz-corr-card-header,
.daaz-corr-theme-light .daaz-corr-desc {
	color: #64748b;
}

.daaz-corr-theme-light .daaz-corr-title {
	color: #0f172a;
}

.daaz-corr-theme-light .daaz-corr-value--up      { color: #16a34a; }
.daaz-corr-theme-light .daaz-corr-value--down    { color: #dc2626; }
.daaz-corr-theme-light .daaz-corr-value--neutral { color: #475569; }

/* Auto theme — follow OS/site dark mode */
@media (prefers-color-scheme: dark) {
	.daaz-corr-theme-auto .daaz-corr-title {
		color: #e2e8f0;
	}
}

/* Dark mode via body class (.dark-mode, .dark, [data-theme="dark"]) */
body.dark-mode .daaz-corr-theme-auto .daaz-corr-title,
body.dark .daaz-corr-theme-auto .daaz-corr-title,
[data-theme="dark"] .daaz-corr-theme-auto .daaz-corr-title {
	color: #e2e8f0;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
	.daaz-corr-grid {
		flex-direction: column;
	}

	.daaz-corr-card {
		flex: unset;
		min-width: unset;
		width: 100%;
	}

	.daaz-corr-value {
		font-size: 1.5rem;
	}
}

/* ================================================================
   CHART SECTION
   ================================================================ */

.daaz-corr-chart-section {
	background: #0f172a;
	border-radius: 16px;
	padding: 24px 24px 18px;
	margin-bottom: 16px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, .28);
	overflow: hidden;
}

/* ── Chart unavailable notice ────────────────────────────────────── */
.daaz-corr-chart-unavailable {
	display: flex;
	align-items: center;
	gap: 10px;
	background: rgba(245, 158, 11, .12);
	border: 1px solid rgba(245, 158, 11, .3);
	border-radius: 10px;
	padding: 12px 16px;
	margin-bottom: 16px;
	font-size: 13px;
	color: #fbbf24;
	line-height: 1.4;
}
.daaz-corr-chart-unavailable-icon {
	flex-shrink: 0;
	font-size: 16px;
}

/* ── Header row (titles + controls) ─────────────────────────────── */
.daaz-corr-chart-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.daaz-corr-chart-titles {
	flex: 1 1 160px;
}

.daaz-corr-chart-title {
	font-size: 1.1rem;
	font-weight: 700;
	color: #f1f5f9;
	margin: 0 0 4px;
	line-height: 1.3;
}

.daaz-corr-chart-subtitle {
	font-size: .8rem;
	color: #64748b;
	margin: 0;
}

/* ── Controls row (asset picker + period buttons) ────────────────── */
.daaz-corr-chart-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
	flex-wrap: wrap;
}

/* ── Asset-picker dropdown ───────────────────────────────────────── */
.daaz-corr-asset-picker {
	position: relative;
}

.daaz-corr-asset-trigger {
	display: flex;
	align-items: center;
	gap: 5px;
	background: transparent;
	border: 1px solid #1e293b;
	border-radius: 6px;
	color: #94a3b8;
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .04em;
	padding: 4px 10px;
	cursor: pointer;
	transition: background .15s, color .15s, border-color .15s;
	line-height: 1.4;
	white-space: nowrap;
}

.daaz-corr-asset-trigger:hover {
	background: #1e293b;
	color: #e2e8f0;
	border-color: #334155;
}

.daaz-corr-asset-chevron {
	width: 12px;
	height: 12px;
	flex-shrink: 0;
	transition: transform .2s;
}

.daaz-corr-asset-trigger[aria-expanded="true"] .daaz-corr-asset-chevron {
	transform: rotate(180deg);
}

.daaz-corr-asset-dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 4px);
	right: 0;
	min-width: 150px;
	background: #0f172a;
	border: 1px solid #1e293b;
	border-radius: 8px;
	list-style: none;
	margin: 0;
	padding: 4px;
	z-index: 100;
	box-shadow: 0 8px 24px rgba(0,0,0,.45);
}

.daaz-corr-asset-dropdown.open {
	display: block;
}

.daaz-corr-asset-dropdown li {
	margin: 0;
	padding: 0;
}

.daaz-corr-asset-btn {
	display: block;
	width: 100%;
	background: transparent;
	border: none;
	border-radius: 6px;
	color: #94a3b8;
	font-size: .78rem;
	font-weight: 500;
	padding: 7px 12px;
	text-align: left;
	cursor: pointer;
	transition: background .12s, color .12s;
}

.daaz-corr-asset-btn:hover {
	background: #1e293b;
	color: #e2e8f0;
}

.daaz-corr-asset-btn.active {
	color: #10b981;
	font-weight: 600;
}

/* ── Period toggle buttons ─────────────────────────────────────────── */
.daaz-corr-periods {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
	align-items: center;
}

.daaz-corr-period {
	background: transparent;
	border: 1px solid #1e293b;
	border-radius: 6px;
	color: #64748b;
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .04em;
	padding: 4px 10px;
	cursor: pointer;
	transition: background .15s, color .15s, border-color .15s;
	line-height: 1.4;
}

.daaz-corr-period:hover {
	background: #1e293b;
	color: #94a3b8;
	border-color: #334155;
}

.daaz-corr-period.active {
	background: #0d9488;
	border-color: #0d9488;
	color: #fff;
}

/* ── Canvas wrapper ────────────────────────────────────────────────── */
.daaz-corr-canvas-wrap {
	position: relative;
	height: 240px;
	width: 100%;
}

.daaz-corr-canvas-wrap canvas {
	display: block;
	width: 100% !important;
	height: 100% !important;
}

/* ── Legend ────────────────────────────────────────────────────────── */
.daaz-corr-legend {
	display: flex;
	gap: 20px;
	margin-top: 14px;
	flex-wrap: wrap;
}

.daaz-corr-legend-item {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: .78rem;
	color: #94a3b8;
	font-weight: 500;
}

.daaz-corr-legend-item i {
	display: inline-block;
	width: 14px;
	height: 3px;
	border-radius: 2px;
	flex-shrink: 0;
}

.daaz-corr-legend-btc i {
	background: #10b981;
}

.daaz-corr-legend-asset i {
	background: #60a5fa;
	/* dashed line effect */
	background-image: repeating-linear-gradient(
		to right,
		#60a5fa 0,
		#60a5fa 5px,
		transparent 5px,
		transparent 9px
	);
	background-color: transparent;
}

/* ── Grid spacing when chart is present ───────────────────────────── */
.daaz-corr-chart-section + .daaz-corr-title {
	margin-top: 8px;
}

.daaz-corr-chart-section + .daaz-corr-grid,
.daaz-corr-chart-section + .daaz-corr-title + .daaz-corr-grid {
	margin-top: 4px;
}

/* ── Responsive chart ──────────────────────────────────────────────── */
@media (max-width: 540px) {
	.daaz-corr-chart-section {
		padding: 18px 16px 14px;
		border-radius: 12px;
	}

	.daaz-corr-canvas-wrap {
		height: 180px;
	}

	.daaz-corr-chart-title {
		font-size: 1rem;
	}
}
