/**
 * TeraBox Player & Downloader
 * Scoped Styles for Frontend and Admin
 *
 * @package TeraBox_Player
 */

/* ==========================================================================
   Frontend Player Wrapper & Themes
   ========================================================================== */
.terabox-player-wrapper {
	--tb-bg-primary: #0f172a;
	--tb-bg-secondary: #1e293b;
	--tb-bg-card: rgba(30, 41, 59, 0.85);
	--tb-border: rgba(148, 163, 184, 0.15);
	--tb-border-focus: #38bdf8;
	--tb-text-primary: #f8fafc;
	--tb-text-secondary: #94a3b8;
	--tb-text-muted: #64748b;
	--tb-accent: #0284c7;
	--tb-accent-hover: #0369a1;
	--tb-accent-gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
	--tb-success: #10b981;
	--tb-warning: #f59e0b;
	--tb-danger: #ef4444;
	--tb-radius-lg: 16px;
	--tb-radius-md: 10px;
	--tb-radius-sm: 6px;
	--tb-shadow-card: 0 20px 40px -15px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--tb-border);
	--tb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;

	font-family: var(--tb-font);
	background: var(--tb-bg-primary);
	color: var(--tb-text-primary);
	border-radius: var(--tb-radius-lg);
	box-shadow: var(--tb-shadow-card);
	padding: 24px;
	margin: 28px auto;
	max-width: 900px;
	box-sizing: border-box;
	backdrop-filter: blur(12px);
	border: 1px solid var(--tb-border);
	transition: all 0.3s ease;
}

.terabox-player-wrapper * {
	box-sizing: border-box;
}

/* Light Theme Modifier */
.terabox-player-wrapper.terabox-theme-light {
	--tb-bg-primary: #f8fafc;
	--tb-bg-secondary: #ffffff;
	--tb-bg-card: #ffffff;
	--tb-border: #e2e8f0;
	--tb-border-focus: #0284c7;
	--tb-text-primary: #0f172a;
	--tb-text-secondary: #475569;
	--tb-text-muted: #94a3b8;
	--tb-shadow-card: 0 10px 30px rgba(0, 0, 0, 0.08), 0 0 0 1px #e2e8f0;
}

/* Header & Branding */
.terabox-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-bottom: 18px;
	margin-bottom: 20px;
	border-bottom: 1px solid var(--tb-border);
}

.terabox-logo-badge {
	display: flex;
	align-items: center;
	gap: 10px;
}

.terabox-icon {
	width: 24px;
	height: 24px;
	color: #38bdf8;
	flex-shrink: 0;
}

.terabox-title {
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--tb-text-primary);
}

.terabox-version-tag {
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 4px 10px;
	background: rgba(56, 189, 248, 0.12);
	color: #38bdf8;
	border-radius: 9999px;
	border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Input Card & Form */
.terabox-input-card {
	margin-bottom: 20px;
}

.terabox-input-group {
	display: flex;
	align-items: stretch;
	background: var(--tb-bg-secondary);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-md);
	padding: 4px;
	transition: all 0.2s ease;
	position: relative;
}

.terabox-input-group:focus-within {
	border-color: var(--tb-border-focus);
	box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.terabox-input-icon {
	display: flex;
	align-items: center;
	padding: 0 14px;
	color: var(--tb-text-muted);
}

.terabox-input-icon svg {
	width: 20px;
	height: 20px;
}

.terabox-input {
	flex: 1;
	background: transparent !important;
	border: none !important;
	outline: none !important;
	color: var(--tb-text-primary) !important;
	font-size: 0.98rem !important;
	padding: 12px 6px !important;
	font-family: inherit !important;
	width: 100%;
}

.terabox-input::placeholder {
	color: var(--tb-text-muted);
}

.terabox-btn-primary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: var(--tb-accent-gradient);
	color: #ffffff !important;
	border: none;
	border-radius: var(--tb-radius-sm);
	padding: 0 24px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
	min-height: 44px;
	text-decoration: none;
}

.terabox-btn-primary:hover {
	opacity: 0.92;
	transform: translateY(-1px);
	box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.terabox-btn-primary:active {
	transform: translateY(0);
}

.terabox-btn-primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.terabox-input-hint {
	font-size: 0.8rem;
	color: var(--tb-text-muted);
	margin-top: 8px;
	padding-left: 6px;
}

/* Spinner */
.btn-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #ffffff;
	animation: tb-spin 0.8s linear infinite;
}

.terabox-btn-primary.is-loading .btn-spinner {
	display: inline-block;
}
.terabox-btn-primary.is-loading .btn-text {
	opacity: 0.8;
}

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

/* Loading Pulse State */
.terabox-loading-state {
	text-align: center;
	padding: 40px 20px;
	background: var(--tb-bg-secondary);
	border-radius: var(--tb-radius-md);
	border: 1px dashed var(--tb-border);
	margin-bottom: 20px;
}

.terabox-pulse-spinner {
	position: relative;
	width: 52px;
	height: 52px;
	margin: 0 auto 16px;
}

