@import "./auth-theme.css";
@import "./header.css";
/* ============================================
   StudioMgr PWA — Styles
   Builder pattern with custom theme
   ============================================ */

:root {
	--primary: #000000;
	--primary-dark: #000000;
	--primary-light: #f4f4f5;
	--secondary: #18181b;
	--secondary-dark: #09090b;
	--secondary-light: #fafafa;
	--accent: #c0c0c0;
	/* Silver */
	--accent-dark: #848482;
	/* Metallic Grey */
	--accent-light: #d1d1d1;
	--bg: #ffffff;
	--bg-secondary: #f2f2f7;
	--bg-card: #ffffff;
	--text: #000000;
	--text-secondary: #636366;
	--border: #e5e5ea;
	--radius: 12px;
	--radius-sm: 8px;
	--header-h: 56px;
	--nav-h: 64px;
	--safe-top: env(safe-area-inset-top, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);
}

html.dark {
	--bg: #000000;
	--bg-secondary: #1c1c1e;
	--bg-card: #1c1c1e;
	--text: #ffffff;
	--text-secondary: #aeaeb2;
	--border: #2c2c2e;
	--primary: #ffffff;
	--primary-dark: #e5e5ea;
	--primary-light: #1c1c1e;
	--accent: #c0c0c0;
	--accent-dark: #848482;
}

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

html {
	font-size: 16px;
	-webkit-text-size-adjust: 100%;
}

body {
	font-family:
		-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto,
		sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.5;
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}

#splash {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #000000, #18181b);
	transition: opacity 0.4s ease;
}

#splash.hidden {
	opacity: 0;
	pointer-events: none;
}

.splash-icon {
	width: 96px;
	height: 96px;
	border-radius: 28px;
	background: rgba(255, 255, 255, 0.15);
	backdrop-filter: blur(20px);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 56px;
	margin-bottom: 20px;
	animation: splashPulse 1.5s ease infinite;
}

.splash-title {
	color: white;
	font-size: 28px;
	font-weight: 800;
	margin-bottom: 6px;
}

.splash-sub {
	color: rgba(255, 255, 255, 0.65);
	font-size: 14px;
	font-weight: 500;
}

@keyframes splashPulse {
	0%,
	100% {
		transform: scale(1);
	}

	50% {
		transform: scale(1.05);
	}
}

/* Auth Screen — handled by shared auth-theme.css */
#auth-screen {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: var(--primary);
	padding: 24px;
}

#auth-screen.active {
	display: flex;
}

#main-app {
	display: none;
}

#main-app.active {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
}

.app-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	min-height: calc(var(--header-h) + var(--safe-top) + 8px);
	padding: calc(var(--safe-top) + 8px) 16px 8px;
	color: white;
}

.header-left {
	display: flex;
	align-items: center;
	gap: 12px;
}

.header-back {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: white;
	display: none;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 18px;
}

.header-back.visible {
	display: flex;
}

.header-title {
	font-size: 18px;
	font-weight: 700;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 200px;
}

.header-right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.header-btn {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 18px;
}

.header-btn:active {
	background: rgba(255, 255, 255, 0.25);
}

.content-area {
	flex: 1;
	min-height: 0;
	margin-top: 0;
	margin-bottom: calc(var(--nav-h) + max(var(--safe-bottom), 8px));
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-y: contain;
	padding-bottom: 16px;
}

.bottom-nav {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 100;
	height: calc(var(--nav-h) + max(var(--safe-bottom), 8px));
	padding-bottom: max(var(--safe-bottom), 8px);
	background: var(--bg-card);
	border-top: 1px solid var(--border);
	display: flex;
	align-items: stretch;
}

.nav-tab {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	border: none;
	background: none;
	color: var(--text-secondary);
	font-size: 10px;
	font-weight: 600;
	cursor: pointer;
	transition: color 0.2s;
}

.nav-tab i,
.nav-tab svg {
	font-size: 22px;
}

.nav-tab.active {
	color: var(--primary);
}

.nav-tab:active {
	opacity: 0.7;
}

.side-menu-overlay {
	position: fixed;
	inset: 0;
	z-index: 200;
	background: rgba(0, 0, 0, 0.4);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s;
}

.side-menu-overlay.open {
	opacity: 1;
	pointer-events: auto;
}

.side-menu {
	position: fixed;
	top: 0;
	right: -300px;
	bottom: 0;
	z-index: 201;
	width: 300px;
	background: var(--bg-card);
	box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
	transition: right 0.3s ease;
	display: flex;
	flex-direction: column;
	padding: var(--safe-top) 0 var(--safe-bottom);
}

.side-menu.open {
	right: 0;
}

.side-menu-header {
	padding: 20px;
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.side-menu-body {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
}

.card {
	background: var(--bg-card);
	border-radius: var(--radius);
	padding: 16px;
	border: 1px solid var(--border);
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 20px;
	border-radius: var(--radius-sm);
	border: none;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
	text-decoration: none;
}

.btn:active {
	transform: scale(0.97);
}

.btn-primary {
	background: var(--primary);
	color: white;
}

.btn-primary:hover {
	background: var(--primary-dark);
}

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

.btn-danger {
	background: #dc2626;
	color: white;
}

.btn-success {
	background: #15803d;
	color: white;
}

.btn-block {
	width: 100%;
}

.btn-lg {
	padding: 14px 24px;
	font-size: 16px;
}

.btn-sm {
	padding: 6px 12px;
	font-size: 12px;
}

.btn-icon {
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: 12px;
}

.form-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.form-label {
	font-size: 13px;
	font-weight: 600;
	color: var(--text-secondary);
}

.form-input,
.form-select {
	width: 100%;
	padding: 12px 16px;
	border-radius: var(--radius-sm);
	border: 1.5px solid var(--border);
	background: var(--bg-card);
	font-size: 15px;
	color: var(--text);
	transition: border-color 0.2s;
	font-family: inherit;
}

.form-input:focus,
.form-select:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-input {
	resize: vertical;
	min-height: 80px;
}

.badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 10px;
	border-radius: 100px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
}

