/* ==========================================================================
   HOMME SMART HOME — LIVE VISUAL CMS & IN-PLACE CONTENT EDITOR
   Architecture: Non-Intrusive Floating Glass Dock, Inline Text Editing,
   Live Image Replacer & Dynamic Header Navigation Builder
   ========================================================================== */

/* 1. FLOATING CONTROL DOCK */
.homme-editor-dock {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(8, 16, 28, 0.88);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(0, 229, 212, 0.35);
  border-radius: var(--radius-pill, 9999px);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.65), 0 0 25px rgba(0, 229, 212, 0.25);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  direction: rtl;
  font-family: inherit;
}

[data-theme="light"] .homme-editor-dock {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(0, 180, 216, 0.35);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.15), 0 0 20px rgba(0, 180, 216, 0.2);
}

.homme-editor-dock.collapsed {
  padding: 6px 16px;
  gap: 8px;
}

/* Toggle Pill Trigger */
.editor-btn-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(0, 229, 212, 0.15) 0%, rgba(34, 211, 238, 0.05) 100%);
  border: 1px solid rgba(0, 229, 212, 0.4);
  border-radius: var(--radius-pill, 9999px);
  color: #00e5d4;
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

[data-theme="light"] .editor-btn-trigger {
  background: linear-gradient(135deg, rgba(0, 180, 216, 0.12) 0%, rgba(2, 132, 199, 0.05) 100%);
  border-color: rgba(0, 180, 216, 0.4);
  color: #0284c7;
}

.editor-btn-trigger:hover {
  background: linear-gradient(135deg, #00e5d4 0%, #22d3ee 100%);
  color: #03060a;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 229, 212, 0.4);
}

.editor-btn-trigger.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: #34d399;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

/* Expanded Action Items */
.editor-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-pill, 9999px);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

[data-theme="light"] .editor-btn-action {
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(15, 23, 42, 0.04);
  color: #1e293b;
}

.editor-btn-action:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

[data-theme="light"] .editor-btn-action:hover {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.2);
}

/* Save Button */
.editor-btn-save {
  background: linear-gradient(135deg, #00e5d4 0%, #0891b2 100%);
  color: #03080e !important;
  border-color: transparent !important;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(0, 229, 212, 0.35);
}

.editor-btn-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 229, 212, 0.6);
  filter: brightness(1.1);
}

.editor-btn-save.has-changes {
  animation: pulseSaveBtn 1.8s infinite;
}

@keyframes pulseSaveBtn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 229, 212, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(0, 229, 212, 0); }
}

.editor-badge-counter {
  background: #f43f5e;
  color: #fff;
  border-radius: 9999px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 900;
}

/* 2. EDITABLE ELEMENTS VISUAL HINTS (ONLY ACTIVE DURING EDIT MODE) */
body.homme-edit-mode-active [data-homme-editable] {
  outline: 1.5px dashed rgba(0, 229, 212, 0.45);
  outline-offset: 4px;
  border-radius: 4px;
  cursor: text !important;
  transition: outline 0.2s ease, background-color 0.2s ease;
  min-width: 1ch;
}

[data-theme="light"] body.homme-edit-mode-active [data-homme-editable] {
  outline-color: rgba(0, 180, 216, 0.55);
}

body.homme-edit-mode-active [data-homme-editable]:hover {
  outline: 1.5px dashed #00e5d4;
  background-color: rgba(0, 229, 212, 0.08) !important;
}

[data-theme="light"] body.homme-edit-mode-active [data-homme-editable]:hover {
  outline-color: #00b4d8;
  background-color: rgba(0, 180, 216, 0.08) !important;
}

body.homme-edit-mode-active [data-homme-editable]:focus {
  outline: 2px solid #00e5d4 !important;
  background-color: rgba(0, 229, 212, 0.12) !important;
  box-shadow: 0 0 15px rgba(0, 229, 212, 0.3);
}

[data-theme="light"] body.homme-edit-mode-active [data-homme-editable]:focus {
  outline-color: #00b4d8 !important;
  box-shadow: 0 0 15px rgba(0, 180, 216, 0.3);
}

