/**
 * Easy Dashboard for Divi · CSS del shell
 *
 * Diseñado para coexistir con cualquier theme (Divi 4 / Divi 5 / GeneratePress
 * / Astra…). Todas las reglas se aplican a `body.edfd-dashboard` para no
 * afectar el resto del sitio. Tokens expuestos como CSS custom properties
 * para que cada usuario pueda redefinirlos via Settings (color marca, accent)
 * o via Customizer custom CSS.
 *
 * Grid principal:  260px sidebar | 1fr main
 * Mobile (<=1024): sidebar off-canvas drawer + backdrop, toggleable desde
 *                  el hamburger del topbar.
 */

/* ════════════════════════════════════════════════════════════════
   Tokens · scope: body.edfd-dashboard
   ════════════════════════════════════════════════════════════════ */
body.edfd-dashboard {
	/* Brand · sobreescribibles desde Ajustes */
	--ed-brand:        #014DFD;
	--ed-brand-light:  #4A7EFF;
	--ed-accent:       #62E5FF;

	/* Ink · tokens por defecto del tema CLARO. La regla `.edfd-theme-dark`
	   los reescribe al tema oscuro zinc. */
	--ed-ink:          #0A0A0A;
	--ed-ink-2:        #27272A;
	--ed-ink-3:        #52525B;
	--ed-ink-4:        #71717A;

	/* Surfaces · defaults del tema CLARO (overridable inline por Ajustes) */
	--ed-bg:           #F5F5F5;
	--ed-bg-2:         #FFFFFF;
	--ed-surface:      #FFFFFF;
	--ed-surface-2:    #FAFAFA;

	/* Lines */
	--ed-line:         rgba(10,10,10,0.06);
	--ed-line-2:       rgba(10,10,10,0.08);
	--ed-line-strong:  rgba(10,10,10,0.16);

	/* Fonts · leemos las CSS vars que Divi 5 inyecta en `:root` (heading_font
	   y body_font definidos en Theme Options / Theme Builder). Fallback
	   `inherit` para themes que no son Divi · ahí hereda del body real.
	   Solo mono queda fija para eyebrows, badges, labels. */
	--ed-font-display: var(--et_global_heading_font, inherit);
	--ed-font-body:    var(--et_global_body_font, inherit);
	--ed-font-mono:    ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

	/* Radii */
	--ed-radius-lg:    20px;
	--ed-radius:       14px;
	--ed-radius-sm:    8px;
	--ed-radius-pill:  999px;

	/* Spacing */
	--ed-space-2: 8px; --ed-space-3: 12px; --ed-space-4: 16px;
	--ed-space-5: 24px; --ed-space-6: 32px; --ed-space-7: 48px;

	/* Motion */
	--ed-ease:    cubic-bezier(0.2, 0.7, 0.2, 1);
	--ed-dur:     250ms;

	/* Shadows */
	--ed-shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 30px 60px -40px rgba(0,0,0,0.9);

	/* Gradient */
	--ed-grad: linear-gradient(135deg, var(--ed-brand) 0%, var(--ed-brand-light) 100%);
}

/* ════════════════════════════════════════════════════════════════
   Base reset · solo dentro del dashboard
   ════════════════════════════════════════════════════════════════ */
body.edfd-dashboard {
	margin: 0;
	padding: 0;
	background: var(--ed-bg);
	color: var(--ed-ink-2);
	min-height: 100vh;
	/* font-family: lo deja el theme (Divi setea body_font en su :root o
	   en el `body` directo) · no lo pisamos para no romper la herencia. */
	font-size: 14px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}
body.edfd-dashboard *,
body.edfd-dashboard *::before,
body.edfd-dashboard *::after { box-sizing: border-box; }

body.edfd-dashboard h1,
body.edfd-dashboard h2,
body.edfd-dashboard h3,
body.edfd-dashboard h4,
body.edfd-dashboard h5,
body.edfd-dashboard h6 {
	color: var(--ed-ink);
	font-family: var(--ed-font-display);
	margin: 0;
}
body.edfd-dashboard p { margin: 0 0 1em; color: var(--ed-ink-2); }
body.edfd-dashboard a { color: inherit; text-decoration: none; }
body.edfd-dashboard button { font-family: inherit; cursor: pointer; }
body.edfd-dashboard :focus-visible { outline: 2px solid var(--ed-accent); outline-offset: 2px; border-radius: 4px; }

/* ════════════════════════════════════════════════════════════════
   App shell · sidebar + main
   ════════════════════════════════════════════════════════════════ */