.terabox-pulse-ring {
	position: absolute;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 3px solid rgba(56, 189, 248, 0.3);
	animation: tb-pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.terabox-pulse-core {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 22px;
	height: 22px;
	margin-top: -11px;
	margin-left: -11px;
	background: #38bdf8;
	border-radius: 50%;
	animation: tb-pulse-core 1.5s cubic-bezier(0.455, 0.03, 0.515, 0.955) -0.4s infinite;
}

@keyframes tb-pulse-ring {
	0% { transform: scale(0.6); opacity: 0.8; }
	50% { transform: scale(1.2); opacity: 0.2; }
	100% { transform: scale(1.4); opacity: 0; }
}

@keyframes tb-pulse-core {
	0%, 100% { transform: scale(0.8); }
	50% { transform: scale(1.15); }
}

.terabox-loading-status {
	font-size: 0.95rem;
	color: var(--tb-text-secondary);
	margin: 0;
	font-weight: 500;
}

/* Error Alert Box */
.terabox-alert-box {
	display: flex;
	align-items: center;
	gap: 14px;
	background: rgba(239, 68, 68, 0.12);
	border: 1px solid rgba(239, 68, 68, 0.3);
	border-radius: var(--tb-radius-md);
	padding: 14px 18px;
	margin-bottom: 20px;
	color: #fca5a5;
}

.terabox-alert-icon {
	flex-shrink: 0;
	color: var(--tb-danger);
}
.terabox-alert-icon svg {
	width: 22px;
	height: 22px;
}

.terabox-alert-content {
	flex: 1;
	font-size: 0.9rem;
	line-height: 1.4;
}

.terabox-alert-title {
	display: block;
	font-weight: 600;
	color: #ef4444;
	margin-bottom: 2px;
}

.terabox-alert-close {
	background: none;
	border: none;
	color: #fca5a5;
	font-size: 1.4rem;
	cursor: pointer;
	line-height: 1;
	padding: 0 4px;
	transition: color 0.15s;
}
.terabox-alert-close:hover {
	color: #ffffff;
}

/* Result Box & Player Viewport */
.terabox-result-box {
	animation: tb-fade-in 0.35s ease-out;
}

@keyframes tb-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

.terabox-video-viewport {
	position: relative;
	border-radius: var(--tb-radius-md);
	overflow: hidden;
	background: #000000;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
	margin-bottom: 20px;
}

.terabox-video-viewport .plyr {
	border-radius: var(--tb-radius-md);
	max-height: 520px;
}

/* Plyr Custom Theme Overrides */
.terabox-video-viewport .plyr--video {
	--plyr-color-main: #0284c7;
	--plyr-video-background: #000;
}

/* Meta Card */
.terabox-meta-card {
	background: var(--tb-bg-secondary);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-md);
	padding: 20px;
}

.terabox-meta-header {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 16px;
}

.terabox-thumbnail-wrap {
	width: 90px;
	height: 60px;
	border-radius: var(--tb-radius-sm);
	overflow: hidden;
	background: #000;
	flex-shrink: 0;
	border: 1px solid var(--tb-border);
}

.terabox-thumbnail-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.terabox-meta-info {
	flex: 1;
	min-width: 0;
}

.terabox-file-title {
	font-size: 1.05rem;
	font-weight: 600;
	margin: 0 0 8px;
	color: var(--tb-text-primary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.terabox-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.terabox-badge {
	font-size: 0.75rem;
	font-weight: 600;
	padding: 3px 9px;
	border-radius: 9999px;
	white-space: nowrap;
}

.terabox-badge-size {
	background: rgba(148, 163, 184, 0.15);
	color: var(--tb-text-secondary);
}

.terabox-badge-quality {
	background: rgba(16, 185, 129, 0.15);
	color: #34d399;
	border: 1px solid rgba(16, 185, 129, 0.3);
}

.terabox-badge-stream {
	background: rgba(56, 189, 248, 0.15);
	color: #38bdf8;
	border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Source Selector */
.terabox-source-selector {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	padding: 12px 14px;
	background: rgba(15, 23, 42, 0.5);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-sm);
	margin-bottom: 20px;
}

.terabox-source-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 0.85rem;
	color: var(--tb-text-secondary);
	cursor: pointer;
	user-select: none;
}

.terabox-source-label input[type="radio"] {
	cursor: pointer;
	accent-color: #0284c7;
}

/* Action Buttons */
.terabox-actions {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 12px;
}

.terabox-action-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 18px;
	border-radius: var(--tb-radius-sm);
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none !important;
	cursor: pointer;
	transition: all 0.2s ease;
	border: 1px solid transparent;
}

