/* Forge CMS — Admin Panel Stylesheet */

:root {
	--font-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
	--color-bg: #f0f2f5;
	--color-surface: #fff;
	--color-sidebar: #0f172a;
	--color-sidebar-hover: #1e293b;
	--color-sidebar-text: #94a3b8;
	--color-sidebar-active: #e2e8f0;
	--color-text: #1a1a2e;
	--color-text-muted: #64748b;
	--color-border: #e2e5ea;
	--color-accent: #3b82f6;
	--color-accent-hover: #2563eb;
	--color-accent-soft: rgba(59, 130, 246, 0.08);
	--color-success: #059669;
	--color-success-bg: #ecfdf5;
	--color-danger: #dc2626;
	--color-danger-bg: #fef2f2;
	--color-warning-bg: #fffbeb;
	--color-warning: #92400e;
	--color-info-bg: #eff6ff;
	--color-info: #1e40af;
	--radius: 10px;
	--radius-sm: 6px;
	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
	--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
	--sidebar-w: 240px;
	--transition: 0.2s ease;
}

*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: var(--font-body);
	line-height: 1.6;
	color: var(--color-text);
	background: var(--color-bg);
	font-size: 15px;
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--color-accent);
	text-decoration: none;
	transition: color var(--transition);
}
a:hover { color: var(--color-accent-hover); }

/* ==================== Layout ==================== */

.admin-wrap {
	display: flex;
	min-height: 100vh;
}

.admin-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: var(--sidebar-w);
	background: var(--color-sidebar);
	color: var(--color-sidebar-text);
	display: flex;
	flex-direction: column;
	z-index: 100;
	overflow-y: auto;
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 24px 20px 20px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-sidebar h2 {
	font-size: 1.15rem;
	font-weight: 700;
	color: #fff;
	letter-spacing: -0.02em;
}

.sidebar-close {
	display: none;
	background: none;
	border: none;
	color: var(--color-sidebar-text);
	font-size: 1.5rem;
	cursor: pointer;
	padding: 0;
	line-height: 1;
}

.admin-sidebar nav {
	padding: 12px 0;
	flex: 1;
}

.admin-sidebar nav a {
	display: flex;
	align-items: center;
	padding: 10px 20px;
	color: var(--color-sidebar-text);
	font-size: 0.9rem;
	font-weight: 500;
	border-left: 3px solid transparent;
	transition: all var(--transition);
}

.admin-sidebar nav a:hover {
	background: var(--color-sidebar-hover);
	color: var(--color-sidebar-active);
}

.admin-sidebar nav a.active {
	background: var(--color-sidebar-hover);
	color: #fff;
	border-left-color: var(--color-accent);
}

.admin-content {
	flex: 1;
	margin-left: var(--sidebar-w);
	padding: 32px;
	min-width: 0;
}

/* Mobile menu button */
.mobile-menu-btn {
	display: none;
	position: fixed;
	top: 16px;
	left: 16px;
	z-index: 90;
	width: 40px;
	height: 40px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-border);
	background: var(--color-surface);
	box-shadow: var(--shadow-sm);
	cursor: pointer;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	padding: 0;
	transition: box-shadow var(--transition);
}

.mobile-menu-btn:hover {
	box-shadow: var(--shadow-md);
}

.mobile-menu-btn span {
	display: block;
	width: 18px;
	height: 2px;
	background: var(--color-text);
	border-radius: 1px;
	transition: all var(--transition);
}

/* Sidebar overlay */
.sidebar-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: 99;
	backdrop-filter: blur(2px);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
	display: block;
	opacity: 1;
}

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

.admin-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 28px;
	flex-wrap: wrap;
	gap: 12px;
}

.admin-header h1 {
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--color-text);
}

/* ==================== Cards ==================== */

.card {
	background: var(--color-surface);
	border-radius: var(--radius);
	padding: 24px;
	box-shadow: var(--shadow-sm);
	margin-bottom: 20px;
	border: 1px solid var(--color-border);
}

/* ==================== Tables ==================== */

.table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

table {
	width: 100%;
	border-collapse: collapse;
}

th, td {
	padding: 12px 14px;
	text-align: left;
	border-bottom: 1px solid var(--color-border);
}

th {
	font-weight: 600;
	font-size: 0.8rem;
	color: var(--color-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

tbody tr {
	transition: background var(--transition);
}

tbody tr:hover {
	background: var(--color-accent-soft);
}

/* ==================== Forms ==================== */

.form-group {
	margin-bottom: 18px;
}

.form-group label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
	font-size: 0.85rem;
	color: var(--color-text);
	letter-spacing: 0.01em;
}

.form-control {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-size: 0.95rem;
	font-family: var(--font-body);
	color: var(--color-text);
	background: var(--color-surface);
	transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
	outline: none;
	border-color: var(--color-accent);
	box-shadow: 0 0 0 3px var(--color-accent-soft);
}

select.form-control {
	appearance: auto;
}

textarea.form-control {
	min-height: 100px;
	resize: vertical;
}

/* ==================== Buttons ==================== */

.btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 20px;
	border-radius: var(--radius-sm);
	font-weight: 600;
	cursor: pointer;
	border: 1px solid transparent;
	font-size: 0.875rem;
	font-family: var(--font-body);
	text-decoration: none;
	transition: all var(--transition);
	white-space: nowrap;
}

