/* ==========================================================================
   Portal de Documentos Corporativos — variables de marca
   Ajusta estos valores con los colores/tipografias reales de la empresa.
   ========================================================================== */
:root {
	--ep-color-primary: #1f4e3d;      /* color corporativo principal */
	--ep-color-primary-dark: #163a2c;
	--ep-color-secondary: #d9a441;    /* color de acento */
	--ep-color-success: #2f9e44;
	--ep-color-danger: #e03131;
	--ep-color-bg: #f7f7f5;
	--ep-color-surface: #ffffff;
	--ep-color-border: #e3e1db;
	--ep-color-text: #23271f;
	--ep-color-text-muted: #6b6f66;

	/* Titulos: estilo ITC Souvenir -> fallback DM Serif Display / Georgia */
	--ep-font-heading: 'DM Serif Display', Georgia, 'Times New Roman', serif;
	/* Cuerpo/UI: estilo Biennale -> fallback Outfit / Montserrat */
	--ep-font-body: 'Outfit', 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;

	--ep-radius: 10px;
	--ep-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.ep-login-card,
.ep-portal-wrapper {
	font-family: var(--ep-font-body);
	color: var(--ep-color-text);
	box-sizing: border-box;
}

.ep-login-card *,
.ep-portal-wrapper * {
	box-sizing: border-box;
}

/* ---------- Botones ---------- */
.ep-btn {
	font-family: var(--ep-font-body);
	font-weight: 600;
	font-size: 0.95rem;
	padding: 0.7rem 1.4rem;
	border-radius: var(--ep-radius);
	border: 1px solid transparent;
	cursor: pointer;
	transition: transform 0.08s ease, opacity 0.15s ease;
}
.ep-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
.ep-btn:not(:disabled):hover {
	transform: translateY(-1px);
}
.ep-btn-primary {
	background: var(--ep-color-primary);
	color: #fff;
}
.ep-btn-primary:hover { background: var(--ep-color-primary-dark); }
.ep-btn-success {
	background: var(--ep-color-success);
	color: #fff;
}
.ep-btn-ghost {
	background: transparent;
	border-color: var(--ep-color-border);
	color: var(--ep-color-text);
}
.ep-btn-small {
	padding: 0.4rem 0.9rem;
	font-size: 0.85rem;
}

/* ---------- Login ---------- */
.ep-login-card {
	max-width: 380px;
	margin: 4rem auto;
	background: var(--ep-color-surface);
	border: 1px solid var(--ep-color-border);
	border-radius: var(--ep-radius);
	box-shadow: var(--ep-shadow);
	padding: 2.5rem 2rem;
	text-align: center;
}
.ep-login-logo {
	max-width: 160px;
	margin-bottom: 1rem;
}
.ep-login-title {
	font-family: var(--ep-font-heading);
	font-size: 1.8rem;
	margin: 0 0 0.4rem;
	color: var(--ep-color-primary);
}
.ep-login-subtitle {
	color: var(--ep-color-text-muted);
	margin-bottom: 1.5rem;
}
#ep-login-form input[type='text'] {
	width: 100%;
	padding: 0.75rem 1rem;
	border: 1px solid var(--ep-color-border);
	border-radius: var(--ep-radius);
	font-size: 1rem;
	margin-bottom: 1rem;
}
#ep-login-form .ep-btn {
	width: 100%;
}
.ep-login-error {
	color: var(--ep-color-danger);
	font-size: 0.85rem;
	min-height: 1.2em;
	margin-top: 0.75rem;
}

/* ---------- Modal de bienvenida ---------- */
.ep-welcome-overlay {
	position: fixed;
	inset: 0;
	background: rgba(20, 24, 18, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	padding: 1rem;
}
.ep-welcome-modal {
	background: var(--ep-color-surface);
	border-radius: var(--ep-radius);
	max-width: 520px;
	width: 100%;
	padding: 2.2rem;
	box-shadow: var(--ep-shadow);
	text-align: center;
}
.ep-welcome-modal h2 {
	font-family: var(--ep-font-heading);
	color: var(--ep-color-primary);
	margin-top: 0;
}
.ep-welcome-modal p {
	color: var(--ep-color-text-muted);
	line-height: 1.5;
	margin-bottom: 1.6rem;
}

/* ---------- Layout del portal ---------- */
.ep-portal-layout {
	display: grid;
	grid-template-columns: 260px 1fr;
	gap: 1.5rem;
	max-width: 1200px;
	margin: 0 auto;
}

.ep-portal-tabs {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	background: var(--ep-color-surface);
	border: 1px solid var(--ep-color-border);
	border-radius: var(--ep-radius);
	padding: 0.75rem;
	align-self: start;
}
.ep-tab-btn {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	text-align: left;
	background: transparent;
	border: none;
	border-radius: 8px;
	padding: 0.65rem 0.7rem;
	font-family: var(--ep-font-body);
	font-size: 0.92rem;
	cursor: pointer;
	color: var(--ep-color-text);
}
.ep-tab-btn:hover { background: var(--ep-color-bg); }
.ep-tab-btn.is-active {
	background: var(--ep-color-primary);
	color: #fff;
}
.ep-tab-status {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--ep-color-border);
	flex-shrink: 0;
}
.ep-tab-status.is-read { background: var(--ep-color-success); }
.ep-tab-label { flex: 1; }
.ep-tab-badge {
	font-size: 0.65rem;
	background: var(--ep-color-secondary);
	color: #3a2a05;
	padding: 0.15rem 0.4rem;
	border-radius: 999px;
	white-space: nowrap;
}

