/*
 * Ember theme for the USER portal (chosen 2026-10-07, reference: /design-preview/ember/portal).
 *
 * Loaded AFTER /css/portal.css on user portal pages only. Admin pages don't load it, so they
 * keep their current look (owner's decision for this rollout). Checklist of every place the
 * theme has to reach: /design-preview/places-to-apply (src/pages/theme-places.ts).
 */

:root {
	/* Legacy portal tokens, remapped to Ember (inline page styles use these) */
	--primary: #f58220;
	--primary-dark: #e8720f;
	--primary-light: #ffa45c;
	--bg-body: #faf8f5;
	--bg-card: #ffffff;
	--bg-sidebar: #ffffff;
	--border: #ebe6e0;
	--border-light: #f5f2ee;
	--text-primary: #1c1917;
	--text-secondary: #57534e;
	--text-muted: #a8a29e;
	--success: #15803d;
	--success-bg: #e9f8ee;
	--warning: #b45309;
	--warning-bg: #fff4e0;
	--error: #dc2626;
	--error-bg: #fef1f1;
	--info: #2563eb;
	--info-bg: #eef4ff;
	--bg-elevated: #faf8f5;
	--bg-secondary: #faf8f5;

	/* Ember tokens */
	--font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--ink: #1c1917;
	--ink-2: #44403c;
	--muted: #78716c;
	--line: #ebe6e0;
	--line-soft: #f3efea;
	--line-strong: #d6cfc7;
	--surface: #ffffff;
	--surface-2: #f5f2ee;
	--accent: #f58220;
	--accent-hover: #e8720f;
	--accent-soft: #fff1e4;
	--accent-ink: #c2560a;
	--kicker: #e06a0b;
	--radius: 10px;
	--radius-lg: 16px;
	--btn-radius: 11px;
	--card-shadow: 0 1px 2px rgba(28, 25, 23, .04), 0 4px 16px rgba(28, 25, 23, .03);
	--focus-ring: 0 0 0 4px rgba(245, 130, 32, .16);
}

body {
	font-family: var(--font);
	background-color: var(--bg-body);
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	letter-spacing: -.005em;
}

h1, h2, h3, h4 { letter-spacing: -.02em; }

button, input, select, textarea { font-family: inherit; }

/* The hidden attribute always wins over a component's own display (e.g. display:flex panels). */
[hidden] { display: none !important; }

