/* ==========================================================================
   MASTER PIECE — Frontend CMS Stylesheet (Luxury Dark Glassmorphism)
   ========================================================================== */

/* ===== FLOATING CMS DOCK ===== */
.cms-dock, .cms-modal, .cms-drawer, .cms-toast,
.cms-dock *, .cms-modal *, .cms-drawer *, .cms-toast * {
  cursor: auto !important;
}
.cms-btn, .cms-toggle-btn, .cms-dock-btn, .cms-btn-icon, .cms-modal-close, .cms-tab-btn, .cms-file-btn, .cms-preset-picker-btn, .cms-preset-thumb, .cms-add-card, .cms-inline-add-btn {
  cursor: pointer !important;
}
.cms-input, .cms-textarea, .cms-select {
  cursor: text !important;
}

.cms-dock {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(12, 12, 14, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 40px;
  padding: 8px 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  color: #fff;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.cms-dock:hover {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.7);
}

.cms-dock-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  padding-right: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.cms-dock-brand .cms-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #555;
  transition: background 0.3s, box-shadow 0.3s;
}

body.cms-edit-mode .cms-dock-brand .cms-dot {
  background: #00ff88;
  box-shadow: 0 0 10px #00ff88;
}

.cms-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}

.cms-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

body.cms-edit-mode .cms-toggle-btn {
  background: #ffffff;
  color: #0a0a0a;
  border-color: #ffffff;
  font-weight: 700;
}

.cms-dock-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #bbb;
  padding: 8px 14px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}

.cms-dock-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* ===== EDIT MODE HIGHLIGHTS & ACTION BADGES ===== */
body.cms-edit-mode [data-cms-editable] {
  position: relative;
  outline: 1.5px dashed rgba(0, 180, 255, 0.4);
  outline-offset: 4px;
  cursor: pointer !important;
  transition: outline-color 0.2s;
}

body.cms-edit-mode [data-cms-editable]:hover {
  outline-color: #00b4ff;
  background: rgba(0, 180, 255, 0.04);
}

/* Card action overlay buttons */
.cms-card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  display: none;
  gap: 6px;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(8px);
  padding: 4px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.cms-edit-mode .work-card:hover .cms-card-actions,
body.cms-edit-mode .work-full-card:hover .cms-card-actions,
body.cms-edit-mode .service-full-card:hover .cms-card-actions,
body.cms-edit-mode .client-logo-item:hover .cms-card-actions,
body.cms-edit-mode .timeline-item:hover .cms-card-actions,
body.cms-edit-mode .service-row:hover .cms-card-actions {
  display: flex !important;
}

.cms-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cms-btn-icon:hover {
  background: #fff;
  color: #000;
  transform: scale(1.1);
}

.cms-btn-icon.cms-btn-delete:hover {
  background: #ff4757;
  color: #fff;
}

/* + Add Buttons (Inline in sections) */
.cms-add-card {
  display: none;
  min-height: 280px;
  border: 2px dashed rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: #888;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 30px;
  text-align: center;
}

body.cms-edit-mode .cms-add-card {
  display: flex;
}

.cms-add-card:hover {
  border-color: #00ff88;
  color: #fff;
  background: rgba(0, 255, 136, 0.05);
  transform: translateY(-4px);
}

.cms-add-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 300;
  transition: all 0.3s ease;
}

.cms-add-card:hover .cms-add-card-icon {
  background: #00ff88;
  color: #000;
}

.cms-add-card-text {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Inline + Add Bar */
.cms-inline-add-bar {
  display: none;
  margin: 20px 0;
  text-align: center;
}

body.cms-edit-mode .cms-inline-add-bar {
  display: block;
}

.cms-inline-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #000;
  color: #00ff88;
  border: 1px dashed #00ff88;
  padding: 10px 24px;
  border-radius: 30px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
}

.cms-inline-add-btn:hover {
  background: #00ff88;
  color: #000;
  border-style: solid;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 255, 136, 0.3);
}

/* Client Logo wrapper in edit mode */
.client-logo-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

/* ===== CMS MODALS ===== */
.cms-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

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

.cms-modal {
  background: #111215;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.cms-modal-backdrop.open .cms-modal {
  transform: translateY(0) scale(1);
}

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

.cms-modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
  letter-spacing: 0.02em;
}

.cms-modal-close {
  background: transparent;
  border: none;
  color: #888;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.cms-modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.cms-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cms-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cms-form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cms-input,
.cms-select,
.cms-textarea {
  width: 100%;
  background: #181a1f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s;
  box-sizing: border-box;
}

.cms-input:focus,
.cms-select:focus,
.cms-textarea:focus {
  outline: none;
  border-color: #00ff88;
  box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.15);
  background: #1d2026;
}

.cms-textarea {
  min-height: 90px;
  resize: vertical;
  line-height: 1.5;
}

/* Image Upload Component */
.cms-image-uploader {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cms-image-preview-box {
  width: 100%;
  height: 160px;
  border-radius: 10px;
  background: #181a1f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cms-image-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0d0e11;
}

.cms-upload-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cms-file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.cms-file-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
}

.cms-preset-picker-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #aaa;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.cms-preset-picker-btn:hover {
  color: #fff;
  border-color: #fff;
}

/* Preset Gallery Grid */
.cms-preset-gallery {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 10px;
  background: #14161a;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.cms-preset-gallery.open {
  display: grid;
}

.cms-preset-thumb {
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: #000;
  transition: all 0.2s;
}

.cms-preset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cms-preset-thumb:hover {
  border-color: #00ff88;
  transform: scale(1.04);
}

.cms-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #0f1013;
  border-radius: 0 0 16px 16px;
}

.cms-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.cms-btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ccc;
}

.cms-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.cms-btn-primary {
  background: #00ff88;
  color: #000;
  font-weight: 700;
}

.cms-btn-primary:hover {
  background: #1aff96;
  box-shadow: 0 4px 16px rgba(0, 255, 136, 0.4);
  transform: translateY(-1px);
}

.cms-btn-danger {
  background: #ff4757;
  color: #fff;
}

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

/* ===== CMS DASHBOARD DRAWER ===== */
.cms-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.cms-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.cms-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 580px;
  background: #0f1115;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  color: #fff;
  z-index: 100001;
}

.cms-drawer-backdrop.open .cms-drawer {
  transform: translateX(0);
}

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

.cms-drawer-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cms-drawer-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 20px;
  background: #14171d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
}

.cms-tab-btn {
  padding: 8px 14px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: #888;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.cms-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.cms-tab-btn.active {
  color: #000;
  background: #00ff88;
  font-weight: 700;
}

.cms-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.cms-tab-pane {
  display: none;
}

.cms-tab-pane.active {
  display: block;
}

/* Manager List Items in Drawer */
.cms-list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.cms-drawer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cms-drawer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #171a21;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  transition: all 0.2s;
}

.cms-drawer-item:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: #1c2028;
}

.cms-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.cms-item-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: #000;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cms-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cms-item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.cms-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cms-item-subtitle {
  font-size: 0.75rem;
  color: #888;
}

.cms-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ===== TOAST NOTIFICATIONS ===== */
.cms-toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.cms-toast {
  background: #0f1013;
  color: #fff;
  border: 1px solid #00ff88;
  padding: 12px 22px;
  border-radius: 30px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 255, 136, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: cmsToastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

@keyframes cmsToastIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  .cms-dock {
    bottom: 12px;
    right: 12px;
    left: 12px;
    justify-content: space-between;
    padding: 6px 10px;
  }
  .cms-dock-brand span { display: none; }
  .cms-drawer { max-width: 100%; }
}
