/* ===== Reset & theme ===== */

:root {
	color-scheme: light;
	--bg: #0f172a;
	--bg-soft: #111827;
	--card: #ffffff;
	--card-soft: #f8fafc;
	--text: #0f172a;
	--text-muted: #64748b;
	--brand: #2563eb;
	--brand-2: #22c55e;
	--danger: #ef4444;
	--warning: #f59e0b;
	--border: #e2e8f0;
	--shadow: 0 10px 30px rgba(2, 6, 23, 0.12);
	--radius: 14px;
	--radius-sm: 10px;
}

* {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
	background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
	color: var(--text);
}

body {
	display: block;
}

a {
	color: var(--brand);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

/* ===== Layout ===== */
.container {
	width: min(1100px, 92vw);
	margin: 28px auto 40px auto;
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(6px);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 24px;
}

.page-header {
	text-align: center;
	margin-bottom: 18px;
}

.top-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
	flex-wrap: wrap;
}

.nav-left, .nav-right {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.nav-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 12px;
	background: #e2e8f0;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text);
	font-weight: 600;
	text-decoration: none;
}

.nav-link:hover {
	background: #cbd5f1;
	text-decoration: none;
}

.file-name {
	min-width: 200px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 12px;
	margin-bottom: 6px;
	background: #e2e8f0;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text);
	font-weight: 600;
	text-decoration: none;
}
.file-name:hover {
	background: #cbd5f1;
	text-decoration: none;
}

.nav-logout {
	background: #fee2e2;
	color: #991b1b;
}

.page-header h1 {
	margin: 0 0 8px 0;
	font-size: clamp(28px, 3.4vw, 40px);
	letter-spacing: -0.02em;
}

.page-subtitle, .subtitle {
	margin: 0;
	color: var(--text-muted);
	font-size: 16px;
}

/* ===== Lists & buttons (index) ===== */
ul {
	list-style: none;
	padding: 0;
	margin: 18px 0 22px 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 10px;
}

li {
	margin: 0;
}

.button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	padding: 14px 18px;
	background: linear-gradient(135deg, #2563eb, #1d4ed8);
	color: #fff;
	border-radius: var(--radius-sm);
	font-weight: 600;
	border: 1px solid rgba(255, 255, 255, 0.2);
	transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.button:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
	text-decoration: none;
}

.admin-section {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px dashed var(--border);
	text-align: center;
}

.admin-section h2 {
	margin: 0 0 10px 0;
}

.admin-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 6px 8px;
	padding: 10px 14px;
	background: #f1f5f9;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text);
	font-weight: 600;
}

.admin-link:hover {
	background: #e2e8f0;
	text-decoration: none;
}