.ed-app {
	display: grid;
	grid-template-columns: 260px 1fr;
	min-height: 100vh;
}
.ed-app > .ed-main-col { min-width: 0; display: flex; flex-direction: column; }

/* Backdrop del drawer mobile */
body.edfd-dashboard .ed-backdrop {
	position: fixed; inset: 0; z-index: 55;
	background: rgba(4,8,20,0.7);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	opacity: 0; pointer-events: none;
	transition: opacity var(--ed-dur) var(--ed-ease);
}
body.edfd-dashboard .ed-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* ── Sidebar ───────────────────────────────────────────────────── */
.ed-sidebar {
	background: var(--ed-bg-2);
	border-right: 1px solid var(--ed-line-2);
	padding: 12px 14px 14px;
	display: flex; flex-direction: column; gap: 2px;
	position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.ed-sidebar__logo {
	display: flex; align-items: center; gap: 10px;
	padding: 4px 10px 12px;
	color: var(--ed-ink);
	font-family: var(--ed-font-display);
	font-weight: 700;
	font-size: 16px;
	letter-spacing: -0.01em;
}
.ed-sidebar__logo img { display: block; max-height: 32px; width: auto; }
.ed-sidebar__logo-mark {
	width: 32px; height: 32px; border-radius: 10px;
	background: var(--ed-grad);
	display: flex; align-items: center; justify-content: center;
	font-family: var(--ed-font-display); font-weight: 700;
	color: #fff; font-size: 14px;
	box-shadow: 0 10px 40px -8px rgba(1,77,253,0.55);
	flex-shrink: 0;
}
.ed-sidebar__section {
	font-family: var(--ed-font-mono); font-size: 10px;
	text-transform: uppercase; letter-spacing: 0.14em;
	color: var(--ed-ink-4);
	padding: 10px 10px 4px;
}

.ed-nav-item {
	display: flex; align-items: center; gap: 12px;
	padding: 8px 12px; border-radius: 12px;
	font-size: 14px; font-weight: 500; color: var(--ed-ink-2);
	transition: background var(--ed-dur) var(--ed-ease),
	            color var(--ed-dur) var(--ed-ease),
	            border-color var(--ed-dur) var(--ed-ease);
	border: 1px solid transparent;
	position: relative;
	text-decoration: none;
}
.ed-nav-item:hover {
	background: color-mix(in srgb, var(--ed-brand) 8%, transparent);
	color: var(--ed-ink);
}
.ed-nav-item.is-active {
	background: color-mix(in srgb, var(--ed-brand) 14%, transparent);
	color: var(--ed-ink);
	border-color: color-mix(in srgb, var(--ed-brand) 30%, transparent);
}
/* Íconos del sidebar · color de marca en idle, hover y active. */
.ed-nav-item__ico {
	color: var(--ed-brand);
	flex-shrink: 0;
	display: inline-flex;
}
.ed-nav-item:hover .ed-nav-item__ico,
.ed-nav-item.is-active .ed-nav-item__ico { color: var(--ed-brand); }
.ed-nav-item__badge {
	margin-left: auto;
	font-family: var(--ed-font-mono); font-size: 10px;
	color: var(--ed-accent);
	background: color-mix(in srgb, var(--ed-accent) 12%, transparent);
	padding: 2px 7px; border-radius: 999px;
	border: 1px solid color-mix(in srgb, var(--ed-accent) 28%, transparent);
}
.ed-nav-item__external {
	margin-left: auto;
	opacity: 0.5;
	color: var(--ed-ink-3);
	display: inline-flex;
}

/* ── Topbar ────────────────────────────────────────────────────── */
.ed-topbar {
	height: 68px; border-bottom: 1px solid var(--ed-line-2);
	display: flex; align-items: center; gap: 16px;
	padding: 0 32px;
	background: color-mix(in srgb, var(--ed-bg) 70%, transparent);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	position: sticky; top: 0; z-index: 10;
}
.ed-topbar__hamburger {
	display: none;
	background: transparent; border: 0; padding: 8px; border-radius: 10px;
	color: var(--ed-ink-2);
	cursor: pointer;
	margin-right: -4px;
	transition: color var(--ed-dur) var(--ed-ease),
	            background var(--ed-dur) var(--ed-ease);
}
.ed-topbar__hamburger:hover {
	color: var(--ed-brand);
	background: color-mix(in srgb, var(--ed-brand) 6%, transparent);
}
.ed-topbar__title {
	font-family: var(--ed-font-display);
	font-weight: 600; font-size: 18px;
	color: var(--ed-ink);
	margin: 0;
}
.ed-topbar__crumb {
	font-family: var(--ed-font-mono);
	font-size: 11px;
	color: var(--ed-ink-4);
	text-transform: uppercase;
	letter-spacing: 0.12em;
}
.ed-topbar__actions {
	margin-left: auto;
	display: flex; align-items: center; gap: 14px;
}
.ed-avatar {
	display: flex; align-items: center; gap: 10px;
	padding: 4px; border-radius: var(--ed-radius-pill);
	transition: background var(--ed-dur) var(--ed-ease);
}
.ed-avatar:hover { background: color-mix(in srgb, var(--ed-brand) 6%, transparent); }
.ed-avatar__img {
	width: 34px; height: 34px;
	border-radius: 50%;
	background: var(--ed-surface);
	display: inline-flex; align-items: center; justify-content: center;
	overflow: hidden;
	font-weight: 600;
	color: var(--ed-brand);
	font-size: 12px;
	flex-shrink: 0;
	border: 1px solid var(--ed-line-2);
}
.ed-avatar__img img { width: 100%; height: 100%; object-fit: cover; }
.ed-avatar__meta { display: flex; flex-direction: column; line-height: 1.2; padding-right: 8px; }
.ed-avatar__name { font-size: 13px; color: var(--ed-ink); font-weight: 600; }
.ed-avatar__role { font-family: var(--ed-font-mono); font-size: 10px; color: var(--ed-ink-3); text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Main · contenedor para el contenido Divi del usuario ─────── */
.ed-main {
	padding: 32px;
	flex: 1;
}
.ed-main__inner {
	width: 95%;
	max-width: 100%;
	margin: 0 auto;
}

/* ════════════════════════════════════════════════════════════════
   Profile block · [easy_dashboard_profile]
   ════════════════════════════════════════════════════════════════ */
.ed-profile {
	background: var(--ed-surface);
	border: 1px solid var(--ed-line-2);
	border-radius: var(--ed-radius-lg);
	padding: 28px;
	display: grid;
	grid-template-columns: 120px 1fr;
	gap: 24px;
	align-items: start;
}
.ed-profile__avatar-wrap {
	width: 120px; height: 120px;
	border-radius: 50%;
	overflow: hidden;
	border: 2px solid var(--ed-line-strong);
	background: var(--ed-surface-2);
	display: flex; align-items: center; justify-content: center;
	font-weight: 700;
	color: var(--ed-brand); font-size: 36px;
	position: relative;
}
.ed-profile__avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.ed-profile__avatar-upload {
	position: absolute; inset: 0;
	background: rgba(4,8,20,0.7);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	opacity: 0;
	cursor: pointer;
	font-family: var(--ed-font-mono); font-size: 10px;
	text-transform: uppercase; letter-spacing: 0.1em;
	transition: opacity var(--ed-dur) var(--ed-ease);
}
.ed-profile__avatar-wrap:hover .ed-profile__avatar-upload { opacity: 1; }
.ed-profile__name { font-size: 24px; color: var(--ed-ink); margin: 0 0 4px; }
.ed-profile__role { font-family: var(--ed-font-mono); font-size: 11px; color: var(--ed-ink-3); text-transform: uppercase; letter-spacing: 0.12em; }
.ed-profile__bio { color: var(--ed-ink-2); margin: 14px 0 18px; line-height: 1.65; }
.ed-profile__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.ed-btn {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 10px 18px;
	border-radius: var(--ed-radius-pill);
	font-family: var(--ed-font-body); font-size: 13px; font-weight: 600;
	border: 0;
	cursor: pointer;
	text-decoration: none;
	transition: transform var(--ed-dur) var(--ed-ease),
	            box-shadow var(--ed-dur) var(--ed-ease),
	            background var(--ed-dur) var(--ed-ease);
	line-height: 1;
}
.ed-btn--primary {
	background: var(--ed-grad);
	color: #fff;
	box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--ed-brand) 50%, transparent);
}
.ed-btn--primary:hover { transform: translateY(-2px); }
.ed-btn--ghost {
	background: transparent;
	color: var(--ed-ink);
	border: 1px solid var(--ed-line-strong);
}
.ed-btn--ghost:hover { background: color-mix(in srgb, var(--ed-accent) 6%, transparent); }
.ed-btn--sm { padding: 7px 14px; font-size: 12px; }

