/**
 * Euronext Indices - Frontend Styles
 *
 * @package EuronextIndices
 * @since 2.0.0
 */

/* ==========================================================================
   Base Widget Styles
   ========================================================================== */

.euronext-index-widget {
	position: relative;
	background: #ffffff;
	padding: 24px;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	margin: 20px auto;
}

.euronext-index-widget:hover {
	/* Add hover effects if needed */
}

.euronext-index-widget.updated {
	animation: pulse 0.5s ease;
}

@keyframes pulse {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.02);
	}
}

/* ==========================================================================
   Header
   ========================================================================== */

.euronext-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	padding-bottom: 12px;
	border-bottom: 2px solid #f3f4f6;
}

.euronext-title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #111827;
	line-height: 1.4;
}

.euronext-ticker {
	display: inline-block;
	background: #f3f4f6;
	color: #6b7280;
	padding: 4px 10px;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.5px;
}

/* ==========================================================================
   Price Container
   ========================================================================== */

.euronext-price-container {
	transition: opacity 0.3s ease;
}

.euronext-price {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 12px;
}

.current-price {
	font-size: 32px;
	font-weight: 700;
	color: #111827;
	line-height: 1;
	transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.currency {
	font-size: 16px;
	font-weight: 500;
	color: #6b7280;
}

/* ==========================================================================
   Variation
   ========================================================================== */

.euronext-variation {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 16px;
	font-weight: 600;
	transition: all 0.3s ease;
}

.euronext-variation.positive {
	color: #10b981;
}

.euronext-variation.negative {
	color: #ef4444;
}

.euronext-variation.positive::before {
	content: '▲';
	font-size: 12px;
}

.euronext-variation.negative::before {
	content: '▼';
	font-size: 12px;
}

.variation-percent {
	font-size: 14px;
	opacity: 0.8;
}

/* ==========================================================================
   Statistics Grid
   ========================================================================== */

.euronext-stats {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
	margin: 20px 0;
	padding: 16px;
	background: #f9fafb;
	border-radius: 8px;
}

.stat-item {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.stat-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #6b7280;
}

.stat-value {
	font-size: 14px;
	font-weight: 600;
	color: #111827;
}

/* ==========================================================================
   Single Line Layout
   ========================================================================== */

.euronext-single-line {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.euronext-single-line .current-price {
	font-size: 24px;
	font-weight: 700;
	color: #111827;
}

.euronext-single-line .currency {
	font-size: 14px;
	font-weight: 500;
	color: #6b7280;
	margin-right: 4px;
}

.euronext-single-line .euronext-variation,
.euronext-single-line .variation-percent {
	font-size: 16px;
	font-weight: 600;
}

.euronext-single-line .last-update {
	font-size: 12px;
	color: #9ca3af;
	font-style: italic;
	margin-left: auto;
}

.euronext-single-line .cache-indicator {
	font-size: 14px;
	cursor: help;
	margin-left: 8px;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.euronext-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 20px;
	padding-top: 12px;
	border-top: 1px solid #f3f4f6;
}

.last-update {
	font-size: 12px;
	color: #9ca3af;
	font-style: italic;
}

.cache-indicator {
	font-size: 14px;
	cursor: help;
}

/* ==========================================================================
   Loader
   ========================================================================== */

.euronext-loader {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.9);
	border-radius: 12px;
	padding: 20px;
	z-index: 10;
}

.euronext-loader .spinner {
	width: 24px;
	height: 24px;
	border: 3px solid #f3f4f6;
	border-top-color: #3b82f6;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Error State
   ========================================================================== */

.euronext-index-widget.euronext-error {
	background: #fef2f2;
	border-color: #fecaca;
}

.euronext-error-message {
	display: flex;
	align-items: center;
	gap: 12px;
	color: #991b1b;
}

.error-icon {
	font-size: 24px;
}

.euronext-error-message p {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 640px) {
	.euronext-index-widget {
		padding: 16px;
		margin: 16px;
	}

	.euronext-title {
		font-size: 16px;
	}

	.current-price {
		font-size: 28px;
	}

	.euronext-variation {
		font-size: 14px;
	}

	.euronext-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}

	.euronext-ticker {
		align-self: flex-start;
	}

	.euronext-stats {
		grid-template-columns: 1fr;
		gap: 8px;
	}

	.stat-item {
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}

	.euronext-single-line .current-price {
		font-size: 20px;
	}

	.euronext-single-line .currency {
		font-size: 12px;
	}

	.euronext-single-line .euronext-variation,
	.euronext-single-line .variation-percent {
		font-size: 14px;
	}

	.euronext-single-line .last-update {
		font-size: 11px;
		width: 100%;
		margin-left: 0;
		margin-top: 8px;
	}
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
	.euronext-index-widget {
		background: #1f2937;
		border-color: #374151;
		color: #f3f4f6;
	}

	.euronext-title {
		color: #f9fafb;
	}

	.euronext-ticker {
		background: #374151;
		color: #d1d5db;
	}

	.current-price,
	.stat-value,
	.euronext-single-line .current-price {
		color: #f9fafb;
	}

	.currency,
	.stat-label,
	.euronext-single-line .currency {
		color: #d1d5db;
	}

	.euronext-header,
	.euronext-footer {
		border-color: #374151;
	}

	.euronext-stats {
		background: #374151;
	}

	.last-update,
	.euronext-single-line .last-update {
		color: #9ca3af;
	}

	.euronext-loader {
		background: rgba(31, 41, 55, 0.95);
	}
}