.ep-portal-main {
	background: var(--ep-color-surface);
	border: 1px solid var(--ep-color-border);
	border-radius: var(--ep-radius);
	display: flex;
	flex-direction: column;
	min-height: 70vh;
	overflow: hidden;
}
.ep-viewer-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--ep-color-border);
	flex-wrap: wrap;
}
.ep-viewer-doc-title {
	font-family: var(--ep-font-heading);
	font-size: 1.15rem;
	color: var(--ep-color-primary);
}
.ep-viewer-actions {
	display: flex;
	gap: 0.6rem;
}

.ep-viewer-body {
	display: flex;
	flex: 1;
	min-height: 0;
	position: relative;
}
.ep-pdf-container {
	flex: 1;
	overflow-y: auto;
	background: var(--ep-color-bg);
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.5rem;
}
.ep-pdf-loading {
	color: var(--ep-color-text-muted);
	padding: 3rem 0;
}
.ep-pdf-page-wrap {
	position: relative;
	box-shadow: var(--ep-shadow);
	background: #fff;
}
.ep-pdf-page-wrap canvas { display: block; }
.ep-pdf-text-layer {
	position: absolute;
	inset: 0;
	overflow: hidden;
	line-height: 1;
	opacity: 0.25;
}
.ep-pdf-text-layer span {
	position: absolute;
	white-space: pre;
	transform-origin: 0 0;
	color: transparent;
}
.ep-pdf-text-layer ::selection { background: rgba(217, 164, 65, 0.4); }

.ep-highlight-mark {
	position: absolute;
	pointer-events: none;
	mix-blend-mode: multiply;
	border-radius: 2px;
}

.ep-notes-panel {
	width: 300px;
	border-left: 1px solid var(--ep-color-border);
	padding: 1.25rem;
	overflow-y: auto;
	background: var(--ep-color-surface);
}
.ep-notes-panel h3 {
	font-family: var(--ep-font-heading);
	margin-top: 0;
	color: var(--ep-color-primary);
}
.ep-notes-hint {
	font-size: 0.8rem;
	color: var(--ep-color-text-muted);
	margin-top: -0.5rem;
}
.ep-notes-list {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}
.ep-note-item {
	border: 1px solid var(--ep-color-border);
	border-radius: 8px;
	padding: 0.6rem 0.75rem;
	font-size: 0.85rem;
	position: relative;
}
.ep-note-item .ep-note-page {
	font-size: 0.7rem;
	color: var(--ep-color-text-muted);
	display: block;
	margin-bottom: 0.2rem;
}
.ep-note-delete {
	position: absolute;
	top: 0.4rem;
	right: 0.5rem;
	border: none;
	background: transparent;
	color: var(--ep-color-danger);
	cursor: pointer;
	font-size: 0.75rem;
}
.ep-add-note textarea {
	width: 100%;
	min-height: 70px;
	border: 1px solid var(--ep-color-border);
	border-radius: 8px;
	padding: 0.6rem;
	font-family: var(--ep-font-body);
	margin-bottom: 0.5rem;
	resize: vertical;
}

.ep-selection-toolbar {
	position: fixed;
	display: flex;
	align-items: center;
	gap: 0.4rem;
	background: var(--ep-color-text);
	padding: 0.4rem 0.6rem;
	border-radius: 8px;
	z-index: 100;
	box-shadow: var(--ep-shadow);
}
.ep-color-dot {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 2px solid #fff;
	cursor: pointer;
	padding: 0;
}
.ep-selection-toolbar .ep-btn-small {
	background: var(--ep-color-secondary);
	color: #3a2a05;
}

.ep-docs-notice {
	max-width: 600px;
	margin: 3rem auto;
	text-align: center;
	color: var(--ep-color-text-muted);
}

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
	.ep-portal-layout {
		grid-template-columns: 1fr;
	}
	.ep-portal-tabs {
		flex-direction: row;
		overflow-x: auto;
		white-space: nowrap;
	}
	.ep-tab-btn { flex-shrink: 0; }
	.ep-viewer-body {
		flex-direction: column;
	}
	.ep-notes-panel {
		width: 100%;
		border-left: none;
		border-top: 1px solid var(--ep-color-border);
	}
}

@media (max-width: 480px) {
	.ep-login-card { margin: 2rem 1rem; padding: 2rem 1.25rem; }
	.ep-viewer-toolbar { flex-direction: column; align-items: stretch; }
	.ep-viewer-actions { justify-content: stretch; }
	.ep-viewer-actions .ep-btn { flex: 1; }
}