.ed-profile__widgets { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--ed-line-2); }
.ed-profile__widgets-title {
	font-family: var(--ed-font-mono); font-size: 11px;
	color: var(--ed-accent);
	text-transform: uppercase; letter-spacing: 0.14em;
	margin: 0 0 14px;
}

/* Edit form */
.ed-profile-form { display: grid; gap: 14px; max-width: 540px; }
.ed-profile-form label {
	font-family: var(--ed-font-mono); font-size: 11px;
	color: var(--ed-ink-3);
	text-transform: uppercase; letter-spacing: 0.12em;
	display: block; margin-bottom: 4px;
}
.ed-profile-form input[type="text"],
.ed-profile-form input[type="email"],
.ed-profile-form textarea {
	width: 100%;
	background: var(--ed-bg-2);
	border: 1px solid var(--ed-line-2);
	border-radius: var(--ed-radius);
	padding: 10px 14px;
	color: var(--ed-ink);
	font-family: var(--ed-font-body); font-size: 14px;
	transition: border-color var(--ed-dur) var(--ed-ease);
}
.ed-profile-form textarea { min-height: 100px; resize: vertical; }
.ed-profile-form input:focus,
.ed-profile-form textarea:focus { outline: none; border-color: var(--ed-line-strong); }
.ed-profile-form__row { display: grid; gap: 14px; }
@media (min-width: 640px) { .ed-profile-form__row--cols { grid-template-columns: 1fr 1fr; } }

