@import "./auth-theme.css";
@import "./header.css";
/* ============================================
   BUILDER PWA — Styles
   Mobile-first, modern CSS with variables
   ============================================ */

/* CSS Variables */
:root {
	/* Brand Colors - Deep Royal Rose */
	--primary: #be123c;
	--primary-dark: #9f1239;
	--primary-light: #fff1f2;
	--secondary: #1e293b;
	--secondary-dark: #0f172a;
	--secondary-light: #f1f5f9;
	--accent: #0ea5e9;
	--accent-dark: #0284c7;
	--accent-light: #e0f2fe;

	--success: #10b981;
	--warning: #fbbf24;
	--danger: #ef4444;
	--info: #3b82f6;

	/* Apple Grey Tones */
	--slate-50: #f5f5f7;
	--slate-100: #e8e8ed;
	--slate-200: #d2d2d7;
	--slate-300: #aeaeb2;
	--slate-400: #8e8e93;
	--slate-500: #636366;
	--slate-600: #48484a;
	--slate-700: #3a3a3c;
	--slate-800: #2c2c2e;
	--slate-900: #1d1d1f;

	--bg: #ffffff;
	--bg-secondary: var(--slate-50);
	--text: var(--slate-800);
	--text-secondary: var(--slate-500);
	--border: var(--slate-200);

	--radius: 16px;
	--radius-sm: 8px;
	--radius-lg: 24px;

	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
	--shadow:
		0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	--shadow-lg:
		0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

	--header-height: 56px;
	--nav-height: 64px;
	--safe-top: env(safe-area-inset-top, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark Mode */
.dark {
	--bg: var(--slate-900);
	--bg-secondary: var(--slate-800);
	--text: var(--slate-100);
	--text-secondary: var(--slate-400);
	--border: var(--slate-700);
	--primary-light: color-mix(in srgb, var(--primary) 20%, transparent);
	--secondary-light: color-mix(in srgb, var(--secondary) 20%, transparent);
	--accent-light: color-mix(in srgb, var(--accent) 20%, transparent);
}

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

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

body {
	font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.5;
	overflow-x: hidden;
	min-height: 100vh;
	min-height: 100dvh;
}

/* Splash Screen */
.splash-screen {
	position: fixed;
	inset: 0;
	background: linear-gradient(
		135deg,
		var(--primary) 0%,
		var(--primary-dark) 100%
	);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	transition: opacity 0.5s ease;
}

.splash-screen.fade-out {
	opacity: 0;
	pointer-events: none;
}

.splash-content {
	text-align: center;
	color: white;
}

.splash-icon {
	font-size: 4rem;
	margin-bottom: 1rem;
	animation: bounce 1s infinite;
}

.splash-title {
	font-size: 2rem;
	font-weight: 900;
	margin-bottom: 0.25rem;
}

.splash-subtitle {
	opacity: 0.8;
	font-size: 0.875rem;
}

.splash-loader {
	width: 40px;
	height: 4px;
	background: rgba(255, 255, 255, 0.3);
	border-radius: 2px;
	margin: 1.5rem auto 0;
	overflow: hidden;
}

.splash-loader::after {
	content: "";
	display: block;
	width: 50%;
	height: 100%;
	background: white;
	border-radius: 2px;
	animation: loading 1s ease-in-out infinite;
}

@keyframes bounce {
	0%,
	100% {
		transform: translateY(0);
	}

	50% {
		transform: translateY(-10px);
	}
}

@keyframes loading {
	0% {
		transform: translateX(-100%);
	}

	100% {
		transform: translateX(200%);
	}
}

/* Hidden */
.hidden {
	display: none !important;
}

/* Auth Screen — handled by shared auth-theme.css */

/* Main App */
.main-app {
	height: 100vh;
	height: 100dvh;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* Header */
.header {
	position: sticky;
	top: 0;
	min-height: calc(var(--header-height) + var(--safe-top) + 8px);
	background: var(--bg);
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: flex-end;
	padding: calc(var(--safe-top) + 8px) 1rem 8px;
	gap: 0.5rem;
	z-index: 100;
}

.header-title {
	flex: 1;
	font-size: 1.125rem;
	font-weight: 800;
	color: var(--text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.header-btn {
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	color: var(--text);
	border-radius: var(--radius-sm);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.25rem;
	cursor: pointer;
	transition: background 0.2s;
}

.header-btn:hover {
	background: var(--bg-secondary);
}

.header-actions {
	display: flex;
	gap: 0.25rem;
}

/* Content */
.content {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding-bottom: calc(var(--nav-height) + max(var(--safe-bottom), 8px) + 16px);
}

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

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

.nav-item i {
	font-size: 1.25rem;
}

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

/* Side Menu */
.side-menu {
	position: fixed;
	inset: 0;
	z-index: 200;
	background: rgba(0, 0, 0, 0.5);
}

.side-menu-content {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 280px;
	max-width: 80vw;
	background: var(--bg);
	animation: slideIn 0.2s ease;
}

@keyframes slideIn {
	from {
		transform: translateX(100%);
	}

	to {
		transform: translateX(0);
	}
}

.side-menu-header {
	padding: 2rem 1.5rem;
	background: linear-gradient(
		135deg,
		var(--primary) 0%,
		var(--primary-dark) 100%
	);
}

.menu-user {
	display: flex;
	align-items: center;
	gap: 1rem;
	color: white;
}

.menu-avatar {
	width: 48px;
	height: 48px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.25rem;
	font-weight: 700;
}

.menu-user-details h3 {
	font-weight: 700;
	font-size: 1rem;
}

.menu-user-details p {
	opacity: 0.7;
	font-size: 0.75rem;
}

.side-menu-nav {
	padding: 1rem 0;
}

.side-menu-nav button {
	display: flex;
	align-items: center;
	gap: 1rem;
	width: 100%;
	padding: 0.875rem 1.5rem;
	border: none;
	background: transparent;
	color: var(--text);
	font-size: 0.875rem;
	font-weight: 500;
	text-align: left;
	cursor: pointer;
}

.side-menu-nav button:hover {
	background: var(--bg-secondary);
}

.side-menu-nav button i {
	font-size: 1.25rem;
	color: var(--text-secondary);
}

/* Cards */
.card {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1rem;
	cursor: default;
}

.card[onclick] {
	cursor: pointer;
	transition:
		transform 0.1s,
		box-shadow 0.2s;
}

.card[onclick]:active {
	transform: scale(0.98);
}

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.75rem 1.25rem;
	border: none;
	border-radius: var(--radius-sm);
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
}

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

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

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

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

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

.btn-block {
	width: 100%;
}

.btn-lg {
	padding: 1rem 1.5rem;
	font-size: 1rem;
}

.btn-sm {
	padding: 0.5rem 0.75rem;
	font-size: 0.75rem;
}

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

/* Forms */
.form-group {
	margin-bottom: 0;
}

.form-label {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--text-secondary);
	margin-bottom: 0.5rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

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

.form-input:focus,
.form-select:focus {
	outline: none;
	border-color: var(--primary);
}

.form-error {
	color: var(--danger);
	font-size: 0.875rem;
	margin-top: 0.5rem;
}

.input-icon-wrapper {
	position: relative;
}

.input-icon {
	position: absolute;
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-secondary);
}

.input-icon-wrapper .form-input {
	padding-left: 2.75rem;
}

/* Badges */
.badge {
	display: inline-block;
	padding: 0.25rem 0.625rem;
	border-radius: 100px;
	font-size: 0.625rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.badge-draft {
	background: var(--slate-200);
	color: var(--slate-600);
}

.badge-approved {
	background: #d1fae5;
	color: #065f46;
}

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

/* Avatar */
.avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--primary-light);
	color: var(--primary);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 1rem;
}

/* Progress Bar */
.progress-bar {
	height: 6px;
	background: var(--slate-200);
	border-radius: 3px;
	overflow: hidden;
}

.progress-bar-fill {
	height: 100%;
	background: var(--primary);
	border-radius: 3px;
	transition: width 0.3s ease;
}

/* Grid Stats */
.grid-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.5rem;
}

.grid-stat {
	text-align: center;
	padding: 0.75rem 0.5rem;
	background: var(--bg-secondary);
	border-radius: var(--radius-sm);
}

.grid-stat-label {
	font-size: 0.625rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--text-secondary);
	margin-bottom: 0.25rem;
}

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

