[x-cloak] {
	display: none !important;
}

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

:root {
	--bg: #f8f9fa;
	--surface: #ffffff;
	--border: #dee2e6;
	--text: #212529;
	--text-muted: #6c757d;
	--primary: #4361ee;
	--primary-hover: #3a51d4;
	--danger: #dc3545;
	--success: #198754;
	--radius: 8px;
	--shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.5;
	min-height: 100vh;
}

a {
	color: var(--primary);
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}

/* Layout */
.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 1rem;
}
.header {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	padding: 0.75rem 0;
	position: sticky;
	top: 0;
	z-index: 100;
}
.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 1rem;
}
.header h1 {
	font-size: 1.1rem;
	font-weight: 600;
}
.header nav {
	display: flex;
	gap: 1rem;
	align-items: center;
}
.header nav a,
.header nav button {
	font-size: 0.875rem;
}

.page-title {
	margin: 1.5rem 0 1rem;
	font-size: 1.5rem;
	font-weight: 600;
}
.page-subtitle {
	color: var(--text-muted);
	margin-bottom: 1.5rem;
	font-size: 0.9rem;
}

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
	font-size: 0.875rem;
	cursor: pointer;
	transition: all 0.15s;
}
.btn:hover {
	background: var(--bg);
}
.btn-primary {
	background: var(--primary);
	color: #fff;
	border-color: var(--primary);
}
.btn-primary:hover {
	background: var(--primary-hover);
}
.btn-success {
	background: var(--success);
	color: #fff;
	border-color: var(--success);
}
.btn-danger {
	background: var(--danger);
	color: #fff;
	border-color: var(--danger);
}
.btn-sm {
	padding: 0.25rem 0.75rem;
	font-size: 0.8rem;
}
.btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Forms */
.input {
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-size: 0.875rem;
	width: 100%;
	background: var(--surface);
}
.input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}
textarea.input {
	resize: vertical;
	min-height: 60px;
	font-family: inherit;
}
.form-group {
	margin-bottom: 1rem;
}
.form-group label {
	display: block;
	font-size: 0.8rem;
	font-weight: 500;
	margin-bottom: 0.25rem;
	color: var(--text-muted);
}

/* Cards */
.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
}

/* Folder grid */
.folder-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1rem;
}
.folder-card {
	transition:
		transform 0.15s,
		box-shadow 0.15s;
	cursor: pointer;
}
.folder-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.folder-card-cover {
	height: 160px;
	background: #e9ecef;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
	font-size: 2rem;
	overflow: hidden;
}
.folder-card-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.folder-card-body {
	padding: 0.75rem 1rem;
}
.folder-card-title {
	font-weight: 600;
	font-size: 1rem;
}
.folder-card-meta {
	font-size: 0.8rem;
	color: var(--text-muted);
	margin-top: 0.25rem;
}
.folder-progress {
	margin-top: 0.5rem;
}
.progress-bar {
	height: 4px;
	background: #e9ecef;
	border-radius: 2px;
	overflow: hidden;
}
.progress-fill {
	height: 100%;
	background: var(--success);
	transition: width 0.3s;
}

/* Image grid */
.image-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 0.75rem;
}
.image-thumb {
	position: relative;
	aspect-ratio: 1;
	border-radius: var(--radius);
	overflow: hidden;
	cursor: pointer;
	border: 2px solid transparent;
	transition:
		border-color 0.15s,
		transform 0.15s;
}
.image-thumb:hover {
	transform: scale(1.03);
	border-color: var(--primary);
}
.image-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.image-thumb .seen-badge {
	position: absolute;
	top: 6px;
	right: 6px;
	background: var(--success);
	color: #fff;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.7rem;
}
.image-thumb .commented-badge {
	background: var(--primary);
	font-size: 0.75rem;
	margin-right: 1.75rem;
}

/* Photo detail - dark background for image */
.photo-viewer {
	background: #1a1a1a;
	border-radius: var(--radius);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	min-height: 400px;
	max-height: 75vh;
	overflow: hidden;
}
.photo-viewer img {
	max-width: 100%;
	max-height: 75vh;
	object-fit: contain;
}
.photo-nav-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.75);
	color: #333;
	border: none;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 1.2rem;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s;
	backdrop-filter: blur(4px);
	z-index: 5;
}
.photo-nav-btn:hover {
	background: rgba(255, 255, 255, 0.3);
}
.photo-nav-btn.prev {
	left: 12px;
}
.photo-nav-btn.next {
	right: 12px;
}
.photo-nav-btn:disabled {
	opacity: 0.3;
	cursor: default;
}

