/* ==========================================================================
   One Clean Solution (v2) - WYSIWYG Admin Mode Styles
   ========================================================================== */

/* --- Floating Entry Pill (Visitor View) --- */
.ocs-admin-launcher {
  position: fixed;
  bottom: 78px;
  right: 20px;
  z-index: 9990;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #0F172A;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.28);
  transition: transform 0.2s ease, background 0.2s ease;
}

.ocs-admin-launcher:hover {
  transform: translateY(-2px);
  background: #1E293B;
}

body.admin-mode .ocs-admin-launcher {
  display: none;
}

/* --- Top Admin Toolbar --- */
body.admin-mode {
  padding-top: 56px;
}

body.admin-mode #header {
  top: 56px;
}

.ocs-admin-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 10000;
  background: #0F172A;
  color: #F8FAFC;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.ocs-admin-bar-left,
.ocs-admin-bar-center,
.ocs-admin-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ocs-admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #FFFFFF;
  padding-right: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

.ocs-admin-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
}

.ocs-admin-dot.unsaved {
  background: #F59E0B;
}

.ocs-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #F8FAFC;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ocs-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
}

.ocs-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ocs-btn-primary {
  background: #2563EB;
  border-color: #2563EB;
  color: #FFFFFF;
}

.ocs-btn-primary:hover:not(:disabled) {
  background: #1D4ED8;
}

.ocs-btn-teal {
  background: #0D8B7D;
  border-color: #0D8B7D;
  color: #FFFFFF;
}

.ocs-btn-teal:hover:not(:disabled) {
  background: #0B7468;
}

.ocs-btn-danger {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.4);
  color: #FCA5A5;
}

.ocs-btn-danger:hover:not(:disabled) {
  background: #DC2626;
  color: #FFFFFF;
}

.ocs-btn.active {
  background: #10B981;
  border-color: #10B981;
  color: #FFFFFF;
}

@media (max-width: 1024px) {
  .ocs-admin-bar {
    overflow-x: auto;
  }
}

/* --- Section Controls & Outlines (Edit Mode) --- */
body.admin-mode:not(.admin-preview) #page-sections > section {
  position: relative;
  outline: 2px dashed transparent;
  outline-offset: -2px;
  transition: outline-color 0.15s ease;
}

body.admin-mode:not(.admin-preview) #page-sections > section:hover {
  outline-color: rgba(37, 99, 235, 0.55);
}

.ocs-section-toolbar {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 900;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  background: #0F172A;
  color: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
}

body.admin-mode:not(.admin-preview) #page-sections > section:hover > .ocs-section-toolbar,
body.admin-mode:not(.admin-preview) #page-sections > section:focus-within > .ocs-section-toolbar {
  display: flex;
}

.ocs-section-badge {
  font-weight: 700;
  color: #93C5FD;
  padding: 0 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  margin-right: 2px;
}

.ocs-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border: none;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  color: #F8FAFC;
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.ocs-mini-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.ocs-mini-btn.add {
  background: #0D8B7D;
  color: #FFFFFF;
}

.ocs-mini-btn.add:hover {
  background: #0B7468;
}

.ocs-mini-btn.del:hover {
  background: #DC2626;
  color: #FFFFFF;
}

/* --- Item Controls & Outlines --- */
body.admin-mode:not(.admin-preview) [data-item] {
  position: relative;
}

body.admin-mode:not(.admin-preview) [data-item]:hover {
  outline: 1.5px dashed rgba(13, 139, 125, 0.75);
  outline-offset: 2px;
}

.ocs-item-toolbar {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 950;
  display: none;
  align-items: center;
  gap: 3px;
  padding: 3px 5px;
  background: #0D8B7D;
  color: #FFFFFF;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  font-family: 'Inter', sans-serif;
}

/* For compact inline items like nav links or bullets, keep toolbar compact */
li[data-item] > .ocs-item-toolbar {
  top: -24px;
  right: 0;
}

