/* ==========================================================================
   MICROSOFT FLUENT DESIGN 2 - FLOATING WIDGET CMS SYSTEM
   Custom Pure CSS Component Library
   Features: Glassmorphism, Elevation Shadows, Smooth Keyframes, Responsive Layouts
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties / Fluent Design Tokens
   -------------------------------------------------------------------------- */
.fluent-widget-root {
  --fluent-font-family: 'Segoe UI Variable Text', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --fluent-radius-sm: 4px;
  --fluent-radius-md: 8px;
  --fluent-radius-lg: 12px;
  --fluent-radius-xl: 16px;
  --fluent-radius-full: 9999px;
  
  --fluent-shadow-card: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  --fluent-shadow-flyout: 0 12px 32px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
  --fluent-shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.22), 0 4px 10px rgba(0, 0, 0, 0.12);

  --fluent-glass-bg: rgba(255, 255, 255, 0.85);
  --fluent-glass-border: rgba(255, 255, 255, 0.4);
  --fluent-glass-blur: blur(16px) saturate(180%);

  --fluent-primary-widget: #0078d4;
  --fluent-primary-widget-hover: #106ebe;
  --fluent-text-primary-widget: #111827;
  --fluent-text-secondary-widget: #4b5563;
  
  --fluent-transition-fast: 150ms cubic-bezier(0.33, 1, 0.68, 1);
  --fluent-transition-normal: 300ms cubic-bezier(0.16, 1, 0.3, 1);
  --fluent-transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark Mode Tokens */
@media (prefers-color-scheme: dark) {
  .fluent-widget-root {
    --fluent-glass-bg: rgba(30, 30, 30, 0.85);
    --fluent-glass-border: rgba(255, 255, 255, 0.12);
    --fluent-text-primary-widget: #f9fafb;
    --fluent-text-secondary-widget: #9ca3af;
  }
}

/* --------------------------------------------------------------------------
   2. Container Positioning Framework (8 Directions)
   -------------------------------------------------------------------------- */
.fluent-widget-root {
  position: fixed;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  font-family: var(--fluent-font-family);
  box-sizing: border-box;
  margin: 24px; /* Desktop Standard Margin */
  max-width: calc(100vw - 48px);
}

/* Positions */
.fluent-widget-root[data-position="BOTTOM_RIGHT"] {
  bottom: 0;
  right: 0;
  align-items: flex-end;
}

.fluent-widget-root[data-position="BOTTOM_LEFT"] {
  bottom: 0;
  left: 0;
  align-items: flex-start;
}

.fluent-widget-root[data-position="TOP_RIGHT"] {
  top: 0;
  right: 0;
  align-items: flex-end;
}

.fluent-widget-root[data-position="TOP_LEFT"] {
  top: 0;
  left: 0;
  align-items: flex-start;
}

.fluent-widget-root[data-position="CENTER_RIGHT"] {
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  align-items: flex-end;
}

.fluent-widget-root[data-position="CENTER_LEFT"] {
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  align-items: flex-start;
}

.fluent-widget-root[data-position="BOTTOM_CENTER"] {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}

.fluent-widget-root[data-position="TOP_CENTER"] {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}

/* --------------------------------------------------------------------------
   3. Card Component Styling & Glassmorphism
   -------------------------------------------------------------------------- */
.fluent-widget-card {
  position: relative;
  overflow: hidden;
  box-shadow: var(--fluent-shadow-flyout);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: transform var(--fluent-transition-normal), box-shadow var(--fluent-transition-normal), opacity var(--fluent-transition-normal);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  will-change: transform, opacity;
}

/* Responsive Video Embed inside Floating Widget cards (CKEditor mediaEmbed output) */
.fluent-widget-card figure.media,
.fluent-widget-card .ck-media-youtube-wrapper,
.fluent-widget-card [data-oembed-url] > div,
.fl-widget-toast figure.media,
.fl-widget-toast .ck-media-youtube-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  margin: 8px 0;
}