.badge-active {
	background: #dcfce7;
	color: #15803d;
}

.badge-approved {
	background: #dbeafe;
	color: #1e40af;
}

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

.badge-warning {
	background: #fef3c7;
	color: #92400e;
}

.badge-danger {
	background: #fee2e2;
	color: #b91c1c;
}

.avatar {
	width: 40px;
	height: 40px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	font-weight: 700;
	flex-shrink: 0;
}

.hero-card {
	background: linear-gradient(135deg, var(--primary), var(--secondary));
	border-radius: var(--radius);
	padding: 24px;
	color: white;
}

.grid-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}

.grid-stat {
	padding: 12px;
	text-align: center;
}

.grid-stat-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	margin-bottom: 4px;
	color: var(--text-secondary);
}

.grid-stat-value {
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--text);
}

.empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 48px 24px;
	text-align: center;
	color: var(--text-secondary);
}

.empty-state i {
	font-size: 48px;
	margin-bottom: 12px;
	opacity: 0.3;
}

.menu-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	cursor: pointer;
	width: 100%;
	transition: background 0.2s;
	text-decoration: none;
	color: var(--text);
	background: none;
}

.menu-item:active {
	background: var(--bg-secondary);
}

.page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 4px;
}

.page-title {
	font-size: 1.5rem;
	font-weight: 800;
}

.modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 300;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(4px);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s;
}

.modal-overlay.active {
	opacity: 1;
	pointer-events: auto;
}

.modal-content {
	background: var(--bg-card);
	border-radius: 20px 20px 0 0;
	width: 100%;
	max-width: 500px;
	max-height: 85vh;
	overflow-y: auto;
	padding: 24px;
	transform: translateY(100%);
	transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
	transform: translateY(0);
}

.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
}

.modal-title {
	font-size: 18px;
	font-weight: 800;
}

.modal-close {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--bg-secondary);
	border: none;
	color: var(--text);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 16px;
}

.toast-container {
	position: fixed;
	top: calc(var(--header-h) + 8px);
	left: 50%;
	transform: translateX(-50%);
	z-index: 9998;
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 90%;
	max-width: 400px;
}

.toast {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-radius: var(--radius-sm);
	font-size: 14px;
	font-weight: 500;
	animation: toastIn 0.3s ease;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.toast-success {
	background: #15803d;
	color: white;
}

.toast-error {
	background: #dc2626;
	color: white;
}

.toast-info {
	background: #2563eb;
	color: white;
}

@keyframes toastIn {
	from {
		opacity: 0;
		transform: translateY(-12px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

#install-prompt {
	position: fixed;
	bottom: calc(var(--nav-h) + 16px);
	left: 16px;
	right: 16px;
	z-index: 150;
	background: var(--bg-card);
	border-radius: var(--radius);
	padding: 16px;
	display: none;
	align-items: center;
	gap: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
	border: 1px solid var(--border);
}

#install-prompt.visible {
	display: flex;
}

.install-icon {
	width: 48px;
	height: 48px;
	border-radius: 14px;
	background: linear-gradient(135deg, #6366f1, #312e81);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	color: white;
	flex-shrink: 0;
}

.install-info {
	flex: 1;
}

.install-title {
	font-size: 14px;
	font-weight: 700;
}

.install-desc {
	font-size: 12px;
	color: var(--text-secondary);
}

#install-close {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--bg-secondary);
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	color: var(--text-secondary);
	cursor: pointer;
}

.p-4 {
	padding: 16px;
}

.space-y-2 > * + * {
	margin-top: 8px;
}

.space-y-3 > * + * {
	margin-top: 12px;
}

.space-y-4 > * + * {
	margin-top: 16px;
}

.space-y-5 > * + * {
	margin-top: 20px;
}

.text-xs {
	font-size: 12px;
}

.text-sm {
	font-size: 14px;
}

.text-xl {
	font-size: 1.25rem;
}

.font-bold {
	font-weight: 700;
}

.font-extrabold {
	font-weight: 800;
}

.anim-fade {
	animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
	from {
		opacity: 0;
		transform: translateY(8px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

#sync-status {
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 100px;
	font-weight: 600;
	display: none;
}

#sync-status.syncing {
	display: inline-block;
	background: rgba(255, 255, 255, 0.2);
	color: white;
}

#sync-status.synced {
	display: inline-block;
	background: rgba(0, 0, 0, 0.4);
	color: #86efac;
}

#sync-status.error {
	display: inline-block;
	background: rgba(0, 0, 0, 0.4);
	color: #fca5a5;
}

::-webkit-scrollbar {
	width: 4px;
}

::-webkit-scrollbar-track {
	background: transparent;
}

::-webkit-scrollbar-thumb {
	background: var(--border);
	border-radius: 4px;
}

@supports (padding: env(safe-area-inset-top)) {
	.app-header {
		min-height: calc(var(--header-h) + env(safe-area-inset-top) + 8px);
		padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
	}

	.content-area {
		margin-top: 0;
		margin-bottom: calc(var(--nav-h) + max(env(safe-area-inset-bottom), 8px));
	}
}