/* Empty State */
.empty-state {
	text-align: center;
	padding: 3rem 1rem;
	color: var(--text-secondary);
}

.empty-state i {
	font-size: 3rem;
	opacity: 0.5;
	margin-bottom: 1rem;
}

.empty-state p {
	margin-bottom: 1rem;
}

/* Menu Item */
.menu-item {
	display: flex;
	align-items: center;
	gap: 1rem;
	width: 100%;
	padding: 1rem;
	border: none;
	background: var(--bg);
	border-radius: var(--radius-sm);
	color: var(--text);
	font-size: 0.875rem;
	font-weight: 500;
	text-align: left;
	cursor: pointer;
	transition: background 0.2s;
}

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

.menu-item i {
	font-size: 1.25rem;
	color: var(--text-secondary);
}

/* Page Header */
.page-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.page-title {
	font-size: 1.25rem;
	font-weight: 800;
	color: var(--text);
}

/* Divider */
.divider {
	height: 1px;
	background: var(--border);
	margin: 1rem 0;
}

/* Modal */
.modal-container {
	position: fixed;
	inset: 0;
	z-index: 300;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.modal-content {
	position: relative;
	background: var(--bg);
	border-radius: var(--radius-lg) var(--radius-lg) 0 0;
	width: 100%;
	max-width: 500px;
	max-height: 90vh;
	overflow-y: auto;
	animation: slideUp 0.3s ease;
}

@keyframes slideUp {
	from {
		transform: translateY(100%);
	}

	to {
		transform: translateY(0);
	}
}

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

.modal-title {
	font-size: 1.125rem;
	font-weight: 700;
}

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

/* Toast */
.toast-container {
	position: fixed;
	top: calc(var(--header-height) + 1rem);
	left: 1rem;
	right: 1rem;
	z-index: 400;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.toast {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1rem;
	background: var(--slate-800);
	color: white;
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-lg);
	animation: fadeIn 0.3s ease;
	transition:
		opacity 0.3s,
		transform 0.3s;
}

.toast.success {
	background: var(--success);
}

.toast.warning {
	background: var(--warning);
}

.toast.error {
	background: var(--danger);
}

.toast.info {
	background: var(--info);
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}

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

/* Install Prompt */
.install-prompt {
	position: fixed;
	bottom: calc(var(--nav-height) + var(--safe-bottom) + 1rem);
	left: 1rem;
	right: 1rem;
	z-index: 150;
}

.install-prompt-content {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-lg);
}