/* 3. BUTTONS EDITING HINTS */
body.homme-edit-mode-active .btn-primary-glow,
body.homme-edit-mode-active .btn-secondary-glass,
body.homme-edit-mode-active .btn-dock-cta,
body.homme-edit-mode-active .btn-add-cart,
body.homme-edit-mode-active .filter-pill-btn,
body.homme-edit-mode-active .auth-submit-btn {
  cursor: pointer;
  position: relative;
}

/* 4. IMAGES EDITING BADGE */
.homme-img-edit-wrap {
  position: relative;
  display: inline-block;
}

body.homme-edit-mode-active .homme-img-edit-wrap {
  outline: 1.5px dashed rgba(34, 211, 238, 0.5);
  outline-offset: 4px;
  border-radius: 8px;
}

.homme-img-edit-trigger {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 40;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(3, 6, 10, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid #00e5d4;
  border-radius: var(--radius-pill, 9999px);
  color: #00e5d4;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  transition: all 0.2s ease;
}

[data-theme="light"] .homme-img-edit-trigger {
  background: rgba(255, 255, 255, 0.92);
  border-color: #00b4d8;
  color: #0284c7;
}

.homme-img-edit-trigger:hover {
  background: #00e5d4;
  color: #03060a;
  transform: scale(1.05);
}

body.homme-edit-mode-active .homme-img-edit-wrap:hover .homme-img-edit-trigger {
  display: inline-flex;
}

/* 5. HEADER NAV LINK EDITING CONTROLS */
body.homme-edit-mode-active .nav-menu li {
  position: relative;
}

.homme-nav-del-btn {
  display: none;
  position: absolute;
  top: -6px;
  left: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: none;
  font-size: 11px;
  font-weight: 900;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  z-index: 10;
  line-height: 1;
}

body.homme-edit-mode-active .nav-menu li:hover .homme-nav-del-btn {
  display: flex;
}

.homme-nav-add-btn {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #00e5d4;
  background: rgba(0, 229, 212, 0.08);
  border: 1px dashed rgba(0, 229, 212, 0.4);
  border-radius: var(--radius-pill, 9999px);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 6px;
}

body.homme-edit-mode-active .homme-nav-add-btn {
  display: inline-flex;
}

.homme-nav-add-btn:hover {
  background: rgba(0, 229, 212, 0.2);
  border-color: #00e5d4;
  transform: scale(1.04);
}

/* 6. MODAL DIALOG FOR IMAGE REPLACEMENT & NAV ITEM ADDITION */
.homme-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 10, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  direction: rtl;
}

.homme-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.homme-modal-box {
  width: 100%;
  max-width: 520px;
  background: rgba(10, 20, 34, 0.94);
  border: 1px solid rgba(0, 229, 212, 0.3);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(0, 229, 212, 0.15);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .homme-modal-box {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 180, 216, 0.25);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

.homme-modal-backdrop.open .homme-modal-box {
  transform: scale(1);
}

.homme-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .homme-modal-header {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

.homme-modal-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-white, #ffffff);
  margin: 0;
}

[data-theme="light"] .homme-modal-title {
  color: #0f172a;
}

.homme-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.homme-modal-close:hover {
  color: #ef4444;
}

.homme-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.homme-modal-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.homme-modal-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-secondary, #94a3b8);
}

.homme-modal-input {
  width: 100%;
  height: 46px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0 14px;
  color: #ffffff;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

[data-theme="light"] .homme-modal-input {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.15);
  color: #0f172a;
}

.homme-modal-input:focus {
  border-color: #00e5d4;
  box-shadow: 0 0 0 3px rgba(0, 229, 212, 0.2);
}

.homme-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.homme-btn-modal-cancel {
  padding: 9px 18px;
  border-radius: var(--radius-pill, 9999px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-weight: 700;
  cursor: pointer;
}

.homme-btn-modal-submit {
  padding: 9px 22px;
  border-radius: var(--radius-pill, 9999px);
  background: linear-gradient(135deg, #00e5d4 0%, #0891b2 100%);
  border: none;
  color: #03080e;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 229, 212, 0.35);
}

.homme-btn-modal-submit:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