::selection { background: #ffe1c6; color: #1c1917; }

/* ---------------------------------------------------------------- Sidebar */
.sidebar {
	background: #fff;
	border-right: 1px solid #efe9e2;
	box-shadow: none;
}
.sidebar-logo {
	padding: 1.125rem 1.25rem 1rem;
	border-bottom: 0;
}
.sidebar-logo svg { width: 34px; height: 28px; }
.sidebar-logo h1 { font-size: 1.3rem; font-weight: 800; letter-spacing: -.025em; }
.sidebar-toggle { width: 32px; height: 32px; border-radius: 8px; color: #a8a29e; }
.sidebar-toggle:hover { background: #f8f5f1; color: #1c1917; }
.sidebar-nav { padding: .25rem 0 1rem; }
.nav-section { padding: .25rem .875rem; margin-top: .25rem; }
.nav-section-title {
	font-size: .7rem;
	font-weight: 700;
	letter-spacing: .1em;
	color: #a8a29e;
	padding: 1rem .75rem .5rem;
}
.nav-item {
	position: relative;
	height: 42px;
	padding: 0 .75rem;
	margin: 1px 0;
	border-left: 0;
	border-radius: 10px;
	color: #57534e;
	font-size: .9rem;
	font-weight: 500;
	transition: background .15s, color .15s;
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { background: #f8f5f1; color: #1c1917; }
.nav-item.active {
	background: #fff1e4;
	color: #c2560a;
	font-weight: 600;
}
.nav-item.active::before {
	content: "";
	position: absolute;
	left: -14px;
	top: 9px;
	bottom: 9px;
	width: 3px;
	border-radius: 0 3px 3px 0;
	background: #f58220;
}
.sidebar-footer { padding: .875rem 1.125rem 1rem; border-top: 1px solid #efe9e2; }
.user-avatar {
	width: 36px;
	height: 36px;
	background: linear-gradient(135deg, #f9a24b, #ea580c);
	font-weight: 700;
	font-size: .8rem;
}
.user-name { font-weight: 600; }
.user-email { color: #a8a29e; }
.logout-btn {
	height: 36px;
	border-color: #ebe6e0;
	border-radius: 10px;
	color: #57534e;
	font-weight: 500;
}
.logout-btn:hover { background: #f8f5f1; color: #1c1917; }

.sb-collapsed .sidebar .nav-item { justify-content: center; padding: 0; }
.sb-collapsed .sidebar .nav-item.active::before { display: none; }

/* Mobile header */
.mobile-header {
	background: rgba(250, 248, 245, .88);
	-webkit-backdrop-filter: saturate(180%) blur(14px);
	backdrop-filter: saturate(180%) blur(14px);
	border-bottom: 1px solid #ebe6e0;
	box-shadow: none;
}
.mobile-menu-btn { border-radius: 10px; }
.mobile-logo span { font-weight: 800; letter-spacing: -.025em; }
.sidebar-overlay { background: rgba(28, 25, 23, .4); }
.sidebar.open { box-shadow: 0 0 40px rgba(0, 0, 0, .18); }

/* ---------------------------------------------------------------- Page */
.main-inner { padding: 2.25rem 2.5rem 4rem; max-width: 1600px; margin-left: auto; margin-right: auto; } /* centred on wide screens */
.page-header { margin-bottom: 1.75rem; gap: 1rem; }
.page-header h1 { font-size: 1.95rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.page-header p { color: var(--muted); }

/* ---------------------------------------------------------------- Buttons */
.btn {
	justify-content: center;
	min-height: 40px;
	padding: .55rem 1.05rem;
	border-radius: var(--btn-radius);
	font-size: .875rem;
	font-weight: 600;
	line-height: 1.2;
	transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary {
	background: #f58220;
	color: #fff;
	box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 16px -6px rgba(234, 88, 12, .55);
}
.btn-primary:hover { background: #e8720f; }
.btn-primary:disabled { opacity: .55; box-shadow: none; }
.btn-secondary {
	background: #fff;
	border: 1px solid #e3dcd4;
	color: #1c1917;
}
.btn-secondary:hover { background: #f8f5f1; border-color: #d6cfc7; }
.btn-outline { background: #fff; border: 1px solid #e3dcd4; color: #1c1917; }
.btn-outline:hover { background: #f8f5f1; border-color: #d6cfc7; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }

/* ---------------------------------------------------------------- Cards and stats */
.card {
	border: 1px solid #ece6df;
	border-radius: var(--radius-lg);
	padding: 1.5rem;
	box-shadow: var(--card-shadow);
}
.card-header { border-bottom-color: #f3efea; }
.card-header h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.015em; }
.stat-card {
	position: relative;
	overflow: hidden;
	border: 1px solid #ece6df;
	border-radius: var(--radius-lg);
	box-shadow: var(--card-shadow);
}
.stats-grid .stat-card:first-child { background: linear-gradient(150deg, #fff7ef, #fff 60%); }
.stat-card h3 { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.stat-card .value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.035em; }
.stat-card .value.primary { color: #e06a0b; }

/* Video cards */
.video-card { border-color: #ece6df; border-radius: 14px; box-shadow: var(--card-shadow); }
.video-card:hover { border-color: #f4d3b6; box-shadow: 0 10px 30px -12px rgba(28, 25, 23, .14); }
.video-duration { border-radius: 5px; font-weight: 700; }
.play-overlay { background: rgba(28, 25, 23, .35); }

/* Video tags (UI.videoTags in portal.js) */
.vt-tag { display: inline-flex; align-items: center; font-size: .68rem; font-weight: 700; line-height: 1.5; padding: 1px 7px; border-radius: 6px; background: #fff1e4; color: #c2560a; letter-spacing: .02em; white-space: nowrap; }
.vt-tag.t-dark { background: #1c1917; color: #fff; }
.vt-tag.t-patreon { background: #ffe9ea; color: #d6252f; }
.vt-tag.t-plain { background: #f5f2ee; color: #57534e; }

/* Status badges */
.status-badge { border-radius: 999px; font-weight: 600; }
.status-ready { background: #e9f8ee; color: #15803d; }
.status-processing, .status-pending { background: #fff4e0; color: #b45309; }
.status-error { background: #fef1f1; color: #dc2626; }

/* ---------------------------------------------------------------- Forms */
.form-group label { font-weight: 600; font-size: .85rem; color: var(--ink); }
.form-group input,
.form-group textarea,
.form-group select,
.search-box input,
.filter-select,
.copy-field input {
	border: 1px solid #e3dcd4;
	border-radius: var(--radius);
	background-color: #fff;
	color: var(--ink);
	font-size: .9375rem;
	transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.search-box input:focus,
.filter-select:focus,
.copy-field input:focus {
	outline: none;
	border-color: #f58220;
	box-shadow: var(--focus-ring);
}
.form-help { color: var(--muted); }
.copy-btn { border-radius: var(--radius); }

.toggle-slider { background-color: #e3dcd4; }
.toggle-switch input:checked + .toggle-slider { background-color: #f58220; }
.toggle-switch input:focus-visible + .toggle-slider { box-shadow: var(--focus-ring); }

input[type="checkbox"], input[type="radio"], input[type="range"], progress { accent-color: #f58220; }

/* Alerts */
.alert { border-radius: var(--radius); }
.alert-error { background: #fef1f1; border-color: #fbcaca; }
.alert-success { background: #e9f8ee; border-color: #bfe6cc; }
.alert-warning { background: #fff4e0; border-color: #f6d9a7; }

/* ---------------------------------------------------------------- Tables */
table th {
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .05em;
	color: var(--muted);
	border-bottom-color: #ebe6e0;
}
table td { border-bottom-color: #f3efea; }
table tr:hover td { background-color: #fcfaf7; }

/* Pagination / filters */
.pagination-btn { border-color: #e3dcd4; border-radius: 9px; }
.pagination-btn:hover:not(:disabled) { background: #f8f5f1; }
.pagination-btn.active { background: #f58220; border-color: #f58220; color: #fff; }

/* ---------------------------------------------------------------- Modals and dialogs */
.modal-overlay, .dialog-overlay { background-color: rgba(28, 25, 23, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-content, .dialog-box {
	border: 1px solid #ece6df;
	border-radius: 20px;
	box-shadow: 0 30px 80px -20px rgba(28, 25, 23, .35);
}
.modal-header { border-bottom-color: #f3efea; padding: 1.25rem 1.5rem; }
.modal-header h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; }
.modal-close { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); }
.modal-close:hover { background: #f5f2ee; color: var(--ink); }
.modal-footer { border-top-color: #f3efea; }
.dialog-title { font-weight: 700; letter-spacing: -.02em; }
.dialog-icon.info { background: #fff1e4; color: #e06a0b; }
.dialog-icon.warning { background: #fff4e0; color: #b45309; }
.dialog-icon.danger { background: #fef1f1; color: #dc2626; }
.dialog-icon.success { background: #e9f8ee; color: #15803d; }
.dialog-actions { border-top-color: #f3efea; }

/* Empty / loading */
.empty-state h3 { color: var(--ink); font-weight: 700; }
.spinner { border-color: #f3efea; border-top-color: #f58220; }

/* Toasts */
.toast { border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(28, 25, 23, .3); font-weight: 500; background: #fff; border: 1px solid #ece6df; color: #1c1917; padding: .85rem 1rem; gap: .65rem; font-size: .875rem; }
.toast svg { flex: none; }
.toast-success { border-color: #bfe6cc; background: #f3fbf5; color: #14532d; }
.toast-success svg { color: #15803d; }
.toast-error { border-color: #fbcaca; background: #fff6f6; color: #7f1d1d; }
.toast-error svg { color: #dc2626; }
.toast-info { border-color: #f4d9c1; background: #fff8f1; color: #1c1917; }
.toast-info svg { color: #e06a0b; }

/* Plan-change cost preview (dialog) */
.pc-card { border-color: #ece6df; border-radius: 14px; }
.pc-badge { background: #fff1e4; color: #c2560a; }
.pc-head { background: linear-gradient(135deg, #fff7ef, #fff1e4); }
.pc-total { background: #faf8f5; }
.pc-total .pc-amt { color: #e06a0b; }
.pc-meta-item svg { color: #f58220; }

/* Portal notification bars (drawn by portal.js) */
.notification-bar-portal { background: linear-gradient(100deg, #fff4e8, #fff 70%); border: 1px solid #f4d9c1; border-left: 1px solid #f4d9c1; border-radius: 14px; padding: .7rem .85rem .7rem .75rem; box-shadow: var(--card-shadow); }
.notification-bar-portal .notification-icon { width: 32px; height: 32px; border-radius: 9px; background: #fff1e4; color: #e06a0b; display: grid; place-items: center; }
.notification-bar-portal .notification-icon svg { width: 17px; height: 17px; }
.notification-text { font-weight: 500; }
.notification-link { color: #c2560a; font-weight: 600; }
.notification-dismiss { border-radius: 8px; width: 30px; height: 30px; }
.notification-dismiss:hover { background: #f5f2ee; }
.notification-bar-portal.notification-bar-custom { border-color: transparent; }
.notification-bar-custom .notification-icon { background: rgba(255, 255, 255, .18); }

/* ---------------------------------------------------------------- Notifications bell (public/js/inbox.js) */
.portal-topbar {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	max-width: 1600px;
	margin: 0 auto;
	padding: 1rem 2.5rem 0;
}
.has-topbar .main-inner { padding-top: .5rem; }
.inbox-btn {
	position: relative;
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	border: 1px solid #ebe6e0;
	border-radius: 11px;
	background: #fff;
	color: #44403c;
	cursor: pointer;
	transition: background .15s, color .15s, border-color .15s;
}
.inbox-btn:hover, .inbox-btn[aria-expanded="true"] { background: #f8f5f1; color: #1c1917; border-color: #e3dcd4; }
.inbox-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.inbox-btn svg { width: 19px; height: 19px; }
.inbox-count {
	position: absolute;
	top: -6px;
	right: -6px;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border-radius: 999px;
	background: #f58220;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 19px;
	text-align: center;
	box-shadow: 0 0 0 2px #faf8f5;
}
.inbox-mobile-slot { display: flex; align-items: center; justify-content: flex-end; width: 40px; }
.inbox-mobile-slot .inbox-btn { width: 38px; height: 38px; border: 0; background: transparent; }
.inbox-mobile-slot .inbox-count { top: -2px; right: -2px; box-shadow: 0 0 0 2px #fff; }

.inbox-panel {
	position: fixed;
	z-index: 300;
	max-height: min(560px, calc(100vh - 90px));
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #ece6df;
	border-radius: 16px;
	box-shadow: 0 30px 80px -20px rgba(28, 25, 23, .35), 0 2px 6px rgba(28, 25, 23, .05);
	overflow: hidden;
	animation: inboxIn .14s ease-out;
}
@keyframes inboxIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.inbox-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px; border-bottom: 1px solid #f3efea; }
.inbox-head h2 { font-size: 1rem; font-weight: 800; letter-spacing: -.02em; }
.inbox-markall { border: 0; background: none; color: #c2560a; font-size: .8125rem; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.inbox-markall:hover { background: #fff1e4; }
.inbox-list { overflow-y: auto; padding: 6px; }
.inbox-item {
	position: relative;
	width: 100%;
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 11px 30px 11px 10px;
	border: 0;
	border-radius: 12px;
	background: none;
	text-align: left;
	color: inherit;
	cursor: pointer;
}
.inbox-item:hover { background: #faf8f5; }
.inbox-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.inbox-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #f5f2ee; color: #57534e; }
.inbox-ic svg { width: 17px; height: 17px; }
.inbox-ic.t-security { background: #fef1f1; color: #dc2626; }
.inbox-ic.t-billing, .inbox-ic.t-storage { background: #fff4e0; color: #b45309; }
.inbox-ic.t-support, .inbox-ic.t-account { background: #fff1e4; color: #e06a0b; }
.inbox-ic.t-video { background: #e9f8ee; color: #15803d; }
.inbox-ic.t-community { background: #eef4ff; color: #2563eb; }
.inbox-ic.t-comments { background: #fff1e4; color: #e06a0b; }
.inbox-text { min-width: 0; display: grid; gap: 2px; }
.inbox-title { font-size: .875rem; font-weight: 500; color: #44403c; line-height: 1.35; }
.inbox-item.unread .inbox-title { font-weight: 700; color: #1c1917; }
.inbox-body { font-size: .8125rem; color: #78716c; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inbox-time { font-size: .75rem; color: #a8a29e; margin-top: 2px; }
.inbox-dot { position: absolute; right: 12px; top: 17px; width: 8px; height: 8px; border-radius: 50%; background: #f58220; }
.inbox-empty { display: grid; justify-items: center; gap: 6px; padding: 36px 24px 40px; text-align: center; color: #78716c; font-size: .875rem; }
.inbox-empty svg { width: 30px; height: 30px; color: #d6cfc7; margin-bottom: 4px; }
.inbox-empty b { color: #1c1917; font-size: .95rem; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 768px) {
	.main-inner { padding: 1.25rem 1rem 3rem; }
	.portal-topbar { display: none; }
	.has-topbar .main-inner { padding-top: 1.25rem; }
	.page-header h1 { font-size: 1.6rem; }
	.card { padding: 1.125rem; }
	.nav-item.active::before { display: none; }
}

/* Sidebar count (creator-page comments waiting for approval) */
.nav-item .nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #f58220; color: #fff; font-size: .7rem; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.sb-collapsed .nav-item:has(.nav-count) { position: relative; }
.sb-collapsed .nav-item .nav-count { position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; font-size: .62rem; padding: 0 4px; }
