/**
 * GD SoundCloud Player - Stylesheet
 *
 * Neutral, minimal design with grayscale colors and orange accent
 *
 * @package GD_SoundCloud_Player
 * @since 1.0.0
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
	--gd-primary-color: #de8e16;
	--gd-bg-color: #ffffff;
	--gd-bg-light: #f5f5f5;
	--gd-bg-white: #ffffff;
	--gd-text-dark: #333333;
	--gd-text-gray: #666666;
	--gd-text-light: #999999;
	--gd-border-color: #dddddd;
	--gd-hover-bg: #eeeeee;
	--gd-transition: all 0.3s ease;
	--gd-waveform-lighten: 8%; /* Adjustable lightness factor for waveform background */
}

/* ==========================================================================
   Main Container
   ========================================================================== */
.gd-soundcloud-player {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	background: var(--gd-bg-white);
	border: 1px solid var(--gd-border-color);
	border-radius: 8px;
	overflow: hidden;
	max-width: 100%;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Hide SoundCloud iframe */
.gd-sc-iframe {
	display: none !important;
}

/* ==========================================================================
   Player UI Container
   ========================================================================== */
.gd-player-ui {
	padding: 20px;
	display: flex;
	flex-direction: row;
	gap: 30px;
	align-items: flex-start;
}

/* Left side: Artwork */
.gd-player-left {
	flex: 0 0 300px;
}

/* Right side: Track info, waveform, controls */
.gd-player-right {
	flex: 1;
	min-width: 0;
}

/* ==========================================================================
   Loading State
   ========================================================================== */
.gd-loading {
	text-align: center;
	padding: 40px 20px;
	color: var(--gd-text-gray);
}

.gd-loading-spinner {
	width: 40px;
	height: 40px;
	margin: 0 auto 15px;
	border: 4px solid var(--gd-bg-light);
	border-top-color: var(--gd-primary-color);
	border-radius: 50%;
	animation: gd-spin 1s linear infinite;
}

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

/* ==========================================================================
   Error State
   ========================================================================== */
.gd-error {
	padding: 20px;
	background: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 4px;
	color: #856404;
	text-align: center;
}

.gd-soundcloud-player-error {
	padding: 20px;
	background: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 4px;
	color: #856404;
}

/* ==========================================================================
   Artwork
   ========================================================================== */
.gd-player-artwork {
	margin-bottom: 0;
	text-align: center;
}

.gd-artwork-img {
	width: 100%;
	max-width: 300px;
	height: auto;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	opacity: 1;
	transition: opacity 0.3s ease-in-out;
}

.gd-artwork-img.gd-fading {
	opacity: 0;
}

/* ==========================================================================
   Track Info
   ========================================================================== */
.gd-player-info {
	margin-bottom: 20px;
	text-align: left;
}

.gd-track-title {
	margin: 0 0 5px 0;
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--gd-text-dark);
	line-height: 1.3;
}

.gd-track-artist {
	margin: 0;
	font-size: 0.95rem;
	color: var(--gd-text-gray);
	font-weight: 400;
}

/* ==========================================================================
   Waveform
   ========================================================================== */
.gd-player-waveform {
	position: relative;
	margin-bottom: 20px;
	background: transparent;
	border-radius: 4px;
	overflow: hidden;
	cursor: pointer;
	user-select: none;
	min-height: 80px;
	width: 100%;
}

.gd-waveform-canvas {
	display: block;
	width: 100%;
	height: 80px;
	min-width: 100px;
	opacity: 1;
	transition: opacity 0.3s ease-in-out;
}

.gd-waveform-canvas.gd-fading {
	opacity: 0;
}

.gd-waveform-progress {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	background: var(--gd-primary-color);
	opacity: 0.4;
	pointer-events: none;
	transition: width 0.1s linear;
}

.gd-waveform-time {
	display: flex;
	justify-content: space-between;
	padding: 8px 12px;
	font-size: 0.85rem;
	color: var(--gd-text-gray);
	font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Controls
   ========================================================================== */
.gd-player-controls {
	display: flex;
	justify-content: start;
	align-items: center;
	gap: 15px;
	margin-bottom: 20px;
}

.gd-track-counter {
	color: var(--gd-text-gray);
	font-variant-numeric: tabular-nums;
	margin-left: 5px;
	user-select: none;
}

.gd-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: var(--gd-bg-light);
	border: 1px solid var(--gd-border-color);
	border-radius: 50%;
	color: var(--gd-text-dark);
	cursor: pointer;
	transition: var(--gd-transition);
	font-size: 0;
}

