/**
 * GeniusTray Video Playlist for YouTube - Admin Styles
 *
 * Styles for the playlist metabox, settings page,
 * and other admin UI elements.
 *
 * @package GeniusTray_Video_Playlist_for_YouTube
 * @since 1.0.0
 */

/* ==========================================================================
   Metabox Wrapper
   ========================================================================== */

.vidtray-metabox-wrapper {
	padding: 10px 0;
}

.vidtray-metabox-wrapper > .description {
	margin-bottom: 15px;
	color: #646970;
}

/* ==========================================================================
   Video Rows Container
   ========================================================================== */

.vidtray-videos-container {
	margin-bottom: 15px;
}

/* ==========================================================================
   Individual Video Row
   ========================================================================== */

.vidtray-video-row {
	position: relative;
	background: #f9f9f9;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	margin-bottom: 10px;
	padding: 0;
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.vidtray-video-row:hover {
	border-color: #c3c4c7;
}

.vidtray-video-row:last-child {
	margin-bottom: 0;
}

/* Dragging state */
.vidtray-video-row.vidtray-dragging {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	border-color: #2271b1;
	z-index: 100;
}

/* Sortable placeholder */
.vidtray-sortable-placeholder {
	background: #e8f4fc;
	border: 2px dashed #2271b1;
	border-radius: 4px;
	margin-bottom: 10px;
	visibility: visible !important;
}

/* ==========================================================================
   Row Header (Drag Handle, Number, Remove Button)
   ========================================================================== */

.vidtray-row-header {
	display: flex;
	align-items: center;
	background: #f0f0f1;
	border-bottom: 1px solid #dcdcde;
	padding: 8px 12px;
	border-radius: 4px 4px 0 0;
}

.vidtray-drag-handle {
	cursor: move;
	cursor: grab;
	color: #8c8f94;
	margin-right: 10px;
	padding: 4px;
	transition: color 0.2s ease;
}

.vidtray-drag-handle:hover {
	color: #2271b1;
}

.vidtray-drag-handle:active {
	cursor: grabbing;
}

.vidtray-row-number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	background: #2271b1;
	color: #fff;
	border-radius: 50%;
	font-size: 12px;
	font-weight: 600;
	margin-right: 10px;
}

.vidtray-remove-row {
	margin-left: auto;
	background: none;
	border: none;
	color: #b32d2e;
	cursor: pointer;
	padding: 4px;
	opacity: 0.7;
	transition: opacity 0.2s ease;
}

.vidtray-remove-row:hover {
	opacity: 1;
}

.vidtray-remove-row .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

/* ==========================================================================
   Row Fields
   ========================================================================== */

.vidtray-row-fields {
	padding: 15px;
}

.vidtray-field {
	margin-bottom: 12px;
}

.vidtray-field:last-child {
	margin-bottom: 0;
}

.vidtray-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 5px;
	color: #1d2327;
	font-size: 13px;
}

.vidtray-field input[type="text"],
.vidtray-field input[type="url"],
.vidtray-field textarea {
	width: 100%;
	max-width: 100%;
}

.vidtray-field textarea {
	resize: vertical;
	min-height: 60px;
}

/* URL Input with Fetch Button */
.vidtray-url-input-wrapper {
	display: flex;
	gap: 8px;
}

.vidtray-url-input-wrapper input {
	flex: 1;
}

.vidtray-url-input-wrapper .button {
	flex-shrink: 0;
	padding: 0 10px;
	height: 30px;
	min-height: 30px;
}

.vidtray-url-input-wrapper .button .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 1;
	margin-top: 2px;
}

/* Spinning animation for loading state */
.vidtray-url-input-wrapper .dashicons.spin {
	animation: vidtray-spin 1s linear infinite;
}

@keyframes vidtray-spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* ==========================================================================
   Add Video Button
   ========================================================================== */

.vidtray-add-row-wrapper {
	margin-top: 15px;
	padding-top: 15px;
	border-top: 1px solid #dcdcde;
}

#vidtray-add-video {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

#vidtray-add-video .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* ==========================================================================
   Shortcode Metabox (Sidebar)
   ========================================================================== */

#vidtray_shortcode_metabox .inside {
	padding: 12px;
}

#vidtray_shortcode_metabox code {
	display: block;
	padding: 10px;
	background: #f0f0f1;
	border-radius: 4px;
	font-size: 13px;
	word-break: break-all;
	cursor: text;
	user-select: all;
}

#vidtray_shortcode_metabox .description {
	margin-top: 10px;
	font-size: 12px;
	color: #646970;
}

/* ==========================================================================
   Settings Page Wrapper
   ========================================================================== */

.vidtray-settings-wrap {
	max-width: 1200px;
}

.vidtray-settings-wrap h1 {
	margin-bottom: 20px;
}

/* ==========================================================================
   Settings Navigation Tabs
   ========================================================================== */

.vidtray-nav-tabs {
	margin-bottom: 20px;
	border-bottom: 1px solid #c3c4c7;
}

.vidtray-nav-tabs .nav-tab {
	margin-left: 0;
	margin-right: 5px;
	padding: 8px 15px;
	font-size: 14px;
	background: #f0f0f1;
	border-color: #c3c4c7;
	color: #50575e;
	transition: background 0.2s ease, color 0.2s ease;
}

.vidtray-nav-tabs .nav-tab:hover {
	background: #fff;
	color: #2271b1;
}

.vidtray-nav-tabs .nav-tab-active,
.vidtray-nav-tabs .nav-tab-active:hover {
	background: #fff;
	border-bottom-color: #fff;
	color: #1d2327;
}

/* ==========================================================================
   Settings Content Area
   ========================================================================== */