.terabox-action-btn svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.terabox-btn-download {
	background: #10b981;
	color: #ffffff !important;
	box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.terabox-btn-download:hover {
	background: #059669;
	transform: translateY(-1px);
}

.terabox-btn-alt {
	background: var(--tb-bg-primary);
	border-color: var(--tb-border);
	color: var(--tb-text-primary) !important;
}
.terabox-btn-alt:hover {
	border-color: #38bdf8;
	color: #38bdf8 !important;
	transform: translateY(-1px);
}

.terabox-btn-copy {
	background: var(--tb-bg-primary);
	border: 1px solid var(--tb-border);
	color: var(--tb-text-secondary) !important;
}
.terabox-btn-copy:hover {
	color: var(--tb-text-primary) !important;
	border-color: rgba(148, 163, 184, 0.35);
	transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 640px) {
	.terabox-player-wrapper {
		padding: 16px;
	}
	.terabox-input-group {
		flex-direction: column;
		gap: 8px;
		padding: 8px;
	}
	.terabox-input {
		padding: 10px 8px !important;
	}
	.terabox-btn-primary {
		width: 100%;
	}
	.terabox-actions {
		grid-template-columns: 1fr;
	}
}

/* ==========================================================================
   WP-Admin Settings Styles
   ========================================================================== */
.terabox-admin-wrap {
	max-width: 1100px;
	margin-top: 20px;
}

.terabox-admin-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #ffffff;
	padding: 20px 24px;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	margin-bottom: 24px;
	border-left: 4px solid #0284c7;
}

.terabox-admin-title-area h1 {
	margin: 0 0 6px !important;
	padding: 0 !important;
	font-size: 1.5rem;
}

.terabox-admin-title-area p {
	margin: 0;
	color: #64748b;
}

.terabox-admin-version .badge {
	background: #f1f5f9;
	color: #0284c7;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 9999px;
	font-size: 0.8rem;
}

.terabox-admin-layout {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 24px;
	align-items: start;
}

.terabox-form-card {
	background: #ffffff;
	padding: 24px 28px;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.terabox-password-wrapper {
	display: flex;
	align-items: center;
	gap: 8px;
}

.terabox-password-wrapper input {
	width: 380px !important;
	max-width: 100%;
}

.terabox-test-status {
	display: inline-block;
	margin-left: 12px;
	font-size: 0.85rem;
	font-weight: 500;
	vertical-align: middle;
}
.terabox-test-status.is-loading {
	color: #0284c7;
}
.terabox-test-status.is-success {
	color: #059669;
}
.terabox-test-status.is-error {
	color: #dc2626;
}

.terabox-card {
	background: #ffffff;
	border-radius: 8px;
	padding: 20px 22px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	margin-bottom: 20px;
}

.terabox-card h3 {
	margin-top: 0;
	margin-bottom: 12px;
	font-size: 1.05rem;
	display: flex;
	align-items: center;
	gap: 6px;
	color: #0f172a;
}

.terabox-steps-list {
	padding-left: 20px;
	margin: 0;
	color: #334155;
	line-height: 1.6;
}

.terabox-steps-list li {
	margin-bottom: 8px;
}

.terabox-code-snippet {
	background: #0f172a;
	color: #38bdf8;
	padding: 10px 14px;
	border-radius: 6px;
	font-family: monospace;
	font-size: 0.95rem;
	margin: 10px 0;
}

/* Quick Setup Card */
.terabox-quick-setup-card {
	background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
	border: 1px solid #bbf7d0;
	border-left: 4px solid #10b981;
	border-radius: 8px;
	padding: 20px 24px;
	margin-bottom: 24px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.terabox-quick-setup-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
	flex-wrap: wrap;
	gap: 10px;
}

.terabox-quick-setup-title {
	display: flex;
	align-items: center;
	gap: 8px;
}

.terabox-quick-setup-title h3 {
	margin: 0;
	font-size: 1.15rem;
	color: #065f46;
}

.terabox-quick-setup-title .dashicons {
	color: #10b981;
	font-size: 24px;
	width: 24px;
	height: 24px;
}

.terabox-status-pill {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 9999px;
	font-size: 0.8rem;
	font-weight: 600;
}

.terabox-status-pill.is-active {
	background: #d1fae5;
	color: #065f46;
	border: 1px solid #a7f3d0;
}

.terabox-status-pill.is-inactive {
	background: #f1f5f9;
	color: #64748b;
	border: 1px solid #cbd5e1;
}

.terabox-quick-setup-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 14px;
	flex-wrap: wrap;
}

.terabox-home-notice {
	display: block;
	width: 100%;
}

.terabox-spinner-inline {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid #cbd5e1;
	border-top-color: #0284c7;
	border-radius: 50%;
	animation: tb-spin 0.8s linear infinite;
	vertical-align: middle;
	margin-right: 6px;
}

/* Cloud Resolver Banner */
.terabox-cloud-resolver-banner {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	background: #f0fdf4;
	border: 1px solid #86efac;
	border-left: 4px solid #10b981;
	border-radius: 6px;
	padding: 16px 18px;
	margin-bottom: 24px;
}

.terabox-resolver-badge-icon {
	color: #10b981;
	flex-shrink: 0;
}

.terabox-resolver-badge-icon .dashicons {
	font-size: 26px;
	width: 26px;
	height: 26px;
}

.terabox-resolver-badge-text strong {
	color: #065f46;
	font-size: 1rem;
	display: block;
	margin-bottom: 4px;
}

.terabox-resolver-badge-text p {
	color: #047857;
	margin: 0;
	font-size: 0.88rem;
	line-height: 1.4;
}

@media (max-width: 900px) {
	.terabox-admin-layout {
		grid-template-columns: 1fr;
	}
}