/* Photo detail layout */
.photo-layout {
	display: grid;
	grid-template-columns: 1fr 340px;
	gap: 1.5rem;
	margin-top: 1rem;
}
@media (max-width: 900px) {
	.photo-layout {
		grid-template-columns: 1fr;
	}
}
.photo-main {
	min-width: 0;
}
.photo-sidebar {
	min-width: 0;
}

/* Comments */
.comments-section {
	margin-top: 1rem;
}
.comments-list {
	max-height: 500px;
	overflow-y: auto;
}
.comment {
	padding: 0.75rem;
	border-bottom: 1px solid var(--border);
}
.comment:last-child {
	border-bottom: none;
}
.comment-header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-bottom: 0.25rem;
}
.comment-author {
	font-weight: 600;
	font-size: 0.85rem;
}
.comment-time {
	font-size: 0.75rem;
	color: var(--text-muted);
}
.comment-body {
	font-size: 0.9rem;
	white-space: pre-wrap;
}
.comment-form {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.75rem;
}
.comment-form .input {
	flex: 1;
}

/* Breadcrumb */
.breadcrumb {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.85rem;
	color: var(--text-muted);
	margin-top: 1rem;
	margin-bottom: 1rem;
}
.breadcrumb a {
	color: var(--primary);
}
.breadcrumb span {
	color: var(--text-muted);
}

/* Login page */
.login-container {
	max-width: 400px;
	margin: 0 auto;
	padding: 1rem;
	text-align: center;
	height: 100vh;
	display: flex;
	flex-direction: column;
	justify-content: center;
	overflow: hidden;
}
.login-container h1 {
	font-size: 2rem;
	margin-bottom: 0.5rem;
}
.login-container p {
	color: var(--text-muted);
	margin-bottom: 2rem;
}

/* Admin */
.stats-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
}
.stats-table th,
.stats-table td {
	padding: 0.5rem 0.75rem;
	text-align: left;
	border-bottom: 1px solid var(--border);
}
.stats-table th {
	font-weight: 600;
	background: var(--bg);
	position: sticky;
	top: 0;
}
.stats-table tr:hover td {
	background: #f8f9fa;
}
.stats-expand {
	font-size: 0.8rem;
	color: var(--text-muted);
	padding-left: 2rem;
}

.admin-section {
	margin-bottom: 2rem;
}
.admin-section h2 {
	font-size: 1.1rem;
	margin-bottom: 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--border);
}

/* Tabs */
.tabs {
	display: flex;
	gap: 0;
	border-bottom: 2px solid var(--border);
	margin-bottom: 1.5rem;
}
.tab {
	padding: 0.5rem 1rem;
	cursor: pointer;
	font-size: 0.875rem;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	color: var(--text-muted);
	transition: all 0.15s;
}
.tab:hover {
	color: var(--text);
}
.tab.active {
	color: var(--primary);
	border-bottom-color: var(--primary);
	font-weight: 500;
}

/* Modal */
.modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}
.modal {
	background: var(--surface);
	border-radius: var(--radius);
	padding: 1.5rem;
	max-width: 420px;
	width: 90%;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.modal h2 {
	font-size: 1.1rem;
	margin-bottom: 1rem;
}

/* Toasts */
.toast-container {
	position: fixed;
	bottom: 1rem;
	right: 1rem;
	z-index: 2000;
}
.toast {
	background: var(--text);
	color: #fff;
	padding: 0.75rem 1rem;
	border-radius: var(--radius);
	font-size: 0.85rem;
	margin-top: 0.5rem;
	animation: slideIn 0.2s ease;
}
@keyframes slideIn {
	from {
		transform: translateY(10px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

/* Empty state */
.empty-state {
	text-align: center;
	padding: 3rem 1rem;
	color: var(--text-muted);
}
.empty-state .icon {
	font-size: 2.5rem;
	margin-bottom: 0.5rem;
}

/* Unseen count badge */
.badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.15rem 0.5rem;
	border-radius: 10px;
	font-size: 0.7rem;
	font-weight: 600;
}
.badge-warning {
	background: #fff3cd;
	color: #856404;
}
.badge-success {
	background: #d1e7dd;
	color: #0f5132;
}

/* Seen prompt */
.seen-prompt {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1rem;
	margin-top: 1rem;
}
