
:root {
		--bg: #15213c;
		--surface: #233756;
		--surface-hover: #7fa5dc;
		--accent: #38bdf8;
		--accent-alt: #00ff8c;
		--bg-alt: rgb(254, 241, 222);
		--text: #f1f5f9;
		--text-alt: black;
		--text-muted: #94a3b8;
		--border: rgba(255, 255, 255, 0.1);
		--danger: #ef4444;

/*------dashboard------*/
		--sidebar-w: 280px;
		--props-w: 320px;
		--header-h: 52px;
		--bg: #0f172a;
		--surface: rgba(30, 41, 59, 0.85);
		--border: rgba(255, 255, 255, 0.08);
		--accent: #38bdf8;
		--text: #f1f5f9;
		--muted: #94a3b8;

/*------editor------*/
		--ed-sidebar-w: 280px;
		--ed-props-w: 320px;
		--ed-header-h: 52px;
		--ed-bg: #0f172a;
		--ed-surface: rgba(30, 41, 59, 0.85);
		--ed-border: rgba(255, 255, 255, 0.08);
		--ed-accent: #38bdf8;
		--ed-text: #c3c3c3;
		--ed-muted: #94a3b8;

}

 /* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
		background: var(--bg);
		color: var(--text);
		font-family: 'Outfit', sans-serif;
		height: 100vh;
		width: 100vw;
		overflow: hidden;
}

.dash-body{
	display: flex;
	flex-direction: row;
}

/* ==============================================

 SIDEBAR SECTION

 ==============================================*/
.dash-sidebar {
		width: var(--sidebar-w);
		background: var(--surface);
		border-right: 1px solid var(--border);
		display: flex;
		flex-direction: column;
		flex-shrink: 0; /* Prevents sidebar from squishing */
		height: 100vh;
		z-index: 10;
}

.dash-brand {
		height: var(--header-h);
		padding: 0 1.25rem;
		display: flex;
		align-items: center;
		font-size: 1rem;
		font-weight: 800;
		letter-spacing: 2px;
		color: var(--accent);
		border-bottom: 1px solid var(--border);
}

.nav-section { padding: 1rem 0.6rem; overflow-y: auto; flex: 1; }

.nav-label {
		font-size: 0.6rem;
		font-weight: 800;
		text-transform: uppercase;
		color: var(--text-muted);
		margin: 1.2rem 0 0.4rem 0.5rem;
		letter-spacing: 0.05em;
}

.nav-item {
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 0.5rem 0.75rem;
		color: var(--text-muted);
		text-decoration: none;
		border-radius: 6px;
		font-size: 0.85rem;
		font-weight: 500;
		cursor: pointer;
		transition: all 0.15s;
		margin-bottom: 2px;
		border-left: 2px solid transparent;
}

.nav-item:hover { background: rgba(255,255,255,0.03); color: var(--text); }

.nav-item.active {
		background: rgba(56, 189, 248, 0.08);
		color: var(--accent);
		border-left-color: var(--accent);
		font-weight: 600;
}

/* ─── MAIN AREA ─── */
.dash-main {
		flex: 1; /* 🔥 Takes up all remaining space */
		height: 100vh;
		display: flex;
		flex-direction: column;
		overflow: hidden;
		background: #0f172a;
}

.dash-header {
		height: var(--header-h);
		border-bottom: 1px solid var(--border);
		display: flex;
		align-items: center;
		justify-content: flex-end;
		padding: 0 1.5rem;
		gap: 10px;
		background: rgba(15, 23, 42, 0.3);
		flex-shrink: 0;
}

.dash-viewport {
		flex: 1;
		overflow-y: auto;
		padding: 1.5rem 2.5rem;
}

/* ─── UI COMPONENTS ─── */
.pane-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.pane-title { font-size: 1.5rem; font-weight: 700; }

.btn {
		display: inline-flex; align-items: center; gap: 6px;
		padding: 0.4rem 0.8rem; border-radius: 8px;
		font-size: 0.75rem; font-weight: 700;
		cursor: pointer; transition: all 0.2s;
		border: 1px solid transparent; text-decoration: none;
		color: inherit;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-outline { border: 1px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { color: var(--text); border-color: var(--text-muted); background: rgba(255,255,255,0.02); }

/* Compact Data Tables */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.data-table th { text-align: left; padding: 0.75rem 1rem; font-size: 0.65rem; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.1); }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 0.85rem; }
.data-table tr:hover td { background: rgba(255,255,255,0.01); }