.install-icon {
	width: 48px;
	height: 48px;
	background: var(--primary-light);
	color: var(--primary);
	border-radius: var(--radius-sm);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
}

.install-text {
	flex: 1;
}

.install-text h3 {
	font-size: 0.875rem;
	font-weight: 700;
}

.install-text p {
	font-size: 0.75rem;
	color: var(--text-secondary);
}

.install-actions {
	display: flex;
	gap: 0.5rem;
}

/* Animation */
.anim-fade {
	animation: fadeIn 0.3s ease;
}

/* Utilities */
.p-4 {
	padding: 1rem;
}

.space-y-2 > * + * {
	margin-top: 0.5rem;
}

.space-y-3 > * + * {
	margin-top: 0.75rem;
}

.space-y-4 > * + * {
	margin-top: 1rem;
}

.space-y-5 > * + * {
	margin-top: 1.25rem;
}

.flex {
	display: flex;
}

.flex-1 {
	flex: 1;
}

.items-center {
	align-items: center;
}

.items-start {
	align-items: flex-start;
}

.justify-between {
	justify-content: space-between;
}

.gap-2 {
	gap: 0.5rem;
}

.gap-3 {
	gap: 0.75rem;
}

.gap-4 {
	gap: 1rem;
}

.grid {
	display: grid;
}

.grid-cols-2 {
	grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
	grid-template-columns: repeat(3, 1fr);
}

.min-w-0 {
	min-width: 0;
}

