/* Dashboard Custom Styles - Complementing Bootstrap 5 */

:root {
	--primary: #4F46E5;
	--success: #10B981;
	--danger: #EF4444;
	--warning: #F59E0B;
	--info: #06B6D4;
}

/* Background & Layout */
body {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	min-height: 100vh;
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	margin: 0;
	overflow: hidden;
}

.app-layout {
	display: flex;
	height: 100vh;
	overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
	width: 260px;
	min-width: 260px;
	background: rgba(15, 15, 35, 0.95);
	backdrop-filter: blur(20px);
	display: flex;
	flex-direction: column;
	border-right: 1px solid rgba(255, 255, 255, 0.08);
	transition: margin-left 0.3s ease, opacity 0.3s ease;
	z-index: 1000;
}

.sidebar.collapsed {
	margin-left: -260px;
}

.sidebar-header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	color: white;
	font-size: 1.25rem;
	font-weight: 700;
}

.sidebar-header i {
	font-size: 1.5rem;
	color: #667eea;
}

.sidebar-title {
	white-space: nowrap;
}

/* User Info */
.sidebar-user {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: linear-gradient(135deg, #667eea, #764ba2);
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-size: 1.25rem;
	flex-shrink: 0;
	overflow: hidden;
}

.sidebar-user-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

.sidebar-user-info {
	overflow: hidden;
}

.sidebar-user-name {
	color: white;
	font-weight: 600;
	font-size: 0.9rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sidebar-user-email {
	color: rgba(255, 255, 255, 0.5);
	font-size: 0.75rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Navigation */
.sidebar-nav {
	flex: 1;
	padding: 1rem 0.75rem;
	overflow-y: auto;
}

.sidebar-nav-item {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	color: rgba(255, 255, 255, 0.6);
	text-decoration: none;
	border-radius: 8px;
	transition: all 0.2s;
	font-size: 0.9rem;
	font-weight: 500;
	margin-bottom: 0.25rem;
}

.sidebar-nav-item:hover {
	color: white;
	background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav-item.active {
	color: white;
	background: linear-gradient(135deg, var(--primary), #667eea);
	box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sidebar-nav-item i {
	font-size: 1.15rem;
	width: 1.5rem;
	text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
	padding: 1rem 1rem;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.sidebar-logout {
	color: rgba(255, 255, 255, 0.5) !important;
	font-size: 0.85rem;
}

.sidebar-logout:hover {
	color: var(--danger) !important;
	background: rgba(239, 68, 68, 0.1) !important;
}

/* ===== Main Content ===== */
.main-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-width: 0;
}

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1.5rem;
	background: rgba(0, 0, 0, 0.1);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	flex-shrink: 0;
}

.sidebar-toggle {
	color: white !important;
	text-decoration: none;
	padding: 0.25rem;
}

.topbar-actions {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.container-main {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 2rem;
	padding-bottom: 2rem;
}

/* Navbar - removed, replaced by sidebar */
.navbar {
	display: none;
}

.navbar-brand {
	font-weight: 700;
	font-size: 1.5rem;
	color: white !important;
}

/* Cards */
.card {
	background: rgba(255, 255, 255, 0.95);
	border: none;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
	backdrop-filter: blur(10px);
}

.card-header {
	background: linear-gradient(135deg, var(--primary) 0%, #667eea 100%);
	color: white;
	border-radius: 12px 12px 0 0;
	border: none;
	padding: 1.5rem;
}

.card-header h5 {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 600;
}

/* Accordion buttons that inherit .card-header gradient keep a white chevron */
.accordion-button[style*="var(--primary)"]::after,
.accordion-button[style*="var(--primary)"]:not(.collapsed)::after {
	filter: brightness(0) invert(1);
}

/* Discord accordion header — uses Discord's brand color (#5865F2) */
.accordion-button--discord,
.accordion-button--discord:not(.collapsed) {
	background-color: #5865F2;
	color: white;
	font-weight: 600;
	box-shadow: none;
}

.accordion-button--discord:focus {
	box-shadow: 0 0 0 0.2rem rgba(88, 101, 242, 0.4);
}

.accordion-button--discord::after,
.accordion-button--discord:not(.collapsed)::after {
	filter: brightness(0) invert(1);
}

/* Find in Spotify accordion header — uses Spotify's brand color (#1DB954) */
.accordion-button--spotify,
.accordion-button--spotify:not(.collapsed) {
	background-color: #1DB954;
	color: white;
	font-weight: 600;
	box-shadow: none;
}

.accordion-button--spotify:focus {
	box-shadow: 0 0 0 0.2rem rgba(29, 185, 84, 0.4);
}

.accordion-button--spotify::after,
.accordion-button--spotify:not(.collapsed)::after {
	filter: brightness(0) invert(1);
}

/* Tables */
.table {
	margin: 0;
	font-size: 0.95rem;
}

.card-body.p-0 {
	background-color: #f2f4f7;
	border-radius: 0 0 12px 12px;
	padding: 0.75rem !important;
}

.table thead th {
	background: #f8f9fa;
	border-bottom: 2px solid #e9ecef;
	color: #495057;
	font-weight: 600;
	text-transform: uppercase;
	font-size: 0.85rem;
}

.table tbody tr {
	border-bottom: 1px solid #e9ecef;
	transition: background-color 0.2s;
}

.table tbody tr:hover {
	background-color: #f8f9fa;
}

.job-row {
	cursor: pointer;
	transition: all 0.2s;
}

.job-row:hover {
	background-color: #f0f4ff !important;
}

.table-responsive {
	max-height: 500px;
	overflow-y: auto;
}

.table-responsive::-webkit-scrollbar {
	width: 8px;
}

.table-responsive::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
	background: #888;
	border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
	background: #555;
}

/* Badges */
.badge {
	padding: 0.5rem 0.75rem;
	border-radius: 6px;
	font-size: 0.85rem;
	font-weight: 500;
}

.badge-success {
	background: rgba(16, 185, 129, 0.1);
	color: var(--success);
}

.badge-danger {
	background: rgba(239, 68, 68, 0.1);
	color: var(--danger);
}

.badge-warning {
	background: rgba(245, 158, 11, 0.1);
	color: var(--warning);
}

.badge-info {
	background: rgba(6, 182, 212, 0.1);
	color: var(--info);
}

.badge-secondary {
	background: rgba(107, 114, 128, 0.1);
	color: #6B7280;
}

/* Buttons */
.btn-sm {
	padding: 0.375rem 0.75rem;
	font-size: 0.85rem;
	border-radius: 6px;
}

.btn-primary {
	background: var(--primary);
	border: none;
}

.btn-primary:hover {
	background: #4338CA;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-success {
	background: var(--success);
	border: none;
}

.btn-success:hover {
	background: #059669;
}

.btn-danger {
	background: var(--danger);
	border: none;
}

.btn-danger:hover {
	background: #DC2626;
}

.btn-info {
	background: var(--info);
	border: none;
}

.btn-info:hover {
	background: #0891B2;
}

.btn-warning {
	background: var(--warning);
	border: none;
}

.btn-warning:hover {
	background: #D97706;
}

.btn-secondary {
	background: #6B7280;
	border: none;
}

.btn-secondary:hover {
	background: #4B5563;
}

.btn-toggle-off {
	opacity: 0.6;
}

/* Stats Cards */
.stats-card {
	background: linear-gradient(135deg, var(--primary) 0%, #667eea 100%);
	color: white;
	border-radius: 12px;
	padding: 1.5rem;
	margin-bottom: 1rem;
	text-align: center;
	box-shadow: 0 8px 32px rgba(79, 70, 229, 0.2);
	transition: transform 0.3s;
}

.stats-card:hover {
	transform: translateY(-5px);
}

.stats-card h6 {
	text-transform: uppercase;
	font-size: 0.75rem;
	opacity: 0.8;
	margin-bottom: 0.5rem;
}

.stats-card .number {
	font-size: 2rem;
	font-weight: 700;
}

/* Forms */
.form-control,
.form-select {
	border-radius: 8px;
	border: 1px solid #e9ecef;
	padding: 0.75rem;
}

.form-control:focus,
.form-select:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
}

.form-label {
	font-weight: 500;
	color: #495057;
	margin-bottom: 0.5rem;
}

/* Modals */
.modal-header {
	background: linear-gradient(135deg, var(--primary) 0%, #667eea 100%);
	color: white;
	border: none;
}

.modal-body {
	background: #f8f9fa;
}

/* Alerts */
.alert {
	border-radius: 8px;
	border: none;
}

.alert-info {
	background-color: rgba(6, 182, 212, 0.1);
	border-left: 3px solid var(--info);
	color: #0891B2;
}

/* Toasts */
.toast-container {
	position: fixed;
	top: 1rem;
	right: 1rem;
	z-index: 9999;
}

.toast {
	background: white;
	border-radius: 8px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.toast.bg-success {
	background-color: rgba(16, 185, 129, 0.1) !important;
	color: var(--success);
	border-left: 4px solid var(--success);
}

.toast.bg-danger {
	background-color: rgba(239, 68, 68, 0.1) !important;
	color: var(--danger);
	border-left: 4px solid var(--danger);
}

.toast.bg-warning {
	background-color: rgba(245, 158, 11, 0.1) !important;
	color: var(--warning);
	border-left: 4px solid var(--warning);
}

.toast.bg-info {
	background-color: rgba(6, 182, 212, 0.1) !important;
	color: var(--info);
	border-left: 4px solid var(--info);
}

/* Spinner Animation */
.loading-spinner {
	display: inline-block;
	width: 1rem;
	height: 1rem;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top: 2px solid white;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% {
		transform: rotate(0deg);
	}

	100% {
		transform: rotate(360deg);
	}
}

.refresh-btn {
	position: relative;
	transition: all 0.3s;
}

.refresh-btn.spinning .bi-arrow-clockwise {
	display: inline-block;
	animation: spin 1s linear infinite;
}

/* Logs & Code */
.small-log {
	background: #f8f9fa;
	border-radius: 8px;
	padding: 0.75rem;
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 0.85rem;
	max-height: 300px;
	overflow-y: auto;
	color: #495057;
	white-space: pre-wrap;
	word-break: break-all;
	border-left: 3px solid #e9ecef;
}

.cron-preview,
.schedule-code {
	font-family: 'Monaco', 'Courier New', monospace;
	background: #f8f9fa;
	padding: 0.5rem;
	border-radius: 4px;
	color: var(--primary);
	font-weight: 600;
	font-size: 0.9rem;
	border: 1px solid #e9ecef;
}

/* Empty State */
.no-data {
	text-align: center;
	padding: 2rem;
	color: #6B7280;
}

.no-data i {
	font-size: 3rem;
	opacity: 0.3;
	margin-bottom: 1rem;
	display: block;
}

/* Filters collapse header */
.filters-header {
	border-radius: 12px !important;
	border: none;
	user-select: none;
}

.filters-header.collapsed .filters-chevron,
.filters-header[aria-expanded="false"] .filters-chevron {
	transform: rotate(180deg);
}

/* Execution Results */
#latestExecutionsContainer {
	max-height: 400px;
	overflow-y: auto;
	padding-right: 0.5rem;
}

#latestExecutionsContainer::-webkit-scrollbar {
	width: 8px;
}

#latestExecutionsContainer::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 10px;
}

#latestExecutionsContainer::-webkit-scrollbar-thumb {
	background: #888;
	border-radius: 10px;
}

#latestExecutionsContainer::-webkit-scrollbar-thumb:hover {
	background: #555;
}

.execution-result-card {
	background: #f8f9fa;
	border-radius: 8px;
	padding: 1rem;
	margin-bottom: 0.75rem;
	border-left: 4px solid #e9ecef;
	transition: all 0.2s;
}

.execution-result-card:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.execution-result-card:last-child {
	margin-bottom: 0;
}

.execution-result-card.success {
	border-left-color: var(--success);
	background: rgba(16, 185, 129, 0.05);
}

.execution-result-card.error {
	border-left-color: var(--danger);
	background: rgba(239, 68, 68, 0.05);
}

.execution-result-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.75rem;
}

.execution-result-header .badge {
	font-size: 0.9rem;
}

.execution-result-job {
	font-weight: 600;
	color: var(--primary);
	font-size: 1rem;
}

.execution-result-time {
	font-size: 0.85rem;
	color: #6B7280;
}

.execution-result-details {
	margin-top: 0.5rem;
}

.execution-result-detail {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
	font-size: 0.9rem;
}

.execution-result-detail strong {
	color: #495057;
}

.execution-result-error {
	background: rgba(239, 68, 68, 0.1);
	color: var(--danger);
	padding: 0.5rem;
	border-radius: 4px;
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 0.85rem;
	margin-top: 0.5rem;
	border-left: 2px solid var(--danger);
}

.output-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.5rem;
}

.toggle-format-btn {
	background: none;
	border: none;
	color: #495057;
	cursor: pointer;
	padding: 0.25rem 0.5rem;
	border-radius: 4px;
	transition: all 0.2s ease;
	font-size: 0.9rem;
}

.toggle-format-btn:hover {
	background: rgba(0, 0, 0, 0.05);
	color: var(--primary);
}

.output-text, .output-text-formatted, .error-text {
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 0.85rem;
	white-space: pre-wrap;
	word-wrap: break-word;
	margin: 0;
	padding: 0.5rem;
	background: rgba(0, 0, 0, 0.05);
	border-radius: 4px;
	border: 1px solid rgba(0, 0, 0, 0.1);
	max-height: 200px;
	overflow-y: auto;
}

.last-run {
	font-size: 0.85rem;
	color: #6B7280;
}

.status-indicator {
	display: inline-block;
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	margin-right: 0.5rem;
	animation: pulse 2s infinite;
}

.status-indicator.active {
	background: var(--success);
}

.status-indicator.inactive {
	background: #9CA3AF;
}

@keyframes pulse {

	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0.5;
	}
}