.status-badge { padding: 2px 6px; border-radius: 4px; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; border: 1px solid transparent; }
.status-badge.live { background: rgba(34, 197, 94, 0.1); color: #4ade80; border-color: rgba(34,197,94,0.2); }
.status-badge.draft { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border-color: rgba(245,158,11,0.2); }

/* Forms */
label { display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.4rem; letter-spacing: 0.02em; }
input { width: 100%; background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: 6px; padding: 0.6rem 0.75rem; color: #fff; font-family: inherit; outline: none; font-size: 0.85rem; transition: border-color 0.2s; }
input:focus { border-color: var(--accent); }

/* Modal & Helpers */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,0.8); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 2000; }
.modal-backdrop.active { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; width: 420px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
#toast { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 10000; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Empty State */
.empty-state {
		text-align: center;
		padding: 5rem 2rem;
		background: var(--surface);
		border: 2px dashed var(--border);
		border-radius: 24px;
		color: var(--text-muted);
}
.empty-state i {
		font-size: 3rem;
		margin-bottom: 1rem;
		display: block;
		opacity: 0.3;
}

/* =========================================================

 EDITOR SECTION

========================================================= */
/* ── Top Bar ─────────────────────────────────────────────── */
.ed-topbar {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		height: var(--ed-header-h);
		background: rgba(15, 23, 42, 0.95);
		backdrop-filter: blur(12px);
		border-bottom: 1px solid var(--ed-border);
		display: flex;
		align-items: center;
		padding: 0 1rem;
		gap: 1rem;
		z-index: 1000;
}

.ed-brand {
		font-family: 'Outfit', sans-serif;
		font-weight: 800;
		font-size: 1rem;
		letter-spacing: 2px;
		color: var(--ed-accent);
		white-space: nowrap;
}

.ed-page-title {
		background: transparent;
		border: none;
		outline: none;
		color: var(--ed-text);
		font-family: inherit;
		font-size: 0.9rem;
		font-weight: 600;
		border-bottom: 1px solid transparent;
		padding: 2px 6px;
		transition: border-color 0.2s;
}

.ed-page-title:focus {
		border-bottom-color: var(--ed-accent);
}

.ed-topbar-actions {
		margin-left: auto;
		display: flex;
		gap: 8px;
		align-items: center;
}

.ed-btn {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		padding: 0.4rem 1rem;
		border-radius: 20px;
		font-family: inherit;
		font-size: 0.7rem;
		font-weight: 700;
		letter-spacing: 0.05em;
		text-transform: uppercase;
		cursor: pointer;
		transition: all 0.2s;
		border: 1px solid;
}

.ed-btn-ghost {
		background: transparent;
		border-color: var(--ed-border);
		color: var(--accent-alt);
}

.ed-btn-ghost:hover {
		color: var(--accent-alt);
		border: 2px solid var(--accent-alt);
}

.ed-btn-save {
		background: transparent;
		border-color: var(--ed-accent);
		color: var(--ed-accent);
}

.ed-btn-save[data-dirty="true"] {
		background: rgba(56, 189, 248, 0.1);
		animation: pulse-border 2s ease-in-out infinite;
}

.ed-btn-publish {
		background: linear-gradient(135deg, #22c55e, #16a34a);
		border-color: #22c55e;
		color: #fff;
}

@keyframes pulse-border {

		0%,
		100% {
				box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4);
		}

		50% {
				box-shadow: 0 0 0 4px rgba(56, 189, 248, 0);
		}
}

/* ── Three-Column Layout ─────────────────────────────────── */
.ed-shell {
		display: flex;
		padding-top: var(--ed-header-h);
		height: 100vh;
}

/* Left: Navigator */
.ed-nav {
		width: var(--ed-sidebar-w);
		flex-shrink: 0;
		background: var(--ed-surface);
		backdrop-filter: blur(12px);
		border-right: 1px solid var(--ed-border);
		display: flex;
		flex-direction: column;
		overflow: hidden;
}

.ed-nav-header {
		padding: 1rem;
		border-bottom: 1px solid var(--ed-border);
}

.ed-nav-slug {
		font-size: 0.65rem;
		color: var(--ed-muted);
		margin-top: 4px;
		letter-spacing: 0.05em;
}

.ed-nav-sections {
		flex: 1;
		overflow-y: auto;
		padding: 0.5rem;
}

.ed-nav-section {
		display: flex;
		align-items: center;
		gap: 8px;
		padding: 10px 12px;
		border-radius: 8px;
		cursor: pointer;
		transition: all 0.15s;
		border-left: 2px solid transparent;
		font-size: 0.8rem;
		font-weight: 600;
		margin-bottom: 2px;
		user-select: none;
}

.ed-nav-section:hover {
		background: rgba(255, 255, 255, 0.04);
}

.ed-nav-section.active {
		background: rgba(56, 189, 248, 0.1);
		border-left-color: var(--ed-accent);
		color: var(--ed-accent);
}

.ed-nav-section .drag-handle {
		opacity: 0.3;
		cursor: grab;
		font-size: 12px;
}

.ed-nav-section .section-label {
		flex: 1;
}

.ed-nav-section .del-section {
		opacity: 0;
		color: #ef4444;
		background: none;
		border: none;
		cursor: pointer;
		font-size: 0.85rem;
		padding: 2px 4px;
		transition: opacity 0.15s;
}

.ed-nav-section:hover .del-section {
		opacity: 1;
}

.ed-nav-footer {
		padding: 1rem;
		border-top: 1px solid var(--ed-border);
}

.ed-add-section-form {
		display: flex;
		gap: 6px;
}

.ed-add-section-input {
		flex: 1;
		background: rgba(0, 0, 0, 0.3);
		border: 1px solid var(--ed-border);
		color: var(--ed-text);
		padding: 6px 10px;
		border-radius: 8px;
		font-size: 0.75rem;
		outline: none;
		font-family: inherit;
}

.ed-add-section-input:focus {
		border-color: var(--ed-accent);
}

.ed-add-btn {
		padding: 6px 10px;
		background: var(--ed-accent);
		border: none;
		color: #000;
		border-radius: 8px;
		cursor: pointer;
		font-size: 0.75rem;
		font-weight: 700;
		font-family: inherit;
}

/* Centre: Canvas */
.ed-canvas {
		flex: 1;
		overflow-y: auto;
		overflow-x: hidden;
		background: #f1f5f9;
		position: relative;

}

/* Editor-specific Canvas Interactions */
.ed-canvas .ui-card-grid__item {
		position: relative;
		cursor: cell;
		transition: outline 0.2s ease, transform 0.2s ease;
}

.ed-canvas .ui-card-grid__item:hover {
		outline: 2px dashed rgba(56, 189, 248, 0.5);
		outline-offset: 4px;
		border-radius: 8px;
}

.ed-canvas .ui-card-grid__item:hover::after {
		content: "✎ Edit Card";
		position: absolute;
		top: 12px;
		right: 12px;
		background: var(--ed-accent);
		color: #000;
		font-size: 0.65rem;
		font-weight: 800;
		padding: 4px 8px;
		border-radius: 4px;
		z-index: 10;
		pointer-events: none;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Section wrappers inside canvas */
.ed-section-wrap {
		position: relative;
		transition: outline 0.15s;
		outline: 2px solid transparent;
		padding-top: 2.5rem;
		padding-bottom: 2.5rem;
}

.ed-section-wrap:hover {
		outline: 2px solid rgba(56, 189, 248, 0.4);
}

.ed-section-wrap.selected {
		outline: 2px solid var(--ed-accent) !important;
}

/* Editor overlay bar (sits on top of real rendered content) */
.ed-section-overlay {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		display: flex;
		align-items: center;
		gap: 8px;
		padding: 4px 12px;
		background: rgba(15, 23, 42, 0.82);
		backdrop-filter: blur(8px);
		font-size: 0.65rem;
		font-weight: 700;
		letter-spacing: 0.1em;
		text-transform: uppercase;
		color: var(--ed-accent);
		opacity: 0;
		transition: opacity 0.2s;
		z-index: 99;
		pointer-events: none;
}

.ed-section-wrap:hover .ed-section-overlay,
.ed-section-wrap.selected .ed-section-overlay {
		opacity: 1;
		pointer-events: all;
}

.ed-section-overlay-name {
		flex: 1;
}

.ed-overlay-btn {
		pointer-events: all;
		background: none;
		border: none;
		color: inherit;
		cursor: pointer;
		font-size: 0.9rem;
		opacity: 0.7;
		padding: 2px 4px;
		transition: opacity 0.15s, color 0.15s;
}

.ed-overlay-btn:hover {
		opacity: 1;
}

.ed-overlay-btn.del:hover {
		color: #ef4444;
}

/* Empty slot placeholder */
.editor-empty-slot {
		display: flex;
		align-items: center;
		justify-content: center;
		min-height: 200px;
		border: 2px dashed rgba(0, 0, 0, 0.15);
		border-radius: 8px;
		margin: 2rem;
		background: rgba(255, 255, 255, 0.5);
		color: #64748b;
		font-size: 0.9rem;
		font-weight: 600;
		cursor: pointer;
}

.editor-render-error {
		padding: 1rem 2rem;
		background: #fef2f2;
		color: #dc2626;
		font-size: 0.85rem;
		border-left: 3px solid #ef4444;
}


/* Right: Properties Pane Base */
.ed-props {
		width: var(--ed-props-w);
		flex-shrink: 0;
		background: var(--ed-surface);
		backdrop-filter: blur(12px);
		border-left: 1px solid var(--ed-border);
		display: flex;
		flex-direction: column;
		overflow: hidden;
		transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
		position: relative;
		z-index: 100;
		/* Ensure it overlays canvas when expanded */
}

/* 🔥 The Expanded State 🔥 */
.ed-props.expanded {
		width: 600px;
		/* Wide enough for comfortable writing */
		box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
		border-left: 1px solid var(--ed-accent);
}

.ed-props-header {
		padding: 1rem;
		border-bottom: 1px solid var(--ed-border);
		font-size: 0.65rem;
		font-weight: 800;
		letter-spacing: 0.12em;
		text-transform: uppercase;
		color: var(--ed-accent);
		display: flex;
		align-items: center;
		justify-content: space-between;
		/* Space out title and button */
}

/* The Expand Button */
.ed-expand-btn {
		background: rgba(255, 255, 255, 0.05);
		border: 1px solid var(--ed-border);
		color: var(--ed-text);
		border-radius: 6px;
		padding: 4px 8px;
		cursor: pointer;
		transition: all 0.2s;
		display: flex;
		align-items: center;
		justify-content: center;
}

.ed-expand-btn:hover {
		background: rgba(56, 189, 248, 0.15);
		border-color: var(--ed-accent);
		color: var(--ed-accent);
}

/* Trix Editor adjustments for expanded mode */
.ed-props.expanded trix-editor {
		min-height: 400px !important;
		/* Make it taller when expanded! */
		font-size: 1rem !important;
		/* Larger text for easier reading */
}

#props-pane {
		flex: 1;
		overflow-y: auto;
}



/* Toast notifications */
#toast {
		position: fixed;
		bottom: 1rem;
		right: 1rem;
		z-index: 9999;
}

/* ── HTMX Indicators & Spinners ──────────────────────────── */
.htmx-indicator {
		display: none;
		width: 14px;
		height: 14px;
		border: 2px solid rgba(255, 255, 255, 0.2);
		border-top-color: white;
		border-radius: 50%;
		animation: ed-spin 0.6s linear infinite;
}

.htmx-request .htmx-indicator {
		display: inline-block;
}

.htmx-request.htmx-indicator {
		display: inline-block;
}

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

/* Button Processing State */
.ed-btn:disabled {
		opacity: 0.6;
		cursor: not-allowed;
		pointer-events: none;
}
/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 2rem 0;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination-btn:hover:not(.disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(56, 189, 248, 0.05);
    transform: translateY(-2px);
}

.pagination-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.pagination-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.o-admin-dashboard .section-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent-alt);
    margin: 3rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.o-admin-dashboard .section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}