.fluent-widget-card figure.media iframe,
.fluent-widget-card .ck-media-youtube-wrapper iframe,
.fluent-widget-card [data-oembed-url] iframe,
.fl-widget-toast figure.media iframe,
.fl-widget-toast .ck-media-youtube-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
}

/* Ensure images inside widget content are responsive */
.fluent-widget-card img,
.fl-widget-toast img {
  max-width: 100%;
  height: auto;
}

/* Glassmorphism class */
.fluent-widget-card.is-glass {
  background: var(--fluent-glass-bg);
  backdrop-filter: var(--fluent-glass-blur);
  -webkit-backdrop-filter: var(--fluent-glass-blur);
  border-color: var(--fluent-glass-border);
}

.fluent-widget-card:hover {
  box-shadow: var(--fluent-shadow-hover);
  transform: translateY(-4px) scale(1.01);
}

/* Header & Close Button */
.fluent-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.fluent-widget-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}

.fluent-widget-close-btn {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: var(--fluent-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: currentColor;
  opacity: 0.6;
  transition: opacity var(--fluent-transition-fast), background var(--fluent-transition-fast);
  padding: 0;
  flex-shrink: 0;
}

.fluent-widget-close-btn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

/* Exit state applied by widget_engine.js when the user clicks the close (X) button */
.is-closing {
  transition: opacity var(--fluent-transition-fast), transform var(--fluent-transition-fast) !important;
  opacity: 0 !important;
  transform: scale(0.92) !important;
  pointer-events: none;
}

/* Content Area */
.fluent-widget-body {
  font-size: 0.925rem;
  line-height: 1.5;
  margin-bottom: 12px;
}

.fluent-widget-image {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: var(--fluent-radius-md);
  margin-bottom: 12px;
  display: block;
}

/* Action Button */
.fluent-widget-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--fluent-radius-md);
  text-decoration: none;
  cursor: pointer;
  background-color: var(--fluent-primary-widget);
  color: #ffffff;
  border: none;
  transition: background-color var(--fluent-transition-fast), transform var(--fluent-transition-fast);
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.fluent-widget-btn:hover {
  background-color: var(--fluent-primary-widget-hover);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   4. Fluent Keyframe Animations
   -------------------------------------------------------------------------- */
/* Fade */
@keyframes fluentFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Slide Up */
@keyframes fluentSlideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Slide Down */
@keyframes fluentSlideDown {
  from { opacity: 0; transform: translateY(-40px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scale */
@keyframes fluentScale {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

/* Bounce */
@keyframes fluentBounce {
  0% { opacity: 0; transform: translateY(50px); }
  60% { transform: translateY(-10px); }
  80% { transform: translateY(5px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Spring (Physics simulation) */
@keyframes fluentSpring {
  0% { opacity: 0; transform: scale(0.3) translateY(100px); }
  50% { opacity: 1; transform: scale(1.08) translateY(-15px); }
  75% { transform: scale(0.97) translateY(5px); }
  100% { transform: scale(1) translateY(0); }
}

/* Float (Continuous loop) */
@keyframes fluentFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Pulse (Glow) */
@keyframes fluentPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 120, 212, 0.4); }
  50% { transform: scale(1.03); box-shadow: 0 0 0 12px rgba(0, 120, 212, 0); }
}

/* Animation Trigger Classes */
.anim-fade { animation: fluentFadeIn var(--anim-duration, 400ms) var(--fluent-transition-normal) forwards; }
.anim-slide_up { animation: fluentSlideUp var(--anim-duration, 400ms) var(--fluent-transition-normal) forwards; }
.anim-slide_down { animation: fluentSlideDown var(--anim-duration, 400ms) var(--fluent-transition-normal) forwards; }
.anim-scale { animation: fluentScale var(--anim-duration, 400ms) var(--fluent-transition-normal) forwards; }
.anim-bounce { animation: fluentBounce var(--anim-duration, 600ms) var(--fluent-transition-spring) forwards; }
.anim-spring { animation: fluentSpring var(--anim-duration, 650ms) var(--fluent-transition-spring) forwards; }
.anim-float { animation: fluentFloat 3s ease-in-out infinite; }
.anim-pulse { animation: fluentPulse 2s infinite; }
.anim-zoom { animation: fluentScale var(--anim-duration, 400ms) var(--fluent-transition-normal) forwards; }
.anim-hover_lift { animation: fluentSlideUp var(--anim-duration, 400ms) var(--fluent-transition-normal) forwards; }
.anim-ripple { animation: fluentPulse var(--anim-duration, 2000ms) ease-in-out infinite; }

/* --------------------------------------------------------------------------
   5. Responsive Breakpoints (Tablet & Mobile Rules)
   -------------------------------------------------------------------------- */

/* Tablet Rule (<= 1024px) */
@media (max-width: 1024px) {
  .fluent-widget-root {
    margin: 20px;
  }
}

/* Mobile Rule (<= 640px) */
@media (max-width: 640px) {
  .fluent-widget-root {
    margin: 16px !important;
    left: 5% !important;
    right: 5% !important;
    width: 90% !important;
    max-width: 90% !important;
    transform: none !important;
    align-items: center !important;
  }

  .fluent-widget-root[data-position*="BOTTOM"] {
    bottom: 16px !important;
    top: auto !important;
  }

  .fluent-widget-root[data-position*="TOP"] {
    top: 16px !important;
    bottom: auto !important;
  }

  .fluent-widget-card {
    width: 100% !important;
  }
}

/* --------------------------------------------------------------------------
   6. Dedicated Component CSS Rules (Component-Based Architecture)
   -------------------------------------------------------------------------- */

/* Contact Widget */
.fl-widget-contact {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 280px;
}
.fl-contact-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fl-contact-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Floating Circle Social Buttons (Hotline, Zalo, Messenger, Telegram, WhatsApp) */
.fl-widget-circle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 9999px;
  font-weight: 600;
  text-decoration: none !important;
  box-shadow: var(--fluent-shadow-flyout);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  cursor: pointer;
}
.fl-widget-circle-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: var(--fluent-shadow-hover);
}
.fl-widget-circle-btn.round-icon-only {
  padding: 14px;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  justify-content: center;
}

/* Specific Social Brand Colors Defaults */
.fl-btn-hotline { background-color: #d97706; color: #fff !important; }
.fl-btn-zalo { background-color: #0068ff; color: #fff !important; }
.fl-btn-messenger { background-color: #0084ff; color: #fff !important; }
.fl-btn-telegram { background-color: #229ed9; color: #fff !important; }
.fl-btn-whatsapp { background-color: #25d366; color: #fff !important; }

/* AI Assistant & Chat Window */
.fl-widget-chat-box {
  width: 320px;
  display: flex;
  flex-direction: column;
  border-radius: var(--fluent-radius-lg);
  overflow: hidden;
}
.fl-chat-messages {
  max-height: 220px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fl-chat-msg-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.4;
  max-width: 85%;
}
.fl-chat-msg-bubble.bot {
  background: rgba(0, 120, 212, 0.1);
  color: var(--fluent-text-primary-widget);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}
.fl-chat-input-bar {
  display: flex;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 8px;
  gap: 6px;
}
.fl-chat-input-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  padding: 6px 10px;
  font-size: 13px;
  color: inherit;
}
.fl-chat-input-bar button {
  background: var(--fluent-primary-widget);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}

/* Banner Component */
.fl-widget-banner {
  max-width: 100%;
  border-radius: var(--fluent-radius-md);
  overflow: hidden;
  box-shadow: var(--fluent-shadow-flyout);
}
.fl-widget-banner img {
  display: block;
  width: 100%;
  height: auto;
}

/* Toast Notice Component */
.fl-widget-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--fluent-radius-md);
  box-shadow: var(--fluent-shadow-flyout);
  min-width: 240px;
}

/* Coachmark Component */
.fl-widget-coachmark {
  padding: 12px 16px;
  border-radius: var(--fluent-radius-md);
  border-left: 4px solid var(--fluent-primary-widget);
}

/* Video Component */
.fl-widget-video-box {
  border-radius: var(--fluent-radius-lg);
  overflow: hidden;
  position: relative;
}
.fl-video-controls {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  background: rgba(0,0,0,0.6);
  padding: 4px 8px;
  border-radius: 6px;
}
.fl-video-controls button {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 12px;
}

/* QR Code Component */
.fl-widget-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px;
  gap: 8px;
}
.fl-widget-qr-box img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: 8px;
}

/* --------------------------------------------------------------------------
   7. Admin Floating Widget CMS Layout Styles (Fluent Design 2 Specification)
   -------------------------------------------------------------------------- */
.admin-body {
  padding: 0 !important;
  background: #f8fafc !important;
}

.widget-editor-wrapper {
  min-height: calc(100vh - 56px);
  padding: 24px 32px 40px !important;
  color: #0f172a !important;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif !important;
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
}

.widget-admin-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 24px !important;
  margin-bottom: 20px !important;
}

.widget-title-area h1 {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  margin: 0 0 6px 0 !important;
  color: #0f172a !important;
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
}

.edit-title-btn {
  width: 32px !important;
  height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  color: #475569 !important;
  background: #ffffff !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
  cursor: pointer !important;
  font-size: 0.85rem !important;
}

.widget-subtitle {
  margin: 0 !important;
  color: #64748b !important;
  font-size: 0.875rem !important;
}

.btn-back-link {
  height: 40px !important;
  padding: 0 18px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  color: #334155 !important;
  background: #ffffff !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
}

.btn-back-link:hover {
  color: #2563eb !important;
  border-color: #bfdbfe !important;
  background: #f8fafc !important;
}

/* Tabs Header Nav */
.fluent-tabs-nav {
  display: flex !important;
  align-items: center !important;
  gap: 28px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  margin-bottom: 24px !important;
  overflow-x: auto !important;
}

.fluent-tab-btn {
  min-width: max-content !important;
  padding: 10px 4px 14px !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  background: transparent !important;
  color: #475569 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: color 0.15s ease, border-color 0.15s ease !important;
}

.fluent-tab-btn.active,
.fluent-tab-btn:hover {
  color: #2563eb !important;
}

.fluent-tab-btn.active {
  border-bottom-color: #2563eb !important;
}

/* Strict 2 Column Grid Layout (70% Left Form / 30% Right Sidebar) */
.widget-editor-grid {
  display: grid !important;
  grid-template-columns: 7fr 3fr !important;
  gap: 24px !important;
  align-items: start !important;
  width: 100% !important;
}

.main-form-column {
  display: flex !important;
  flex-direction: column !important;
  gap: 24px !important;
  min-width: 0 !important;
}

.right-sidebar-column {
  display: flex !important;
  flex-direction: column !important;
  gap: 24px !important;
  position: sticky !important;
  top: 24px !important;
  min-width: 0 !important;
}

/* Fluent Card Sections */
.fluent-card-section {
  border: 1px solid #e5e7eb !important;
  border-radius: 16px !important;
  background: #ffffff !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03) !important;
  padding: 24px !important;
  box-sizing: border-box !important;
}

.section-heading {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 0 20px 0 !important;
  color: #0f172a !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
}

/* Form Fields Layout */
.form-grid-2 {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 18px 24px !important;
}

.form-group-wrap {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  min-width: 0 !important;
}

.form-group-wrap.hidden-field {
  display: none !important;
}

.field-span-2 {
  grid-column: 1 / -1 !important;
}

.field-label-text {
  color: #1e293b !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
}

.required-star,
.hint-star {
  color: #ef4444 !important;
}

.widget-editor-wrapper select,
.widget-editor-wrapper textarea,
.widget-editor-wrapper input[type="text"],
.widget-editor-wrapper input[type="number"],
.widget-editor-wrapper input[type="datetime-local"],
.widget-editor-wrapper input[type="time"] {
  width: 100% !important;
  height: 40px !important;
  padding: 8px 14px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  font-size: 0.875rem !important;
  outline: 0 !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
  box-sizing: border-box !important;
}

.widget-editor-wrapper textarea {
  height: auto !important;
  min-height: 100px !important;
  resize: vertical !important;
}

.widget-editor-wrapper select:focus,
.widget-editor-wrapper textarea:focus,
.widget-editor-wrapper input:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.file-field input[type="file"] {
  padding: 6px 10px !important;
  height: 40px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
}

.icon-picker-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 40px !important;
  gap: 8px !important;
}

.icon-picker-btn {
  width: 40px !important;
  height: 40px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #334155 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
}

/* Color Picker Boxes */
.color-picker-box {
  height: 40px !important;
  display: grid !important;
  grid-template-columns: 48px 1fr 40px !important;
  align-items: center !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  overflow: hidden !important;
}

.color-swatch-preview {
  height: 28px !important;
  margin-left: 6px !important;
  border: 1px solid rgba(15, 23, 42, 0.15) !important;
  border-radius: 4px !important;
}

.color-picker-box input[type="text"] {
  height: 40px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  padding: 0 10px !important;
}

.color-picker-box input[type="color"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.color-picker-trigger {
  height: 40px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-left: 1px solid #e2e8f0 !important;
  color: #64748b !important;
  cursor: pointer !important;
}

/* Range Sliders */
.slider-row {
  display: grid !important;
  grid-template-columns: 1fr 48px !important;
  gap: 12px !important;
  align-items: center !important;
}

.widget-editor-wrapper input[type="range"] {
  width: 100% !important;
  accent-color: #2563eb !important;
}

.number-badge-box {
  height: 40px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  color: #1e293b !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
}

/* Padding Control Grid */
.padding-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.padding-item {
  min-width: 0 !important;
  text-align: center !important;
}

.padding-input-shell {
  height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  color: #1e293b !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
}

.padding-input-shell span {
  color: #64748b !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
}

.padding-val-input {
  width: 42px !important;
  border: none !important;
  background: transparent !important;
  color: #1e293b !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  text-align: center !important;
  padding: 0 !important;
  -moz-appearance: textfield;
}

.padding-val-input::-webkit-outer-spin-button,
.padding-val-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.padding-item label {
  display: block !important;
  margin-top: 6px !important;
  color: #64748b !important;
  font-size: 0.75rem !important;
}

/* Switches */
.switch-line {
  height: 40px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 16px !important;
}

.fluent-switch {
  position: relative !important;
  display: inline-block !important;
  width: 44px !important;
  height: 24px !important;
  flex: 0 0 auto !important;
}

.fluent-switch input {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

.switch-slider {
  position: absolute !important;
  inset: 0 !important;
  border-radius: 999px !important;
  background: #cbd5e1 !important;
  cursor: pointer !important;
  transition: background 0.18s ease !important;
}

.switch-slider:before {
  content: "" !important;
  position: absolute !important;
  width: 20px !important;
  height: 20px !important;
  left: 2px !important;
  top: 2px !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2) !important;
  transition: transform 0.18s ease !important;
}

.fluent-switch input:checked + .switch-slider {
  background: #2563eb !important;
}

.fluent-switch input:checked + .switch-slider:before {
  transform: translateX(20px) !important;
}

/* Live Preview Card Container */
.preview-card-container {
  min-height: 240px !important;
  padding: 20px !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  position: relative !important;
  border-radius: 16px !important;
  background:
    radial-gradient(circle at 50% 50%, rgba(241, 245, 249, 0.8), rgba(226, 232, 240, 0.9)),
    linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.preview-card-container .fluent-widget-card,
.preview-card-container .fluent-widget-root,
.preview-card-container .fl-widget-circle-btn,
.preview-card-container .fl-widget-contact,
.preview-card-container .fl-widget-chat-box,
.preview-card-container .fl-widget-banner,
.preview-card-container .fl-widget-toast,
.preview-card-container .fl-widget-coachmark,
.preview-card-container .fl-widget-video-box,
.preview-card-container .fl-widget-qr-box,
.preview-card-container .widget-preview-node {
  position: relative !important;
  top: auto !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  pointer-events: auto !important;
  box-sizing: border-box !important;
}

/* Responsive embedded videos inside preview (CKEditor mediaEmbed output) */
.preview-card-container figure.media,
.preview-card-container .ck-media-youtube-wrapper,
.preview-card-container [data-oembed-url] > div {
  position: relative !important;
  width: 100% !important;
  padding-bottom: 56.25% !important;
  height: 0 !important;
  overflow: hidden !important;
  border-radius: 8px !important;
  margin: 8px 0 !important;
}

.preview-card-container figure.media iframe,
.preview-card-container .ck-media-youtube-wrapper iframe,
.preview-card-container [data-oembed-url] iframe {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  border-radius: 8px !important;
}

/* Images inside preview widget content */
.preview-card-container img {
  max-width: 100% !important;
  height: auto !important;
}

.preview-card-container .fluent-widget-card:hover {
  transform: none !important;
}

/* Accordion Bar */
.accordion-bar {
  width: 100% !important;
  margin-top: 20px !important;
  padding: 14px 4px 0 !important;
  border-top: 1px solid #f1f5f9 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  color: #334155 !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  background: transparent !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-bottom: 0 !important;
  cursor: pointer !important;
}

.advanced-panel {
  display: none !important;
  margin-top: 16px !important;
  padding-top: 16px !important;
  border-top: 1px solid #f1f5f9 !important;
}

.advanced-panel.is-open {
  display: block !important;
}

/* Footer Action Bar */
.widget-bottom-bar {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 5 !important;
  margin: 30px -32px -40px !important;
  padding: 16px 32px !important;
  border-top: 1px solid #e2e8f0 !important;
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(16px) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 16px !important;
}

.btn-delete-widget,
.btn-cancel,
.btn-save-widget {
  min-width: 120px !important;
  height: 40px !important;
  padding: 0 20px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.btn-delete-widget {
  border: 1px solid #fecaca !important;
  background: #ffffff !important;
  color: #dc2626 !important;
}

.btn-delete-widget:hover {
  background: #fef2f2 !important;
}

.btn-cancel {
  border: 1px solid #cbd5e1 !important;
  background: #f8fafc !important;
  color: #334155 !important;
}

.btn-cancel:hover {
  background: #f1f5f9 !important;
}

.btn-save-widget {
  min-width: 140px !important;
  border: 1px solid #2563eb !important;
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25) !important;
}

.btn-save-widget:hover {
  background: #1d4ed8 !important;
}

.hidden-submit-fields {
  display: none !important;
}

/* Responsive Rules */
@media (max-width: 1200px) {
  .widget-editor-grid {
    grid-template-columns: 65fr 35fr !important;
  }
}

@media (max-width: 900px) {
  .widget-editor-grid {
    grid-template-columns: 1fr !important;
  }

  .right-sidebar-column {
    position: static !important;
  }
}

@media (max-width: 640px) {
  .widget-editor-wrapper {
    padding: 16px 16px 20px !important;
  }

  .widget-admin-header,
  .widget-bottom-bar {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .form-grid-2 {
    grid-template-columns: 1fr !important;
  }

  .widget-bottom-bar {
    margin-left: -16px !important;
    margin-right: -16px !important;
    padding: 14px 16px !important;
  }
}