.gd-btn:hover {
	background: var(--gd-hover-bg);
	border-color: var(--gd-primary-color);
	color: var(--gd-primary-color);
}

.gd-btn:active {
	transform: scale(0.95);
}

.gd-btn:focus {
	outline: 2px solid var(--gd-primary-color);
	outline-offset: 2px;
}

.gd-btn-play {
	width: 56px;
	height: 56px;
	background: var(--gd-primary-color);
	border-color: var(--gd-primary-color);
	color: white;
}

.gd-btn-play:hover {
	background: #c77e14;
	border-color: #c77e14;
	color: white;
}

.gd-btn svg {
	width: 24px;
	height: 24px;
}

/* ==========================================================================
   Volume Control
   ========================================================================== */
.gd-player-volume {
	display: flex;
	align-items: center;
	gap: 10px;
	justify-content: start;
}

.gd-btn-volume {
	flex-shrink: 0;
	height: 30px;
	width: 30px;
}

.gd-volume-slider {
	-webkit-appearance: none;
	appearance: none;
	width: 130px;
	height: 4px;
	background: var(--gd-bg-light);
	border-radius: 2px;
	outline: none;
	transition: var(--gd-transition);
}

.gd-volume-slider:hover {
	background: var(--gd-hover-bg);
}

.gd-volume-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 14px;
	height: 14px;
	background: var(--gd-primary-color);
	border-radius: 50%;
	cursor: pointer;
	transition: var(--gd-transition);
}

.gd-volume-slider::-webkit-slider-thumb:hover {
	transform: scale(1.2);
}

.gd-volume-slider::-moz-range-thumb {
	width: 14px;
	height: 14px;
	background: var(--gd-primary-color);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: var(--gd-transition);
}

.gd-volume-slider::-moz-range-thumb:hover {
	transform: scale(1.2);
}

/* ==========================================================================
   Responsive Design - Tablet
   ========================================================================== */
@media (max-width: 768px) {
	.gd-player-ui {
		padding: 15px;
		flex-direction: column;
		gap: 20px;
	}

	.gd-player-left {
		flex: 0 0 auto;
		width: 100%;
	}

	.gd-player-artwork {
		text-align: center;
		margin-bottom: 20px;
	}

	.gd-artwork-img {
		max-width: 250px;
	}

	.gd-player-right {
		width: 100%;
	}

	.gd-player-info {
		text-align: center;
	}

	.gd-track-title {
		font-size: 1.1rem;
	}

	.gd-track-artist {
		font-size: 0.9rem;
	}

	.gd-player-controls {
		gap: 12px;
	}

	.gd-btn {
		width: 40px;
		height: 40px;
	}

	.gd-btn-play {
		width: 52px;
		height: 52px;
	}

	.gd-volume-slider {
		width: 100px;
	}
}

/* ==========================================================================
   Responsive Design - Mobile
   ========================================================================== */
@media (max-width: 480px) {
	.gd-soundcloud-player {
		border-radius: 4px;
	}

	.gd-player-ui {
		padding: 12px;
	}

	.gd-artwork-img {
		max-width: 200px;
	}

	.gd-track-title {
		font-size: 1rem;
	}

	.gd-track-artist {
		font-size: 0.85rem;
	}

	.gd-waveform-canvas {
		height: 60px;
	}

	.gd-player-controls {
		gap: 10px;
	}

	.gd-btn {
		width: 38px;
		height: 38px;
	}

	.gd-btn-play {
		width: 48px;
		height: 48px;
	}

	.gd-btn svg {
		width: 20px;
		height: 20px;
	}

	.gd-player-volume {
		gap: 8px;
	}

	.gd-volume-slider {
		width: 90px;
	}

	.gd-waveform-time {
		padding: 6px 10px;
		font-size: 0.8rem;
	}
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
	.gd-soundcloud-player {
		display: none;
	}
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
.gd-btn:focus-visible {
	outline: 2px solid var(--gd-primary-color);
	outline-offset: 3px;
}

.gd-volume-slider:focus-visible::-webkit-slider-thumb {
	box-shadow: 0 0 0 4px rgba(222, 142, 22, 0.2);
}

.gd-volume-slider:focus-visible::-moz-range-thumb {
	box-shadow: 0 0 0 4px rgba(222, 142, 22, 0.2);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.gd-soundcloud-player {
		border-width: 2px;
	}

	.gd-btn {
		border-width: 2px;
	}
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
	* {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