.vidtray-settings-content {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-top: none;
	padding: 20px 25px;
	border-radius: 0 0 4px 4px;
}

.vidtray-settings-content h2 {
	margin-top: 0;
	padding-top: 0;
	border-bottom: 1px solid #dcdcde;
	padding-bottom: 10px;
}

.vidtray-settings-content .form-table {
	margin-top: 0;
}

.vidtray-settings-content .form-table th {
	width: 250px;
	padding-left: 0;
}

.vidtray-settings-content .form-table td {
	padding-left: 0;
}

/* ==========================================================================
   Dashboard Tab
   ========================================================================== */

.vidtray-dashboard-welcome {
	margin-bottom: 25px;
	padding-bottom: 20px;
	border-bottom: 1px solid #dcdcde;
}

.vidtray-dashboard-welcome h2 {
	border-bottom: none;
	padding-bottom: 0;
	margin-bottom: 10px;
}

.vidtray-dashboard-welcome p {
	font-size: 14px;
	color: #646970;
	margin: 0;
}

/* Dashboard Cards */
.vidtray-dashboard-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 20px;
}

.vidtray-card {
	background: #f9f9f9;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	padding: 20px;
}

.vidtray-card h3 {
	margin-top: 0;
	margin-bottom: 15px;
	padding-bottom: 10px;
	border-bottom: 1px solid #dcdcde;
	font-size: 15px;
	color: #1d2327;
}

.vidtray-card h4 {
	margin: 15px 0 8px;
	font-size: 13px;
	color: #1d2327;
}

.vidtray-card ol,
.vidtray-card ul {
	margin: 0 0 15px 20px;
	padding: 0;
}

.vidtray-card li {
	margin-bottom: 8px;
	line-height: 1.5;
}

.vidtray-card code {
	display: inline-block;
	padding: 4px 8px;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 3px;
	font-size: 12px;
	word-break: break-all;
}

.vidtray-card .description {
	color: #646970;
	font-size: 13px;
	margin-bottom: 5px;
}

.vidtray-card table.widefat {
	background: transparent;
	border: none;
}

.vidtray-card table.widefat td {
	padding: 8px 10px 8px 0;
	border-bottom: 1px solid #eee;
}

.vidtray-card table.widefat tr:last-child td {
	border-bottom: none;
}

/* ==========================================================================
   Help Tab
   ========================================================================== */

.vidtray-help-section {
	margin-bottom: 30px;
	padding-bottom: 25px;
	border-bottom: 1px solid #dcdcde;
}

.vidtray-help-section:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: none;
}

.vidtray-help-section h2 {
	margin-top: 0;
}

.vidtray-help-section h3 {
	margin-top: 25px;
	margin-bottom: 10px;
	font-size: 14px;
}

.vidtray-help-section h4 {
	margin-top: 20px;
	margin-bottom: 10px;
	font-size: 13px;
}

.vidtray-help-section ol,
.vidtray-help-section ul {
	margin-left: 25px;
}

.vidtray-help-section li {
	margin-bottom: 10px;
	line-height: 1.6;
}

.vidtray-help-section pre {
	background: #f0f0f1;
	padding: 12px 15px;
	border-radius: 4px;
	overflow-x: auto;
	margin: 10px 0;
}

.vidtray-help-section pre code {
	background: none;
	padding: 0;
	border: none;
}

.vidtray-help-section table.widefat {
	margin: 15px 0;
}

.vidtray-help-section table.widefat th,
.vidtray-help-section table.widefat td {
	padding: 10px 12px;
}

.vidtray-help-section table.widefat code {
	background: #f0f0f1;
	padding: 2px 6px;
	border-radius: 3px;
	font-size: 12px;
}

.vidtray-help-section .notice {
	margin: 15px 0;
}

/* ==========================================================================
   API Key Field
   ========================================================================== */

#vidtray_api_key {
	width: 350px;
	max-width: 100%;
}

#vidtray-toggle-api-key {
	margin-left: 5px;
	vertical-align: middle;
}

/* ==========================================================================
   Admin Columns (Post List)
   ========================================================================== */

.column-video_count {
	width: 80px;
}

.column-shortcode {
	width: 200px;
}

.column-shortcode code {
	background: #f0f0f1;
	padding: 4px 8px;
	border-radius: 3px;
	font-size: 12px;
	cursor: text;
	user-select: all;
}

/* ==========================================================================
   Error/Notice Styling
   ========================================================================== */

.vidtray-settings-content .notice {
	margin: 15px 0;
}

.vidtray-settings-content .notice.inline {
	padding: 10px 15px;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media screen and (max-width: 782px) {
	.vidtray-settings-content {
		padding: 15px;
	}

	.vidtray-settings-content .form-table th {
		width: auto;
		padding-bottom: 5px;
	}

	.vidtray-dashboard-cards {
		grid-template-columns: 1fr;
	}

	.vidtray-url-input-wrapper {
		flex-direction: column;
	}

	.vidtray-url-input-wrapper .button {
		width: 100%;
		justify-content: center;
	}

	#vidtray_api_key {
		width: 100%;
	}

	.vidtray-nav-tabs .nav-tab {
		display: block;
		margin-right: 0;
		margin-bottom: -1px;
	}

	.vidtray-nav-tabs .nav-tab-active {
		border-bottom-color: #c3c4c7;
	}
}

@media screen and (max-width: 600px) {
	.vidtray-row-header {
		padding: 6px 10px;
	}

	.vidtray-row-fields {
		padding: 12px;
	}

	.vidtray-field label {
		font-size: 12px;
	}

	.vidtray-card {
		padding: 15px;
	}

	.vidtray-help-section pre {
		padding: 10px;
		font-size: 11px;
	}
}

