/* ==========================================================================
   KNT ENERGY - Sovereign CMS & Visual Live Builder Styles
   Corporate Identity Guidelines Compliant (Tajawal + Dubai, Deep Navy & Sky)
   ========================================================================== */

:root {
  --knt-cms-navy: #031422;
  --knt-cms-navy-panel: #072036;
  --knt-cms-sky: #0284C7;
  --knt-cms-sky-light: #38BDF8;
  --knt-cms-gold: #D97706;
  --knt-cms-gold-light: #FBBF24;
  --knt-cms-text: #F8FAFC;
  --knt-cms-muted: #94A3B8;
  --knt-cms-border: rgba(255, 255, 255, 0.12);
  --knt-cms-danger: #EF4444;
  --knt-cms-success: #10B981;
  --knt-admin-bar-height: 48px;
}

/* ==========================================================================
   1. FLOATING TOP ADMIN BAR
   ========================================================================== */
#knt-admin-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--knt-admin-bar-height);
  background: rgba(3, 20, 34, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--knt-cms-sky);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-family: 'Tajawal', sans-serif;
  color: var(--knt-cms-text);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  direction: rtl;
  user-select: none;
}

body.knt-admin-logged-in {
  padding-top: var(--knt-admin-bar-height) !important;
}

body.knt-admin-logged-in .top-line-bar {
  top: var(--knt-admin-bar-height) !important;
}

body.knt-admin-logged-in .navbar {
  top: calc(var(--knt-admin-bar-height) + 4px) !important;
}

.knt-bar-left, .knt-bar-right, .knt-bar-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.knt-bar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14px;
  color: #FFFFFF;
}

.knt-bar-badge {
  background: var(--knt-cms-sky);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.knt-bar-user {
  font-size: 13px;
  color: var(--knt-cms-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.knt-bar-user b {
  color: var(--knt-cms-text);
}

.knt-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}

.knt-btn-edit-toggle {
  background: rgba(2, 132, 199, 0.2);
  color: var(--knt-cms-sky-light);
  border-color: rgba(2, 132, 199, 0.5);
}

.knt-btn-edit-toggle:hover {
  background: rgba(2, 132, 199, 0.35);
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.4);
}

.knt-btn-edit-toggle.active {
  background: #0284C7;
  color: #FFFFFF;
  box-shadow: 0 0 15px rgba(2, 132, 199, 0.7);
}

.knt-btn-save {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
  border: none;
}

.knt-btn-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.knt-btn-dashboard {
  background: rgba(255, 255, 255, 0.08);
  color: #E2E8F0;
  border-color: var(--knt-cms-border);
}

.knt-btn-dashboard:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}

.knt-btn-logout {
  background: transparent;
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.knt-btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #FCA5A5;
}

.knt-save-status {
  font-size: 12px;
  color: var(--knt-cms-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.knt-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--knt-cms-success);
}

.knt-status-dot.dirty {
  background: var(--knt-cms-gold);
  animation: pulseDot 1s infinite alternate;
}

@keyframes pulseDot {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* ==========================================================================
   2. VISUAL EDITOR INTERACTIVE HIGHLIGHTS (In Edit Mode)
   ========================================================================== */
body.knt-edit-mode-active [data-knt-editable="text"],
body.knt-edit-mode-active [data-knt-editable="image"],
body.knt-edit-mode-active [data-knt-block="card"],
body.knt-edit-mode-active [data-i18n] {
  position: relative;
  transition: outline 0.15s ease, background-color 0.15s ease;
}

body.knt-edit-mode-active [data-knt-editable="text"]:hover,
body.knt-edit-mode-active [data-knt-editable="image"]:hover,
body.knt-edit-mode-active [data-i18n]:hover {
  outline: 2px dashed #0284C7 !important;
  outline-offset: 3px;
  cursor: pointer !important;
  background-color: rgba(2, 132, 199, 0.08) !important;
}

body.knt-edit-mode-active .knt-element-selected {
  outline: 2.5px solid #0284C7 !important;
  outline-offset: 4px;
  box-shadow: 0 0 20px rgba(2, 132, 199, 0.35) !important;
  background-color: rgba(2, 132, 199, 0.12) !important;
}

/* Floating Action Pills on Block Hover */
.knt-block-actions-pill {
  position: absolute;
  top: -14px;
  left: 10px;
  background: #031422;
  border: 1px solid var(--knt-cms-sky);
  border-radius: 20px;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  font-family: 'Tajawal', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #FFFFFF;
}

.knt-pill-btn {
  background: transparent;
  border: none;
  color: #BAE6FD;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s;
}

.knt-pill-btn:hover {
  background: rgba(2, 132, 199, 0.3);
  color: #FFFFFF;
}

.knt-pill-btn.delete:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #FCA5A5;
}