body.admin-mode:not(.admin-preview) [data-item]:hover > .ocs-item-toolbar,
body.admin-mode:not(.admin-preview) [data-item]:focus-within > .ocs-item-toolbar {
  display: flex;
}

.ocs-item-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ocs-item-btn:hover {
  background: rgba(255, 255, 255, 0.32);
}

.ocs-item-btn.del:hover {
  background: #DC2626;
}

/* --- Inline Editable Text --- */
body.admin-mode:not(.admin-preview) [data-editable]:hover {
  background-color: rgba(37, 99, 235, 0.06);
  border-radius: 4px;
}

body.admin-mode:not(.admin-preview) [data-editable]:focus {
  outline: 2px solid #2563EB;
  outline-offset: 2px;
  background-color: rgba(37, 99, 235, 0.08);
  border-radius: 4px;
}

body.admin-mode:not(.admin-preview) [data-editable-img],
body.admin-mode:not(.admin-preview) [data-editable-icon] {
  cursor: pointer;
  position: relative;
}

body.admin-mode:not(.admin-preview) [data-editable-img]:hover,
body.admin-mode:not(.admin-preview) [data-editable-icon]:hover {
  outline: 2px solid #F59E0B;
  outline-offset: 2px;
}

/* --- Add Section Bottom Dropzone --- */
.ocs-add-section-zone {
  padding: 28px 24px;
  text-align: center;
  background: #F1F5F9;
  border-top: 2px dashed #CBD5E1;
  border-bottom: 2px dashed #CBD5E1;
}

body.admin-preview .ocs-add-section-zone {
  display: none;
}

/* --- Rich Text Floating Toolbar --- */
.ocs-rte-toolbar {
  position: fixed;
  z-index: 10050;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  background: #1E293B;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.ocs-rte-toolbar.open {
  display: flex;
}

.ocs-rte-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #F8FAFC;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.ocs-rte-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* --- Modals (Section Library & Property Inspector) --- */
.ocs-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10100;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ocs-modal-backdrop.open {
  display: flex;
}

.ocs-modal {
  background: #FFFFFF;
  color: #0F172A;
  width: 100%;
  max-width: 760px;
  max-height: 86vh;
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
}

.ocs-modal.sm {
  max-width: 480px;
}

.ocs-modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ocs-modal-header h3 {
  font-size: 18px;
  margin: 0;
}

.ocs-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #F1F5F9;
  color: #334155;
  font-size: 18px;
  cursor: pointer;
}

.ocs-modal-close:hover {
  background: #E2E8F0;
}

.ocs-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.ocs-template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 680px) {
  .ocs-template-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.ocs-template-card {
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  padding: 16px;
  text-align: left;
  background: #F8FAFC;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.ocs-template-card:hover {
  border-color: #2563EB;
  background: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.ocs-template-card h4 {
  font-size: 14.5px;
  margin-bottom: 4px;
  color: #0F172A;
}

.ocs-template-card p {
  font-size: 12.5px;
  color: #64748B;
  margin: 0;
  line-height: 1.45;
}

.ocs-field {
  margin-bottom: 14px;
}

.ocs-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.ocs-field input[type="text"],
.ocs-field input[type="url"],
.ocs-field select,
.ocs-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.ocs-icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.ocs-icon-choice {
  height: 44px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #0F172A;
}

.ocs-icon-choice:hover,
.ocs-icon-choice.selected {
  border-color: #2563EB;
  background: #EFF6FF;
  color: #2563EB;
}

.ocs-icon-choice svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ocs-modal-footer {
  padding: 14px 22px;
  border-top: 1px solid #E2E8F0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- Toast Notification --- */
.ocs-toast {
  position: fixed;
  bottom: 78px;
  left: 20px;
  z-index: 10200;
  background: #0F172A;
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ocs-toast.show {
  opacity: 1;
  transform: translateY(0);
}
