/* ============================================
   UBANTU FOUNDATION — VISUAL EDITOR STYLES
   ============================================ */

/* ===== EDITOR TOOLBAR (top bar) ===== */
#ub-editor-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: #1a1a2e;
  border-bottom: 2px solid #B5563E;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 99999;
  font-family: 'Outfit', sans-serif;
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}

.ub-bar-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.ub-logo {
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.ub-bar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ===== ADMIN BADGE ===== */
.ub-admin-badge {
  color: rgba(255,255,255,0.55);
  font-size: 0.78rem;
  font-weight: 500;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ===== LOGOUT BUTTON ===== */
.ub-btn-logout {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.12);
}
.ub-btn-logout:hover {
  background: rgba(220,53,69,0.2);
  color: #ff8a94;
  border-color: rgba(220,53,69,0.35);
}

/* ===== ADMIN LOGIN LINK (shown to non-admins in nav) ===== */
.nav-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.45) !important;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 0.3rem 0.85rem !important;
  transition: all 0.2s;
  letter-spacing: 0.03em;
  text-decoration: none;
}
.nav-admin-link:hover {
  color: #fff !important;
  border-color: #B5563E;
  background: rgba(181,86,62,0.15);
}

/* ===== TOGGLE SWITCH ===== */
.ub-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
}
.ub-toggle-wrap input { display: none; }
.ub-toggle-track {
  width: 44px;
  height: 24px;
  background: #444;
  border-radius: 50px;
  position: relative;
  transition: background 0.3s;
}
.ub-toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}
.ub-toggle-wrap input:checked ~ .ub-toggle-track { background: #B5563E; }
.ub-toggle-wrap input:checked ~ .ub-toggle-track .ub-toggle-thumb { transform: translateX(20px); }
.ub-toggle-label {
  color: rgba(255,255,255,0.75);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ===== BUTTONS ===== */
.ub-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
}
.ub-btn-primary {
  background: #B5563E;
  color: #fff;
}
.ub-btn-primary:hover { background: #8B3A26; transform: translateY(-1px); }
.ub-btn-ghost {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.15);
}
.ub-btn-ghost:hover { background: rgba(255,255,255,0.15); }
.ub-btn-danger {
  background: rgba(220,53,69,0.15);
  color: #ff6b7a;
  border: 1px solid rgba(220,53,69,0.3);
}
.ub-btn-danger:hover { background: rgba(220,53,69,0.3); }
.ub-full { width: 100%; text-align: center; padding: 0.65rem; font-size: 0.88rem; margin-top: 0.5rem; }

/* ===== EDITABLE ELEMENT HIGHLIGHTS ===== */
.ub-edit-active .ub-editable {
  outline: 2px dashed rgba(181,86,62,0.4);
  outline-offset: 3px;
  cursor: pointer !important;
  transition: outline 0.2s;
  border-radius: 3px;
}
.ub-edit-active .ub-editable:hover {
  outline: 2px solid #B5563E;
  background: rgba(181,86,62,0.06);
}
.ub-edit-active .ub-selected {
  outline: 2px solid #B5563E !important;
  background: rgba(181,86,62,0.1) !important;
}

/* ===== FLOATING EDITOR PANEL ===== */
#ub-panel {
  position: fixed;
  top: 72px;
  right: -340px;
  width: 320px;
  max-height: calc(100vh - 80px);
  background: #fff;
  border-radius: 12px 0 0 12px;
  box-shadow: -4px 0 32px rgba(0,0,0,0.15);
  z-index: 99998;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Outfit', sans-serif;
  overflow: hidden;
  border: 1px solid #e8d5c4;
  border-right: none;
}
#ub-panel.open { right: 0; }