.btn-primary {
	background: var(--color-accent);
	color: #fff;
}
.btn-primary:hover {
	background: var(--color-accent-hover);
	color: #fff;
	box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
	background: var(--color-bg);
	color: var(--color-text);
	border-color: var(--color-border);
}
.btn-secondary:hover {
	background: var(--color-border);
	color: var(--color-text);
}

.btn-danger {
	background: var(--color-danger);
	color: #fff;
}
.btn-danger:hover {
	background: #b91c1c;
	color: #fff;
	box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.btn-sm {
	padding: 5px 12px;
	font-size: 0.8rem;
}

/* ==================== Badges ==================== */

.badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.badge-published {
	background: var(--color-success-bg);
	color: var(--color-success);
}

.badge-draft {
	background: var(--color-warning-bg);
	color: var(--color-warning);
}

/* ==================== Alerts ==================== */

.alert {
	padding: 14px 18px;
	border-radius: var(--radius-sm);
	margin-bottom: 18px;
	font-size: 0.9rem;
	font-weight: 500;
	border-left: 3px solid transparent;
}

.alert-success {
	background: var(--color-success-bg);
	color: var(--color-success);
	border-left-color: var(--color-success);
}

.alert-error {
	background: var(--color-danger-bg);
	color: #991b1b;
	border-left-color: var(--color-danger);
}

.alert-info {
	background: var(--color-info-bg);
	color: var(--color-info);
	border-left-color: var(--color-accent);
}

/* ==================== Stats grid ==================== */

.stats-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	margin-bottom: 24px;
}

.stat-card {
	background: var(--color-surface);
	border-radius: var(--radius);
	padding: 20px 24px;
	box-shadow: var(--shadow-sm);
	border: 1px solid var(--color-border);
	transition: box-shadow var(--transition);
}

.stat-card:hover {
	box-shadow: var(--shadow-md);
}

.stat-card .stat-value {
	font-size: 2rem;
	font-weight: 700;
	color: var(--color-text);
	letter-spacing: -0.03em;
	line-height: 1.2;
}

.stat-card .stat-label {
	font-size: 0.825rem;
	color: var(--color-text-muted);
	margin-top: 4px;
	font-weight: 500;
}

/* ==================== Media grid ==================== */

.media-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 16px;
}

.media-item {
	position: relative;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	transition: box-shadow var(--transition);
}

.media-item:hover {
	box-shadow: var(--shadow-md);
}

.media-item img {
	width: 100%;
	height: 130px;
	object-fit: cover;
}

.media-item .media-info {
	padding: 10px 12px;
	font-size: 0.8rem;
	color: var(--color-text-muted);
}

.media-item .media-actions {
	padding: 0 12px 10px;
}

/* ==================== Login page ==================== */

.login-page {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	background: var(--color-sidebar);
}

.login-box {
	background: var(--color-surface);
	padding: 44px 40px;
	border-radius: 14px;
	width: 100%;
	max-width: 400px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.login-box h1 {
	font-size: 1.4rem;
	font-weight: 700;
	margin-bottom: 28px;
	text-align: center;
	letter-spacing: -0.02em;
}

/* ==================== Utility ==================== */

.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.gap-1 { gap: 8px; }

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

/* Tablet */
@media (max-width: 1024px) {
	.stats-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* Mobile */
@media (max-width: 768px) {
	.admin-sidebar {
		transform: translateX(-100%);
	}

	.admin-sidebar.open {
		transform: translateX(0);
	}

	.sidebar-close {
		display: block;
	}

	.mobile-menu-btn {
		display: flex;
	}

	.admin-content {
		margin-left: 0;
		padding: 20px 16px;
		padding-top: 68px;
	}

	.admin-header {
		margin-bottom: 20px;
	}

	.admin-header h1 {
		font-size: 1.25rem;
	}

	/* Stack page form grid on mobile */
	div[style*="grid-template-columns: 1fr 1fr 1fr"] {
		display: flex !important;
		flex-direction: column !important;
	}

	.stats-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}

	.stat-card {
		padding: 16px;
	}

	.stat-card .stat-value {
		font-size: 1.5rem;
	}

	.card {
		padding: 18px;
	}

	.media-grid {
		grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
		gap: 10px;
	}

	/* Responsive table: horizontal scroll */
	table {
		min-width: 500px;
	}

	.btn {
		padding: 8px 14px;
		font-size: 0.82rem;
	}

	.login-box {
		margin: 16px;
		padding: 32px 24px;
	}
}

/* Small phones */
@media (max-width: 480px) {
	.admin-content {
		padding: 16px 12px;
		padding-top: 64px;
	}

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

	.stat-card .stat-value {
		font-size: 1.3rem;
	}

	.stat-card .stat-label {
		font-size: 0.75rem;
	}

	.media-grid {
		grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	}
}