/* ===== Forms ===== */
.login-page {
	min-height: 100vh;
	display: grid;
	place-items: center;
	background: linear-gradient(180deg, #e2e8f0 0%, #f8fafc 100%);
}

.login-container, .login-box, .password-section {
	width: min(520px, 92vw);
	margin: 0 auto;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 22px;
}

.header {
	margin-bottom: 22px;
}

.form-group {
	display: grid;
	gap: 6px;
	margin: 10px 0;
}

label {
	font-weight: 600;
	font-size: 14px;
	color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="email"] {
	width: 100%;
	padding: 12px 14px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	outline: none;
	font-size: 15px;
	background: #fff;
	transition: border 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
	border-color: #94a3b8;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

button, .action-btn, .logout-btn, .refresh-btn, .dialog-btn, .upload-btn, .clear-btn {
	border: none;
	cursor: pointer;
	font-weight: 600;
	border-radius: var(--radius-sm);
	transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

button {
	padding: 12px 16px;
	background: var(--brand);
	color: #fff;
}

button:hover {
	transform: translateY(-1px);
	box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.back-link {
	display: inline-block;
	margin-top: 10px;
	color: var(--text-muted);
	font-weight: 600;
}

.logout-btn {
	background: #e2e8f0;
	color: var(--text);
	padding: 10px 14px;
}

/* ===== Alerts ===== */
.alert, .alert-error, .alert-success {
	border-radius: var(--radius-sm);
	padding: 10px 12px;
	margin: 10px 0;
	font-weight: 600;
}

.alert.error,
.alert-error {
	background: #fee2e2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

.alert-success {
	background: #dcfce7;
	color: #166534;
	border: 1px solid #bbf7d0;
}

.info-box {
	background: #f1f5f9;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 10px 12px;
	margin: 10px 0;
	color: var(--text);
}

.current-password {
	padding: 8px 10px;
	background: #f8fafc;
	border: 1px dashed var(--border);
	border-radius: var(--radius-sm);
	margin-bottom: 10px;
}

/* ===== Uploader ===== */
.drop-zone {
	border: 2px dashed #94a3b8;
	border-radius: var(--radius);
	padding: 26px 16px;
	text-align: center;
	background: #f8fafc;
	margin-bottom: 16px;
}

.drop-zone .main-text {
	font-size: 18px;
	font-weight: 700;
	margin: 0 0 8px 0;
}

.browser {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: #fff;
	overflow: hidden;
}

.browser-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 12px;
	background: #f8fafc;
	border-bottom: 1px solid var(--border);
}

.breadcrumb {
	font-weight: 700;
}

.browser-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.action-btn {
	padding: 9px 12px;
	background: #e2e8f0;
	color: var(--text);
}

.action-btn.delete {
	background: #fee2e2;
	color: #991b1b;
}

.action-btn.move {
	background: #ecfccb;
	color: #3f6212;
}

.action-btn:disabled,
.upload-btn:disabled,
.clear-btn:disabled,
.dialog-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.refresh-btn {
	padding: 9px 12px;
	background: var(--brand);
	color: #fff;
}

.file-grid {
	display: flex;
	flex-direction: column;
	padding: 4px 0;
}

.file-item {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border-bottom: 1px solid var(--border);
	font-size: 12px;
	transition: background 0.1s ease;
}

.file-item:last-child {
	border-bottom: none;
}

.file-item:hover {
	background: #f1f5f9;
}

.file-item.selected {
	background: #dbeafe;
}

.file-item .file-checkbox {
	flex-shrink: 0;
	width: 13px;
	height: 13px;
	cursor: pointer;
	margin: 0;
}

.file-main {
	display: flex;
	align-items: center;
	gap: 5px;
	flex: 1;
	min-width: 0;
	cursor: pointer;
}

.file-icon {
	font-size: 14px;
	line-height: 1;
	flex-shrink: 0;
}

.file-info {
	display: flex;
	align-items: baseline;
	gap: 6px;
	min-width: 0;
	flex: 1;
}

.file-grid .file-name {
	min-width: 0;
	display: block;
	padding: 0;
	margin-bottom: 0;
	background: none;
	border: none;
	border-radius: 0;
	font-size: 12px;
	font-weight: 600;
	color: var(--text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.file-meta {
	font-size: 11px;
	color: var(--text-muted);
	white-space: nowrap;
	flex-shrink: 0;
}

.locked-folder .file-main {
	opacity: 0.85;
}

.queue-item {
	display: block;
	padding: 4px 12px;
	border-bottom: 1px solid var(--border);
	font-size: 12px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.queue-item:last-child {
	border-bottom: none;
}

.queue-file-name {
	font-weight: 600;
	color: var(--text);
}

.queue-file-path {
	color: var(--text-muted);
}

.queue-sep {
	color: var(--text-muted);
}

.queue-status {
	font-weight: 600;
}

.status-waiting  { color: var(--text-muted); }
.status-uploading { color: var(--brand); }
.status-success  { color: #16a34a; }
.status-error    { color: var(--danger); }

.move-dialog {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 20;
}

.move-dialog-content {
	width: min(640px, 92vw);
	background: #fff;
	border-radius: var(--radius);
	padding: 20px;
	box-shadow: var(--shadow);
}

.move-folder-list {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	max-height: 320px;
	overflow: auto;
	margin: 10px 0 16px 0;
}

.move-dialog-buttons {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
}

.dialog-btn.secondary {
	background: #e2e8f0;
	color: var(--text);
}

.dialog-btn.primary {
	background: var(--brand);
	color: #fff;
}

.upload-queue {
	margin-top: 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: #fff;
	overflow: hidden;
}

.queue-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 12px;
	background: #f8fafc;
	border-bottom: 1px solid var(--border);
}

.queue-actions {
	display: flex;
	gap: 8px;
}

.clear-btn {
	background: #e2e8f0;
	color: var(--text);
	padding: 9px 12px;
}

.upload-btn {
	background: var(--brand-2);
	color: #fff;
	padding: 9px 12px;
}

/* ===== Utility ===== */
.select-info {
	font-weight: 600;
	color: var(--text-muted);
}

@media (max-width: 720px) {
	.browser-header {
		flex-direction: column;
		align-items: flex-start;
	}
	.queue-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}
}
