/* ===========================================
   CONSULTORIO FANTASY - Estilos del muro
   =========================================== */
:root, #cf-app, .cf-auth-wrap {
	--cf-primary: #7C3AED;
	--cf-primary-dark: #5B21B6;
	--cf-accent: #F59E0B;
	--cf-bg: #F8F7FC;
	--cf-card: #FFFFFF;
	--cf-border: #E9E5F5;
	--cf-text: #1F2937;
	--cf-muted: #6B7280;
	--cf-radius: 14px;
}
#cf-app, .cf-auth-wrap {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--cf-text);
	max-width: 720px;
	margin: 0 auto;
	box-sizing: border-box;
}
#cf-app *, .cf-auth-wrap * { box-sizing: border-box; }
.cf-wrap { position: relative; }

/* El widget de chat vive en el footer de toda la web, fuera de #cf-app,
   así que necesita su propio reset de caja y tipografía. */
.cf-chat-widget, .cf-chat-widget *,
.cf-modal-overlay, .cf-modal-overlay * {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Botones genéricos ---------- */
.cf-btn {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 10px 18px; border-radius: 999px; border: none;
	font-weight: 600; font-size: 14px; cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.cf-btn:active { transform: scale(0.96); }
.cf-btn-primary {
	background: linear-gradient(135deg, var(--cf-primary), #A855F7);
	color: #fff;
	box-shadow: 0 4px 14px rgba(124,58,237,.35);
}
.cf-btn-primary:hover { box-shadow: 0 6px 18px rgba(124,58,237,.45); }
.cf-btn-ghost { background: transparent; color: var(--cf-primary); border: 1px solid var(--cf-border); }
.cf-btn-sm { padding: 6px 12px; font-size: 13px; }
.cf-btn-block { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- Login / Registro ---------- */
.cf-auth-wrap { display: flex; justify-content: center; padding: 24px 12px; }
.cf-auth-card {
	background: var(--cf-card); border-radius: var(--cf-radius);
	box-shadow: 0 10px 40px rgba(93,45,180,.12);
	padding: 32px; width: 100%; max-width: 420px;
	border: 1px solid var(--cf-border);
}
.cf-auth-head { text-align: center; margin-bottom: 18px; }
.cf-auth-head h2 { margin: 0 0 6px; font-size: 24px; }
.cf-auth-head p { color: var(--cf-muted); font-size: 14px; margin: 0; }
.cf-auth-tabs { display: flex; background: var(--cf-bg); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.cf-tab-btn { flex: 1; border: none; background: transparent; padding: 10px; border-radius: 999px; font-weight: 600; cursor: pointer; color: var(--cf-muted); }
.cf-tab-btn.active { background: var(--cf-primary); color: #fff; }
.cf-auth-form { display: none; flex-direction: column; gap: 14px; }
.cf-auth-form.active { display: flex; }
.cf-field label { font-size: 13px; font-weight: 600; margin-bottom: 4px; display: block; color: var(--cf-muted); }
.cf-field input[type=text], .cf-field input[type=email], .cf-field input[type=password], .cf-field textarea, .cf-field select {
	width: 100%; padding: 11px 14px; border: 1px solid var(--cf-border); border-radius: 10px;
	font-size: 14px; background: var(--cf-bg); outline: none; transition: border-color .15s;
}
.cf-field input:focus, .cf-field textarea:focus { border-color: var(--cf-primary); }
.cf-avatar-field { display: flex; justify-content: center; margin-bottom: 6px; }
.cf-avatar-upload { position: relative; cursor: pointer; text-align: center; }
.cf-avatar-upload img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid var(--cf-border); display: block; }
.cf-avatar-upload span { display: block; font-size: 12px; color: var(--cf-primary); margin-top: 6px; font-weight: 600; }
.cf-form-msg { font-size: 13px; text-align: center; min-height: 18px; }
.cf-form-msg.error { color: #DC2626; }
.cf-form-msg.success { color: #16A34A; }

/* Antibot: honeypot invisible + captcha visible y amigable */
.cf-honeypot { position: absolute !important; left: -9999px !important; top: -9999px !important; height: 0; overflow: hidden; }
.cf-captcha-field input { text-align: center; font-weight: 700; letter-spacing: 1px; }
.cf-captcha-refresh { background:none; border:none; color:var(--cf-primary); font-size:12px; cursor:pointer; text-decoration:underline; margin-top:4px; }

/* ---------- Barra superior ---------- */
.cf-topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px; flex-wrap: wrap; gap: 10px; }
.cf-logo { font-size: 20px; font-weight: 800; }
.cf-topbar-right { display: flex; align-items: center; gap: 10px; }
.cf-user-mini { display: flex; align-items: center; gap: 8px; background: var(--cf-card); border: 1px solid var(--cf-border); padding: 6px 12px 6px 6px; border-radius: 999px; cursor: pointer; font: inherit; color: inherit; }
.cf-user-mini:hover { background: var(--cf-bg); }
.cf-user-mini-info { display: flex; flex-direction: column; line-height: 1.3; }
.cf-user-mini-info strong { font-size: 13px; }
.cf-staff-pill { background: #FEF3C7; color: #92400E; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }

.cf-avatar-sm { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.cf-avatar-md { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

.cf-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 4px; white-space: nowrap; }

/* ---------- Barra de progreso de medalla ---------- */
.cf-progress-bar { position: relative; background: var(--cf-border); border-radius: 999px; height: 22px; margin: 6px 4px 14px; overflow: hidden; }
.cf-progress-fill { background: linear-gradient(90deg, var(--cf-accent), #FBBF24); height: 100%; transition: width .3s; }
.cf-progress-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--cf-text); }

/* ---------- Composer (nueva consulta) ---------- */
.cf-composer { display: flex; gap: 10px; background: var(--cf-card); border: 1px solid var(--cf-border); border-radius: var(--cf-radius); padding: 14px; margin: 0 4px 16px; }
.cf-composer form { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.cf-composer textarea { width: 100%; border: 1px solid var(--cf-border); border-radius: 12px; padding: 10px 12px; font-size: 14px; resize: vertical; background: var(--cf-bg); outline: none; font-family: inherit; }
.cf-composer textarea:focus { border-color: var(--cf-primary); }
.cf-composer-actions { display: flex; justify-content: space-between; align-items: center; }

.cf-editor-toolbar { display: flex; gap: 8px; }
.cf-emoji-toggle, .cf-img-btn { background: var(--cf-bg); border: 1px solid var(--cf-border); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 16px; }
.cf-img-preview img { max-width: 140px; border-radius: 8px; margin-top: 6px; display: block; }
.cf-emoji-picker { display: none; flex-wrap: wrap; gap: 4px; background: var(--cf-bg); border: 1px solid var(--cf-border); border-radius: 10px; padding: 8px; max-width: 260px; position: relative; z-index: 5; }
.cf-emoji-picker.open { display: flex; }
.cf-emoji-picker span { cursor: pointer; font-size: 18px; padding: 4px; border-radius: 6px; }
.cf-emoji-picker span:hover { background: var(--cf-border); }

/* ---------- Filtros del muro ---------- */
.cf-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 4px 16px; overflow-x: auto; padding-bottom: 2px; }
.cf-cat-btn { border: 1px solid var(--cf-border); background: var(--cf-card); padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--cf-muted); white-space: nowrap; }
.cf-cat-btn.active { background: var(--cf-primary); border-color: var(--cf-primary); color: #fff; }

/* ---------- Muro (feed) ---------- */
.cf-feed { display: flex; flex-direction: column; gap: 14px; padding: 0 4px 10px; }
.cf-loading, .cf-empty { text-align: center; color: var(--cf-muted); padding: 40px 0; font-size: 14px; }
.cf-feed-end { text-align: center; color: var(--cf-muted); font-size: 13px; padding: 20px 0 40px; }

.cf-comment-card {
	background: var(--cf-card); border: 1px solid var(--cf-border); border-radius: var(--cf-radius);
	padding: 16px; position: relative;
}
.cf-comment-card.cf-featured { border-color: var(--cf-accent); }
.cf-pin-tag { position: absolute; top: -10px; right: 14px; background: var(--cf-accent); color: #fff; font-size: 11px; padding: 2px 10px; border-radius: 999px; font-weight: 700; }
.cf-thread-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cf-thread-card-head > div:not(.cf-mod-actions) { display: flex; flex-direction: column; line-height: 1.4; }
.cf-thread-time { margin-left: auto; font-size: 12px; color: var(--cf-muted); white-space: nowrap; }
.cf-comment-content { margin: 6px 0; font-size: 15px; line-height: 1.55; white-space: pre-line; }
.cf-thread-img { max-width: 100%; border-radius: 10px; max-height: 320px; object-fit: cover; margin-bottom: 8px; }
.cf-comment-actions { display: flex; gap: 18px; align-items: center; margin-top: 6px; }
.cf-like-btn, .cf-reply-toggle-btn { background: none; border: none; cursor: pointer; font-size: 13px; color: var(--cf-muted); font-weight: 600; padding: 4px 0; }
.cf-like-btn.liked { color: #DC2626; }
.cf-mod-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cf-icon-btn { background: var(--cf-bg); border: 1px solid var(--cf-border); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; flex-shrink: 0; }

/* Botones de moderación: estilos forzados para que se vean bien pase lo que pase el tema */
.cf-mod-btn {
	display: inline-flex !important;
	align-items: center !important;
	gap: 4px !important;
	background: #FEF3C7 !important;
	color: #92400E !important;
	border: 1px solid #FDE68A !important;
	border-radius: 999px !important;
	padding: 5px 12px !important;
	font-size: 12px !important;
	line-height: 1.4 !important;
	font-weight: 700 !important;
	font-family: inherit !important;
	cursor: pointer !important;
	white-space: nowrap !important;
	box-shadow: none !important;
	text-shadow: none !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	opacity: 1 !important;
	visibility: visible !important;
	height: auto !important;
	width: auto !important;
}
.cf-mod-btn:hover { filter: brightness(0.96); }
.cf-mod-btn-on { background: var(--cf-accent) !important; color: #fff !important; border-color: var(--cf-accent) !important; }
.cf-mod-btn-danger { background: #FEE2E2 !important; color: #B91C1C !important; border-color: #FECACA !important; }
.cf-mod-btn-sm { padding: 4px 10px !important; font-size: 11px !important; }

/* ---------- Respuestas anidadas ---------- */
.cf-replies-block { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--cf-border); display: flex; flex-direction: column; gap: 10px; }
.cf-replies-block:empty { display: none; border: none; padding: 0; margin: 0; }
.cf-reply { display: flex; gap: 8px; padding-left: 6px; }
.cf-comment-body { background: var(--cf-bg); border-radius: 10px; padding: 10px 12px; flex: 1; }
.cf-comment-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 2px; }
.cf-comment-body p { margin: 3px 0; line-height: 1.5; font-size: 14px; }
.cf-comment-img { max-width: 200px; border-radius: 8px; margin-top: 6px; }
.cf-reply-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding-left: 6px; }
.cf-reply-form textarea { width: 100%; border: 1px solid var(--cf-border); border-radius: 10px; padding: 8px 10px; font-size: 13px; background: var(--cf-bg); font-family: inherit; resize: vertical; }

/* ---------- Chat flotante ---------- */
.cf-chat-widget { position: fixed; bottom: 20px; right: 20px; z-index: 9998; }
.cf-chat-toggle {
	width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
	background: linear-gradient(135deg, var(--cf-primary), #A855F7); color: #fff; font-size: 24px;
	box-shadow: 0 8px 24px rgba(124,58,237,.4); position: relative;
}
.cf-chat-dot { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; background: #22C55E; border-radius: 50%; border: 2px solid #fff; }
.cf-chat-panel {
	display: none; position: absolute; bottom: 68px; right: 0; width: 320px; max-width: 90vw;
	background: var(--cf-card); border-radius: var(--cf-radius); box-shadow: 0 12px 40px rgba(0,0,0,.2);
	overflow: hidden; border: 1px solid var(--cf-border); flex-direction: column; height: 420px; max-height: 70vh;
}
.cf-chat-panel.open { display: flex; }
.cf-chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--cf-bg); border-bottom: 1px solid var(--cf-border); }
.cf-chat-admin-info { display: flex; align-items: center; gap: 8px; }
.cf-chat-admin-info small { color: var(--cf-muted); }
.cf-modal-close { background: var(--cf-bg); border: none; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.cf-chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cf-chat-msg { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 13px; position: relative; }
.cf-chat-msg.mine { align-self: flex-end; background: var(--cf-primary); color: #fff; border-bottom-right-radius: 2px; }
.cf-chat-msg.theirs { align-self: flex-start; background: var(--cf-bg); border-bottom-left-radius: 2px; }
.cf-chat-time { display: block; font-size: 10px; opacity: .7; margin-top: 2px; }
.cf-chat-user-item { display: flex; align-items: center; gap: 8px; padding: 8px; cursor: pointer; border-radius: 8px; }
.cf-chat-user-item:hover { background: var(--cf-bg); }
#cf-chat-form { display: flex; border-top: 1px solid var(--cf-border); }
#cf-chat-form input { flex: 1; border: none; padding: 12px 14px; outline: none; font-size: 13px; }
#cf-chat-form button { background: var(--cf-primary); color: #fff; border: none; width: 46px; cursor: pointer; font-size: 16px; }

/* ---------- Toast de puntos ---------- */
.cf-toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-20px); background: var(--cf-text); color: #fff; padding: 10px 20px; border-radius: 999px; font-size: 13px; font-weight: 600; z-index: 99999; opacity: 0; transition: all .3s ease; pointer-events: none; }
.cf-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Base de modales (auth / cuenta / perfil) ---------- */
.cf-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(17,10,35,.55); z-index: 99990; align-items: center; justify-content: center; padding: 16px; }
.cf-modal-overlay.open { display: flex; }
.cf-modal { background: var(--cf-card); border-radius: var(--cf-radius); width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; padding: 28px 26px; position: relative; }
.cf-modal .cf-modal-close { position: absolute; top: 14px; right: 14px; }

/* ---------- Banner para invitados ---------- */
.cf-guest-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: linear-gradient(135deg, #FDF4FF, #F3E8FF); border: 1px solid var(--cf-border); border-radius: var(--cf-radius); padding: 14px 16px; margin: 0 4px 16px; font-size: 13px; }
.cf-guest-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cf-guest-reply-prompt { font-size: 13px; color: var(--cf-muted); margin: 6px 0 0; }
.cf-link-btn { background: none; border: none; color: var(--cf-primary); font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; font-size: inherit; }

/* ---------- Mi cuenta / Perfil público ---------- */
.cf-account-modal-inner h3, .cf-profile-modal-inner h3 { margin: 0 0 14px; text-align: center; }
.cf-account-stats { display: flex; justify-content: center; gap: 18px; margin: 14px 0; flex-wrap: wrap; }
.cf-account-stat { text-align: center; font-size: 12px; color: var(--cf-muted); min-width: 60px; }
.cf-account-stat strong { display: block; font-size: 18px; color: var(--cf-text); }
.cf-field-hint { color: var(--cf-muted); font-size: 11px; margin-top: 4px; display: block; }
.cf-public-profile { text-align: center; }
.cf-avatar-lg { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid var(--cf-border); }
.cf-public-profile h3 { margin: 10px 0 4px; }
.cf-profile-since { color: var(--cf-muted); font-size: 12px; margin-top: 12px; }

/* ---------- Usuarios clicables (autor de comentario/respuesta) ---------- */
.cf-user-link { cursor: pointer; display: inline-flex; align-items: center; }
.cf-thread-card-head .cf-user-link:nth-of-type(2) strong,
.cf-comment-head .cf-user-link strong { transition: color .15s; }
.cf-thread-card-head .cf-user-link strong:hover,
.cf-comment-head .cf-user-link strong:hover { color: var(--cf-primary); text-decoration: underline; }

/* ---------- Chat: pestañas, volver, disponibilidad, avisos ---------- */
.cf-chat-head-left { display: flex; align-items: center; gap: 8px; }
.cf-chat-head-right { display: flex; align-items: center; gap: 8px; }
.cf-chat-back { background: var(--cf-bg); border: 1px solid var(--cf-border); border-radius: 50%; width: 28px; height: 28px; cursor: pointer; font-size: 15px; }
.cf-chat-tabs { display: flex; border-bottom: 1px solid var(--cf-border); }
.cf-chat-tab-btn { flex: 1; background: none; border: none; padding: 9px 6px; font-size: 12px; font-weight: 700; color: var(--cf-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.cf-chat-tab-btn.active { color: var(--cf-primary); border-bottom-color: var(--cf-primary); }
.cf-online-toggle-pill { border: 1px solid var(--cf-border); background: var(--cf-bg); color: var(--cf-muted); border-radius: 999px; padding: 5px 10px; font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.cf-online-toggle-pill.is-on { background: #DCFCE7; color: #15803D; border-color: #86EFAC; }
.cf-chat-badge { position: absolute; top: 2px; right: 2px; background: #DC2626; color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid #fff; }
.cf-online-dot { width: 9px; height: 9px; border-radius: 50%; background: #22C55E; display: inline-block; margin-left: auto; flex-shrink: 0; }
.cf-unread-dot { background: #DC2626; }
.cf-chat-user-item { position: relative; }
.cf-chat-empty-msg { padding: 20px 12px; color: var(--cf-muted); font-size: 13px; text-align: center; }

/* ---------- Chat general (mensajes con autor visible, se autolimpian) ---------- */
.cf-chat-general-note { font-size: 11px; color: var(--cf-muted); text-align: center; padding: 6px 10px 0; margin: 0; font-style: italic; }
.cf-chat-msg.cf-chat-msg-general { max-width: 100%; align-self: stretch; background: var(--cf-bg); border-radius: 10px; }
.cf-chat-msg.cf-chat-msg-general.mine { background: #F3E8FF; }
.cf-chat-msg-head { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; font-size: 11px; }
.cf-chat-msg-head strong { font-size: 12px; }
.cf-chat-msg-head .cf-badge { font-size: 9px; padding: 1px 6px; margin-left: 0; }
.cf-avatar-xs { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.cf-chat-msg-text { font-size: 13px; line-height: 1.45; }

/* ---------- Interruptor de notificaciones (en Mi cuenta) ---------- */
.cf-notif-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--cf-border); margin-top: 18px; padding-top: 16px; }
.cf-notif-toggle-row strong { font-size: 13px; display: block; }
.cf-switch { width: 44px; height: 24px; border-radius: 999px; background: var(--cf-border); border: none; position: relative; cursor: pointer; flex-shrink: 0; transition: background .2s; }
.cf-switch-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.cf-switch.is-on { background: var(--cf-primary); }
.cf-switch.is-on .cf-switch-knob { transform: translateX(20px); }

/* ---------- Toast de notificación (respuesta / mensaje nuevo) ---------- */
.cf-notif-toast { position: fixed; bottom: 90px; right: 20px; max-width: 300px; background: var(--cf-card); border: 1px solid var(--cf-border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 12px 14px; z-index: 99997; opacity: 0; transform: translateY(10px); transition: all .25s ease; cursor: pointer; }
.cf-notif-toast.show { opacity: 1; transform: translateY(0); }
.cf-notif-toast strong { display: block; font-size: 13px; margin-bottom: 2px; }
.cf-notif-toast span { font-size: 12px; color: var(--cf-muted); }

/* ---------- Responsive móvil ---------- */
@media (max-width: 600px) {
	#cf-app, .cf-auth-wrap { padding: 0 4px; }
	.cf-topbar { padding: 10px 2px; }
	.cf-logo { font-size: 17px; }
	.cf-user-mini-info strong { font-size: 12px; }
	.cf-composer { flex-direction: column; }
	.cf-comment-content { font-size: 14px; }
	.cf-modal { padding: 20px 16px; max-height: 95vh; }
	.cf-chat-panel { width: 92vw; right: -6px; height: 65vh; }
	.cf-chat-widget { bottom: 14px; right: 14px; }
	.cf-auth-card { padding: 22px; }
	.cf-guest-banner { flex-direction: column; align-items: stretch; text-align: center; }
}