.truncate {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.text-center {
	text-align: center;
}

.text-right {
	text-align: right;
}

.text-xs {
	font-size: 0.75rem;
}

.text-sm {
	font-size: 0.875rem;
}

.text-lg {
	font-size: 1.125rem;
}

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

.text-2xl {
	font-size: 1.5rem;
}

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

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

.uppercase {
	text-transform: uppercase;
}

.mb-1 {
	margin-bottom: 0.25rem;
}

.mb-2 {
	margin-bottom: 0.5rem;
}

.mb-3 {
	margin-bottom: 0.75rem;
}

.mb-4 {
	margin-bottom: 1rem;
}

.mt-1 {
	margin-top: 0.25rem;
}

.mt-2 {
	margin-top: 0.5rem;
}

.mt-3 {
	margin-top: 0.75rem;
}

.ml-2 {
	margin-left: 0.5rem;
}

.ml-auto {
	margin-left: auto;
}

.mr-1 {
	margin-right: 0.25rem;
}

.mr-2 {
	margin-right: 0.5rem;
}

.w-full {
	width: 100%;
}

.w-12 {
	width: 3rem;
}

.h-12 {
	height: 3rem;
}

.min-h-\[80px\] {
	min-height: 80px;
}

.rounded-xl {
	border-radius: 0.75rem;
}

.rounded-2xl {
	border-radius: 1rem;
}

.rounded-lg {
	border-radius: 0.5rem;
}

.border-2 {
	border-width: 2px;
}

.border-dashed {
	border-style: dashed;
}

.overflow-hidden {
	overflow: hidden;
}

.overflow-x-auto {
	overflow-x: auto;
}

.object-cover {
	object-fit: cover;
}

.py-2 {
	padding-top: 0.5rem;
	padding-bottom: 0.5rem;
}

.py-4 {
	padding-top: 1rem;
	padding-bottom: 1rem;
}

.text-slate-300 {
	color: var(--slate-300);
}

.text-slate-400 {
	color: var(--slate-400);
}

.text-slate-500 {
	color: var(--slate-500);
}

.text-slate-600 {
	color: var(--slate-600);
}

.text-slate-700 {
	color: var(--slate-700);
}

.text-slate-800 {
	color: var(--slate-800);
}

.text-green-500 {
	color: #10b981;
}

.text-green-600 {
	color: #059669;
}

.text-green-700 {
	color: #047857;
}

.text-red-400 {
	color: #f87171;
}

.text-red-500 {
	color: #ef4444;
}

.text-red-600 {
	color: #dc2626;
}

.text-red-700 {
	color: #b91c1c;
}

.text-emerald-400 {
	color: #34d399;
}

.text-emerald-500 {
	color: #10b981;
}

.text-emerald-600 {
	color: #059669;
}

.text-emerald-700 {
	color: #047857;
}

.text-amber-500 {
	color: #f59e0b;
}

.text-amber-600 {
	color: #d97706;
}

.text-blue-500 {
	color: #3b82f6;
}

.text-blue-600 {
	color: #2563eb;
}

.text-blue-700 {
	color: #1d4ed8;
}

.bg-slate-50 {
	background: var(--slate-50);
}

.bg-slate-100 {
	background: var(--slate-100);
}

.bg-green-50 {
	background: #ecfdf5;
}

.bg-red-50 {
	background: #fef2f2;
}

.bg-emerald-50 {
	background: #ecfdf5;
}

.bg-emerald-100 {
	background: #d1fae5;
}

.bg-amber-50 {
	background: #fffbeb;
}

.bg-blue-50 {
	background: #eff6ff;
}

.border-slate-100 {
	border-color: var(--slate-100);
}

.border-slate-200 {
	border-color: var(--slate-200);
}

.border-slate-300 {
	border-color: var(--slate-300);
}

.border-emerald-200 {
	border-color: #a7f3d0;
}

.border-red-200 {
	border-color: #fecaca;
}

.border-blue-200 {
	border-color: #bfdbfe;
}

.border-t {
	border-top: 1px solid var(--border);
}

.border-b {
	border-bottom: 1px solid var(--border);
}

.border-t-2 {
	border-top: 2px solid var(--border);
}

.last\:border-0:last-child {
	border: 0;
}

.italic {
	font-style: italic;
}

.break-all {
	word-break: break-all;
}

.font-mono {
	font-family: ui-monospace, monospace;
}

/* Filter buttons */
.filter-btn {
	white-space: nowrap;
	background: var(--bg-secondary);
	color: var(--text-secondary);
}

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

/* Loading spinner */
.loading-spinner {
	width: 24px;
	height: 24px;
	border: 2px solid var(--border);
	border-top-color: var(--primary);
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
	margin: 2rem auto;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* Syncing animation */
.syncing {
	animation: pulse 1s infinite;
}

@keyframes pulse {
	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0.5;
	}
}

/* ============================================
   OFFLINE STATUS BADGE
   ============================================ */
.offline-badge {
	position: fixed;
	top: 60px;
	right: 12px;
	padding: 8px 14px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 6px;
	z-index: 10000;
	transition: all 0.3s ease;
	box-shadow: var(--shadow-lg);
}

.badge--caching {
	background: #3b82f6;
	color: white;
	animation: badge-pulse 1.5s ease-in-out infinite;
}

.badge--ready {
	background: #10b981;
	color: white;
}

.badge--offline {
	background: #f97316;
	color: white;
}

.badge--error {
	background: #ef4444;
	color: white;
}

.badge--hidden {
	opacity: 0;
	pointer-events: none;
	transform: translateY(-10px);
}

@keyframes badge-pulse {
	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0.7;
	}
}

/* ============================================
   INLINE ICON SYSTEM
   ============================================ */
.icon,
[data-icon],
i[class*="ph-"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.25em;
	height: 1.25em;
	vertical-align: middle;
}

.icon svg,
[data-icon] svg,
i[class*="ph-"] svg {
	width: 100%;
	height: 100%;
	fill: currentColor;
}

.icon-sm {
	width: 1em;
	height: 1em;
}

.icon-lg {
	width: 1.5em;
	height: 1.5em;
}

.icon-xl {
	width: 2em;
	height: 2em;
}