/* ==========================================================================
   3. LEFT SIDEBAR BUILDER (#knt-editor-sidebar)
   ========================================================================== */
#knt-editor-sidebar {
  position: fixed;
  top: var(--knt-admin-bar-height);
  left: -400px; /* Hidden by default */
  width: 380px;
  height: calc(100vh - var(--knt-admin-bar-height));
  background: rgba(7, 32, 54, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1.5px solid rgba(2, 132, 199, 0.35);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.45);
  z-index: 999990;
  display: flex;
  flex-direction: column;
  transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Tajawal', sans-serif;
  color: var(--knt-cms-text);
  direction: rtl;
  user-select: none;
}

#knt-editor-sidebar.open {
  left: 0;
}

/* Push site container when open */
body.knt-sidebar-pushed {
  margin-left: 380px !important;
  transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.knt-sidebar-pushed .top-line-bar {
  left: 380px !important;
  width: calc(100% - 380px) !important;
  transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.knt-sidebar-pushed .navbar {
  left: 380px !important;
  width: calc(100% - 380px) !important;
  transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.knt-sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--knt-cms-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(3, 20, 34, 0.6);
}

.knt-sidebar-title {
  font-size: 16px;
  font-weight: 800;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 8px;
}

.knt-sidebar-close {
  background: transparent;
  border: none;
  color: var(--knt-cms-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  border-radius: 6px;
}

.knt-sidebar-close:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
}

.knt-sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--knt-cms-border);
  background: rgba(3, 20, 34, 0.3);
}

.knt-tab-btn {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--knt-cms-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.knt-tab-btn.active {
  color: var(--knt-cms-sky-light);
  border-bottom-color: var(--knt-cms-sky);
  background: rgba(2, 132, 199, 0.08);
}

.knt-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.knt-panel-section {
  display: none;
}

.knt-panel-section.active {
  display: block;
}

/* Sidebar Form Controls */
.knt-field-group {
  margin-bottom: 18px;
}

.knt-field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #E2E8F0;
  margin-bottom: 6px;
}

.knt-field-help {
  font-size: 11px;
  color: var(--knt-cms-muted);
  margin-top: 4px;
}