/* Cron Builder */
.cron-builder {
	background: white;
	border-radius: 8px;
	padding: 1rem;
	border: 1px solid #e9ecef;
}

.cron-mode-card {
	cursor: pointer;
	transition: all 0.3s ease;
	position: relative;
	user-select: none;
	border: 2px solid #dee2e6 !important;
}

.cron-mode-card.cron-selected {
	border: 2px solid #0d6efd !important;
	background-color: #e7f1ff !important;
}

.cron-mode-card.cron-unselected {
	border: 2px solid #dee2e6 !important;
	background-color: transparent !important;
}

.cron-mode-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.cron-mode-card .card-body {
	transition: all 0.3s ease;
}

.cron-mode-card .card-title {
	color: #333;
	font-weight: 600;
}

.cron-mode-card .card-title i {
	font-size: 1.25rem;
}

.cron-scheduled-card:hover .card-title,
.cron-manual-card:hover .card-title {
	color: #0d6efd;
}

.cron-preset-select {
	background: white;
	border: 1px solid #e9ecef;
	border-radius: 8px;
}

.cron-preset-select:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
}

.cron-manual-builder {
	background: #f8f9fa;
	border-radius: 8px;
	padding: 1rem;
	border: 1px dashed #dee2e6;
}

.cron-manual-builder input {
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 0.85rem;
}

.cron-description {
	font-size: 0.95rem;
	color: #495057;
}

/* Responsive */
@media (max-width: 768px) {
	.sidebar {
		position: fixed;
		left: 0;
		top: 0;
		height: 100vh;
		z-index: 1050;
		box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
	}

	.sidebar.collapsed {
		margin-left: -260px;
	}

	.sidebar-overlay {
		display: none;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.5);
		z-index: 1040;
	}

	.sidebar-overlay.show {
		display: block;
	}

	.container-main {
		padding: 1rem;
	}

	.table {
		font-size: 0.8rem;
	}

	.btn-sm {
		padding: 0.25rem 0.5rem;
		font-size: 0.75rem;
	}

	.stats-card {
		padding: 1rem;
		margin-bottom: 0.75rem;
	}

	.stats-card .number {
		font-size: 1.5rem;
	}
}