/* ---------- PRIMAL CMS Styles ---------- */

/* Barra Superior de Administrador */
#cmsAdminBar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 52px;
  background: #18181b;
  color: #f4f4f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 99999;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.88rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid #e15e3d;
}

body.cms-active {
  padding-top: 52px !important;
}

.cms-brand-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
}

.cms-brand-badge .pulse-dot {
  width: 9px;
  height: 9px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
}

.cms-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cms-btn {
  background: #27272a;
  color: #fff;
  border: 1px solid #3f3f46;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}

.cms-btn:hover {
  background: #3f3f46;
  border-color: #52525b;
}

.cms-btn-primary {
  background: #e15e3d;
  border-color: #e15e3d;
  color: #ffffff;
  font-weight: 600;
}

.cms-btn-primary:hover {
  background: #c24a2c;
  border-color: #c24a2c;
}

.cms-btn-danger {
  background: #ef4444;
  border-color: #ef4444;
}

.cms-btn-danger:hover {
  background: #dc2626;
}

/* Botón flotante para Iniciar Sesión CMS */
#cmsTriggerBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  background: #18181b;
  color: #ffffff;
  border: 1px solid #3f3f46;
  padding: 0.55rem 1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

#cmsTriggerBtn:hover {
  transform: translateY(-2px);
  background: #27272a;
  border-color: #e15e3d;
}

/* Resaltado de Elementos Editables cuando el CMS está activo */
body.cms-editing [data-cms-key] {
  outline: 2px dashed rgba(225, 94, 61, 0.4);
  outline-offset: 4px;
  cursor: pointer;
  transition: outline 0.15s ease, background-color 0.15s ease;
  position: relative;
}

body.cms-editing [data-cms-key]:hover {
  outline: 2px solid #e15e3d;
  background-color: rgba(225, 94, 61, 0.05);
}

body.cms-editing [data-cms-key][contenteditable="true"] {
  outline: 2px solid #e15e3d !important;
  background-color: rgba(255, 255, 255, 0.9) !important;
  color: #121212 !important;
  padding: 2px 4px;
  border-radius: 4px;
}

body.cms-editing [data-cms-image-key] {
  position: relative;
  cursor: pointer;
  outline: 2px dashed #e15e3d;
}

/* Modales CMS */
.cms-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.cms-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.cms-modal-card {
  background: #ffffff;
  color: #18181b;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  position: relative;
  transform: translateY(10px);
  transition: transform 0.2s ease;
  font-family: system-ui, -apple-system, sans-serif;
}

.cms-modal-overlay.active .cms-modal-card {
  transform: translateY(0);
}

.cms-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.cms-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #18181b;
}

.cms-modal-close {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #71717a;
}

.cms-form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cms-form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #3f3f46;
}

.cms-form-group input,
.cms-form-group textarea,
.cms-form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

.cms-form-group input:focus,
.cms-form-group textarea:focus {
  outline: none;
  border-color: #e15e3d;
  box-shadow: 0 0 0 3px rgba(225, 94, 61, 0.15);
}

.cms-toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: #18181b;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid #3f3f46;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  z-index: 100001;
  opacity: 0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cms-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.cms-img-upload-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #f4f4f5;
  border: 1px dashed #d4d4d8;
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.25rem;
}

.cms-file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: #27272a;
  color: #ffffff;
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  width: fit-content;
}

.cms-file-btn:hover {
  background: #3f3f46;
}

.cms-img-preview {
  position: relative;
  width: 100%;
  max-height: 140px;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e4e4e7;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.cms-img-preview img {
  max-width: 100%;
  max-height: 130px;
  object-fit: contain;
  border-radius: 4px;
}

.cms-img-preview .cms-remove-img {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.cms-edit-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #e15e3d;
  color: #ffffff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 10;
  pointer-events: none;
}