.knt-input, .knt-textarea {
  width: 100%;
  background: rgba(3, 20, 34, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 12px;
  color: #FFFFFF;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.knt-input:focus, .knt-textarea:focus {
  border-color: var(--knt-cms-sky);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.knt-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* Image Preview in Sidebar */
.knt-img-preview-box {
  width: 100%;
  height: 140px;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 10px;
  position: relative;
}

.knt-img-preview-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.knt-btn-upload {
  width: 100%;
  background: rgba(2, 132, 199, 0.2);
  border: 1px solid var(--knt-cms-sky);
  color: #BAE6FD;
  padding: 8px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  margin-top: 6px;
}

.knt-btn-upload:hover {
  background: rgba(2, 132, 199, 0.35);
  color: #FFFFFF;
}

/* Section Visibility Item */
.knt-section-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(3, 20, 34, 0.5);
  border: 1px solid var(--knt-cms-border);
  border-radius: 10px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.knt-section-item:hover {
  border-color: rgba(2, 132, 199, 0.4);
  background: rgba(3, 20, 34, 0.8);
}

.knt-section-name {
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
}

.knt-section-id {
  font-size: 11px;
  color: var(--knt-cms-muted);
  direction: ltr;
}

/* Switch Toggle Component */
.knt-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.knt-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.knt-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}

.knt-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .knt-slider {
  background-color: var(--knt-cms-sky);
}

input:checked + .knt-slider:before {
  transform: translateX(20px);
}

/* Block Actions inside sidebar */
.knt-block-tool-btn {
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid var(--knt-cms-border);
  background: rgba(255, 255, 255, 0.05);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.knt-block-tool-btn:hover {
  background: rgba(2, 132, 199, 0.25);
  border-color: var(--knt-cms-sky);
}

.knt-block-tool-btn.danger {
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.knt-block-tool-btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
}

/* Toast Notifications */
#knt-cms-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(3, 20, 34, 0.95);
  border: 1px solid var(--knt-cms-sky);
  color: #FFFFFF;
  padding: 12px 24px;
  border-radius: 30px;
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 20px rgba(2, 132, 199, 0.4);
  z-index: 1000000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  direction: rtl;
}

#knt-cms-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   VISUAL BOX MODEL (SPACING: MARGIN & PADDING)
   ========================================================================== */
.knt-bm-reset-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94A3B8;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.knt-bm-reset-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #EF4444;
  color: #FCA5A5;
}

.knt-box-model-container {
  direction: ltr !important;
  user-select: none;
  font-family: 'Dubai', -apple-system, BlinkMacSystemFont, sans-serif;
  margin-top: 8px;
  width: 100%;
  box-sizing: border-box;
}

.knt-bm-margin-box {
  background: rgba(245, 158, 11, 0.05);
  border: 1.5px dashed #F59E0B;
  border-radius: 8px;
  padding: 8px 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
}

.knt-bm-header-row {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  padding: 0 4px;
}

.knt-bm-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.knt-bm-label-margin {
  color: #F59E0B;
}

.knt-bm-label-padding {
  color: #10B981;
}

.knt-bm-middle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 6px;
}

.knt-bm-padding-box {
  background: rgba(16, 185, 129, 0.06);
  border: 1.5px dashed #10B981;
  border-radius: 6px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  box-sizing: border-box;
}

.knt-bm-element-box {
  background: rgba(2, 132, 199, 0.2);
  border: 1.5px solid var(--knt-cms-sky);
  border-radius: 4px;
  padding: 6px 8px;
  min-width: 64px;
  min-height: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.knt-bm-element-title {
  font-family: 'Tajawal', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #38BDF8;
  line-height: 1.2;
}

.knt-bm-element-size {
  font-size: 9.5px;
  color: #94A3B8;
  font-weight: 600;
  margin-top: 1px;
  line-height: 1.2;
}

.knt-bm-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.knt-bm-input {
  width: 48px;
  height: 25px;
  background: #072036;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  color: #FFFFFF;
  font-family: 'Dubai', sans-serif;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  padding: 1px 13px 1px 2px;
  outline: none;
  transition: all 0.2s;
  -moz-appearance: textfield;
}

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

.knt-bm-input:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: #0B2540;
}

.knt-bm-input:focus {
  border-color: #38BDF8;
  background: #031422;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

.knt-bm-unit {
  position: absolute;
  right: 3px;
  font-size: 8px;
  color: #64748B;
  pointer-events: none;
  font-weight: 700;
}

/* Center Element Button */
.knt-bm-center-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(2, 132, 199, 0.12);
  border: 1px dashed #38BDF8;
  border-radius: 6px;
  color: #BAE6FD;
  font-family: 'Tajawal', sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s ease;
}

.knt-bm-center-btn:hover {
  background: rgba(2, 132, 199, 0.25);
  color: #FFFFFF;
  border-color: #60A5FA;
}

