/* ==========================================================================
   LOVELY CMS - IN-PAGE VISUAL EDITOR STYLES
   ========================================================================== */

:root {
  --cms-primary: #e91e8c;
  --cms-primary-dark: #c0176e;
  --cms-accent: #ff4081;
  --cms-bg-dark: #1e1318;
  --cms-panel-bg: rgba(255, 255, 255, 0.98);
  --cms-border: #f48dc1;
  --cms-text: #2d1222;
  --cms-shadow: 0 10px 35px rgba(233, 30, 140, 0.22);
}

/* 1. TOP CMS TOOLBAR */
#lovely-cms-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  background: var(--cms-bg-dark);
  color: #fff;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Nunito", sans-serif;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  border-bottom: 2px solid var(--cms-primary);
  transform: translateY(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#lovely-cms-bar.active {
  transform: translateY(0);
}

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

body.cms-active .navbar {
  top: 54px !important;
}

.cms-bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.cms-brand-badge {
  background: var(--cms-primary);
  color: white;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 1px;
}

.cms-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cms-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: inherit;
  text-decoration: none;
}

.cms-btn-preview {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.cms-btn-preview:hover {
  background: rgba(255, 255, 255, 0.22);
}
.cms-btn-preview.active {
  background: #ffb300;
  color: #000;
}

.cms-btn-save {
  background: #25D366;
  color: white;
}
.cms-btn-save:hover {
  background: #1eb956;
  transform: translateY(-1px);
}

.cms-btn-publish {
  background: linear-gradient(135deg, #e91e8c, #ff4081);
  color: white;
  box-shadow: 0 2px 10px rgba(233, 30, 140, 0.4);
}
.cms-btn-publish:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.cms-btn-settings {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}
.cms-btn-settings:hover {
  background: rgba(255, 255, 255, 0.2);
}

.cms-btn-exit {
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
}
.cms-btn-exit:hover {
  color: #ff5252;
}

/* 2. EDITABLE ELEMENTS HIGHLIGHTING IN EDIT MODE */
body.cms-active:not(.cms-preview-mode) [data-cms] {
  position: relative;
  outline: 2px dashed rgba(233, 30, 140, 0.45);
  outline-offset: 3px;
  border-radius: 4px;
  cursor: pointer !important;
  transition: outline-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

body.cms-active:not(.cms-preview-mode) [data-cms]:hover {
  outline: 2px solid var(--cms-primary) !important;
  outline-offset: 4px;
  background-color: rgba(233, 30, 140, 0.06) !important;
  box-shadow: 0 0 14px rgba(233, 30, 140, 0.25);
}

body.cms-active:not(.cms-preview-mode) [data-cms]:hover::after {
  content: "✏️ " attr(data-cms-label);
  position: absolute;
  top: -24px;
  left: 4px;
  background: var(--cms-primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 3. MODAL / POPUP EDITOR */
.cms-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 5, 12, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.cms-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.cms-modal {
  background: #ffffff;
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--cms-shadow);
  border: 2px solid var(--cms-border);
  padding: 24px;
  font-family: 'Nunito', -apple-system, sans-serif;
  color: var(--cms-text);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cms-modal-overlay.active .cms-modal {
  transform: scale(1);
}

.cms-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #fce4f0;
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.cms-modal-header h3 {
  font-size: 1.15rem;
  color: var(--cms-primary-dark);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.cms-modal-close {
  background: #fce4f0;
  color: var(--cms-primary-dark);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  transition: all 0.2s;
}

.cms-modal-close:hover {
  background: var(--cms-primary);
  color: white;
}

.cms-form-group {
  margin-bottom: 16px;
}

.cms-form-label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: #4a2235;
  margin-bottom: 6px;
}

.cms-form-help {
  font-size: 0.75rem;
  color: #888;
  margin-top: 4px;
  line-height: 1.4;
}

.cms-input, .cms-textarea, .cms-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e2c0d5;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #333;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.cms-input:focus, .cms-textarea:focus, .cms-select:focus {
  outline: none;
  border-color: var(--cms-primary);
  box-shadow: 0 0 0 3px rgba(233, 30, 140, 0.15);
}

.cms-textarea {
  min-height: 100px;
  resize: vertical;
}

.cms-img-preview-box {
  background: #fdf5f9;
  border: 2px dashed #f48dc1;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  margin-bottom: 12px;
}

.cms-img-preview-box img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.cms-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #fce4f0;
}

.cms-modal-footer .cms-btn {
  padding: 10px 20px;
  font-size: 0.9rem;
}

/* 3.1. BOTÓN / TARJETA AÑADIR PRODUCTO (+) */
.cms-add-card {
  display: none;
  min-height: 380px;
  border: 3px dashed var(--cms-primary);
  border-radius: var(--border-radius, 20px);
  background: rgba(233, 30, 140, 0.03);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 20px;
  box-sizing: border-box;
}

body.cms-active:not(.cms-preview-mode) .cms-add-card {
  display: flex !important;
}

.cms-add-card:hover {
  background: rgba(233, 30, 140, 0.08);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(233, 30, 140, 0.22);
  border-color: var(--cms-primary-dark);
}

.cms-add-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--cms-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin: 0 auto 16px;
  box-shadow: 0 6px 20px rgba(233, 30, 140, 0.38);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cms-add-card:hover .cms-add-icon {
  transform: scale(1.15) rotate(90deg);
}

.cms-add-title {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--cms-primary-dark);
  margin-bottom: 6px;
}

.cms-add-desc {
  font-size: 0.85rem;
  color: #777;
  max-width: 220px;
  margin: 0 auto;
  line-height: 1.4;
}

/* 4. DISCREET ADMIN TRIGGER IN FOOTER */
.cms-admin-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem !important;
  color: rgba(255, 255, 255, 0.25) !important;
  text-decoration: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.cms-admin-trigger:hover {
  color: var(--cms-primary) !important;
  background: rgba(233, 30, 140, 0.1);
}

/* 5. TOAST NOTIFICATIONS */
.cms-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e1318;
  color: #fff;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 10000000;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  border-left: 4px solid var(--cms-primary);
  font-family: -apple-system, sans-serif;
}

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

.cms-toast.success { border-left-color: #25D366; }
.cms-toast.error { border-left-color: #ff334b; }
.cms-toast.info { border-left-color: #2196f3; }