.ed-profile__notice {
	padding: 10px 14px; border-radius: var(--ed-radius);
	font-size: 13px;
	background: color-mix(in srgb, var(--ed-accent) 8%, transparent);
	border: 1px solid color-mix(in srgb, var(--ed-accent) 25%, transparent);
	color: var(--ed-ink);
	margin-bottom: 14px;
}
.ed-profile__notice--error {
	background: color-mix(in srgb, #ff4d6a 10%, transparent);
	border-color: color-mix(in srgb, #ff4d6a 30%, transparent);
}

/* ════════════════════════════════════════════════════════════════
   Tema dark · paleta zinc (gris neutro · NO copia tokens UXDivi)
   ════════════════════════════════════════════════════════════════ */
body.edfd-dashboard.edfd-theme-dark {
	--ed-bg:           #09090B;
	--ed-bg-2:         #18181B;
	--ed-surface:      #18181B;
	--ed-surface-2:    #27272A;
	--ed-ink:          #FAFAFA;
	--ed-ink-2:        #E4E4E7;
	--ed-ink-3:        #A1A1AA;
	--ed-ink-4:        #71717A;
	--ed-line:         rgba(255,255,255,0.06);
	--ed-line-2:       rgba(255,255,255,0.10);
	--ed-line-strong:  rgba(255,255,255,0.18);
	--ed-shadow-card:  0 1px 0 rgba(255,255,255,0.04) inset, 0 30px 60px -40px rgba(0,0,0,0.9);
}
body.edfd-dashboard.edfd-theme-dark .ed-topbar {
	background: color-mix(in srgb, var(--ed-bg) 80%, transparent);
}

/* ════════════════════════════════════════════════════════════════
   Responsive · sidebar off-canvas <=1024
   El JS de PHP inyecta inline override si el user cambia el breakpoint.
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
	body.edfd-dashboard { overflow-x: hidden; }
	body.edfd-dashboard .ed-app {
		grid-template-columns: 1fr;
		min-width: 0;
	}
	body.edfd-dashboard .ed-sidebar {
		position: fixed; top: 0; left: 0; z-index: 60;
		width: min(280px, 86vw);
		height: 100vh;
		transform: translateX(-100%);
		transition: transform var(--ed-dur) var(--ed-ease);
		box-shadow: 8px 0 32px -12px rgba(0,0,0,0.6);
	}
	body.edfd-dashboard .ed-sidebar.is-open { transform: translateX(0); }
	body.edfd-dashboard .ed-topbar { padding: 0 16px; }
	body.edfd-dashboard .ed-topbar__hamburger { display: inline-flex; align-items: center; justify-content: center; }
	body.edfd-dashboard .ed-main { padding: 20px 16px 48px; }
	body.edfd-dashboard .ed-profile { grid-template-columns: 1fr; text-align: center; }
	body.edfd-dashboard .ed-profile__avatar-wrap { margin: 0 auto; }
	body.edfd-dashboard .ed-profile__actions { justify-content: center; }
}

@media (max-width: 640px) {
	body.edfd-dashboard .ed-topbar__crumb,
	body.edfd-dashboard .ed-avatar__meta { display: none; }
	body.edfd-dashboard .ed-topbar__title { font-size: 16px; }
}

/* Accessibility · reduce motion */
@media (prefers-reduced-motion: reduce) {
	body.edfd-dashboard *,
	body.edfd-dashboard *::before,
	body.edfd-dashboard *::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

/* Util · screen-reader only */
.ed-sr-only {
	position: absolute; width: 1px; height: 1px;
	padding: 0; margin: -1px; overflow: hidden;
	clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