.ub-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #1a1a2e;
  color: #fff;
  flex-shrink: 0;
}
#ub-panel-title {
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
}
.ub-panel-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.ub-panel-close:hover { background: #B5563E; }

.ub-panel-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

/* ===== PANEL FIELDS ===== */
.ub-field {
  margin-bottom: 1.1rem;
}
.ub-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #3D2B1F;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}
.ub-field code {
  background: #f2e6d9;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #B5563E;
}
.ub-field input[type="text"],
.ub-field input[type="number"],
.ub-field textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 2px solid #e8d5c4;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  color: #2C1A0E;
  background: #fdfaf7;
  transition: border-color 0.2s;
  resize: vertical;
}
.ub-field input:focus,
.ub-field textarea:focus {
  outline: none;
  border-color: #B5563E;
  box-shadow: 0 0 0 3px rgba(181,86,62,0.12);
}
.ub-field input[type="color"] {
  width: 40px; height: 36px;
  border: 2px solid #e8d5c4;
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: #fdfaf7;
}
.ub-field input[type="range"] {
  flex: 1;
  accent-color: #B5563E;
}
.ub-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.ub-row span {
  font-size: 0.8rem;
  color: #7A6055;
  min-width: 36px;
}

/* ALIGN BUTTONS */
.ub-align-btns {
  display: flex;
  gap: 0.4rem;
}
.ub-align-btn {
  flex: 1;
  padding: 0.4rem;
  border: 2px solid #e8d5c4;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #7A6055;
  background: #fdfaf7;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
}
.ub-align-btn:hover {
  border-color: #B5563E;
  color: #B5563E;
  background: #f2e6d9;
}

/* QUICK IMAGE PICKS */
.ub-quick-imgs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}
.ub-quick-imgs img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.ub-quick-imgs img:hover {
  border-color: #B5563E;
  transform: scale(1.04);
}

/* ===== IMAGE EDITOR TABS ===== */
.ub-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  background: #f5ede6;
  border-radius: 8px;
  padding: 0.25rem;
}
.ub-tab {
  flex: 1;
  padding: 0.4rem 0.3rem;
  border: none;
  border-radius: 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: #7A6055;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.ub-tab.active {
  background: #fff;
  color: #B5563E;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.ub-tab:hover:not(.active) { color: #B5563E; }

.ub-tab-panel { display: none; }
.ub-tab-panel.active { display: block; }

/* ===== DRAG & DROP DROPZONE ===== */
.ub-dropzone {
  border: 2px dashed #e8d5c4;
  border-radius: 10px;
  background: #fdfaf7;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  cursor: pointer;
  overflow: hidden;
}
.ub-dropzone.ub-drag-over {
  border-color: #B5563E;
  background: rgba(181,86,62,0.06);
}
.ub-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem;
  text-align: center;
}
.ub-drop-icon { font-size: 1.8rem; line-height: 1; }
.ub-dropzone-inner p {
  font-size: 0.8rem;
  color: #7A6055;
  margin: 0;
  font-weight: 500;
}
.ub-dropzone-inner span {
  font-size: 0.72rem;
  color: #b0a09a;
}
.ub-upload-label {
  font-size: 0.78rem !important;
  padding: 0.35rem 0.9rem !important;
  cursor: pointer;
  margin-top: 0.1rem;
}

/* ===== UPLOAD PROGRESS ===== */
.ub-upload-progress {
  width: 100%;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}
.ub-progress-bar {
  width: 100%;
  height: 6px;
  background: #e8d5c4;
  border-radius: 50px;
  overflow: hidden;
}
.ub-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #B5563E, #e07a5f);
  border-radius: 50px;
  transition: width 0.1s linear;
}
#ub-progress-label {
  font-size: 0.78rem;
  color: #7A6055;
  font-weight: 500;
}

/* HINT TEXT */
.ub-hint {
  color: #7A6055;
  font-size: 0.85rem;
  text-align: center;
  padding: 1.5rem 0;
  line-height: 1.6;
}

/* ===== TOAST NOTIFICATION ===== */
#ub-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a1a2e;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 999999;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  pointer-events: none;
}
#ub-toast.ub-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#ub-toast.ub-toast-warn {
  background: #B5563E;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  #ub-editor-bar { padding: 0 0.75rem; }
  .ub-logo { display: none; }
  #ub-panel { width: 290px; }
  .ub-btn-ghost { display: none; }
}