:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --sidebar-bg: #1a1c23;
  --card-border: rgba(99, 102, 241, 0.1);
}

/* Base Styles */
body {
  background-color: #f8f9fa;
  overflow-x: hidden;
}

/* Toast Container */
.toast-container {
  bottom: 80px !important;
}

/* Layout Components */
.sidebar {
  background-color: var(--sidebar-bg);
  transition: all 0.3s ease;
  position: fixed;
  height: 100vh;
  width: 250px;
  z-index: 1031;
  top: 0;
  display: flex;
  flex-direction: column;
}

/* Brand Styles */
.brand-icon {
  width: 40px;
  height: 40px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--primary-color);
  transition: all 0.3s ease;
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 600;
  background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.75) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Sidebar Navigation */
.sidebar .nav-link {
  border-radius: 12px;
  margin: 4px 0;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.sidebar .nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
  border-radius: inherit;
}

.sidebar .nav-link:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.sidebar .nav-link.active {
  color: #fff;
  background: none;
}

.sidebar .nav-link.active::before {
  opacity: 1;
}

.sidebar .nav-link i {
  font-size: 1.1rem;
  width: 1.5rem;
  position: relative;
  z-index: 1;
}

.sidebar .nav-link span {
  position: relative;
  z-index: 1;
}

/* Editor Sidebar Toolbar Container */
.editor-sidebar-toolbar-container {
  flex: 1;
  min-height: 0;
  position: relative;
}

/* Editor Sidebar Toolbar */
.editor-sidebar-toolbar {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: none;
  transform: translateY(-10px);
  transition: transform 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.editor-sidebar-toolbar.show {
  display: block;
  transform: translateY(0);
}

.editor-sidebar-toolbar .toolbar-container {
  background: transparent;
  border: none;
  box-shadow: none;
}

.editor-sidebar-toolbar .btn {
  color: rgba(255, 255, 255, 0.75);
  border-color: rgba(255, 255, 255, 0.1);
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  transition: all 0.3s ease;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.editor-sidebar-toolbar .btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(4px);
}

.editor-sidebar-toolbar .btn i {
  width: 1.5rem;
  text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 0;
}

.sidebar-footer .brand-icon {
  width: 32px;
  height: 32px;
  font-size: 1rem;
  margin: 0 auto;
  opacity: 0.5;
}

/* Main Content */
.main-content {
  margin-left: 250px;
  width: calc(100% - 250px);
  padding-bottom: 5rem;
}

/* Navbar Styles */
.navbar {
  padding: 0.75rem 1rem;
  width: 100% !important;
  background: #fff;
}

/* Card Styles */
.card {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.stat-card {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
}

/* Button Styles */
.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

/* Editor Block Styles */
.editor-wrapper {
  position: relative;
  border-radius: 0.375rem;
}

.editor-wrapper.sortable-ghost {
  opacity: 0.5;
}

.editor-block {
  position: relative;
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 0.5rem;
  transition: background-color 0.2s ease;
}

/* Block Padding Controls */
.block-padding-controls {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.block-padding-controls.top {
  top: -20px;
}

.block-padding-controls.bottom {
  bottom: -20px;
}

.editor-block:hover .block-padding-controls {
  opacity: 1;
}

.padding-input {
  width: 60px;
  height: 24px;
  padding: 0.25rem;
  font-size: 12px;
  text-align: center;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.padding-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.drag-handle {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 24px;
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
  border-top-left-radius: 0.375rem;
  border-bottom-left-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  cursor: move;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.editor-block:hover .drag-handle {
  opacity: 1;
}

.drag-handle:hover {
  color: #000;
  background: #e9ecef;
}

/* Block Actions */
.block-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.editor-block:hover .block-actions {
  opacity: 1;
}

/* Color Picker */
.color-picker-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #dee2e6;
  background: #fff;
}

.block-color-input {
  width: 150%;
  height: 150%;
  margin: -25%;
  padding: 0;
  border: none;
  cursor: pointer;
}

.block-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.block-color-input::-webkit-color-swatch {
  border: none;
}

/* Remove Editor Button */
.remove-editor {
  margin: 0;
  padding: 0.25rem 0.5rem;
  height: 32px;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

/* Add Block Button */
.add-block-button {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border: 2px dashed #dee2e6;
  background: transparent;
  color: #6c757d;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  opacity: 0.5;
}

.add-block-button:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: rgba(99, 102, 241, 0.05);
  opacity: 1;
}

/* Column Layout */
.editor-row {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
}

.editor-column {
  flex: 1;
  position: relative;
  padding: 0 1rem;
}

/* Add dividers between columns */
.editor-column:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #dee2e6;
}

/* First and last columns padding adjustment */
.editor-column:first-child {
  padding-left: 0;
}

.editor-column:last-child {
  padding-right: 0;
}

/* Settings Layout */
.settings-row {
  display: flex;
  margin-left: -1rem;
  margin-right: -1rem;
}

.settings-col {
  padding-left: 1rem;
  padding-right: 1rem;
  display: flex;
  flex-direction: column;
}

.settings-col-left {
  flex: 0 0 66.666667%;
  max-width: 66.666667%;
}

.settings-col-right {
  flex: 0 0 33.333333%;
  max-width: 33.333333%;
}

.settings-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.settings-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.settings-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Column Options */
.column-option {
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.column-option:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.05);
}

.column-preview {
  height: 60px;
}

/* Sortable States */
.sortable-chosen {
  background: #fff;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.sortable-drag {
  opacity: 0.8;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
}

/* Textarea Texteditor */
.editor-content.form-control {
  border: none;
  background-color: transparent;
}

/* Fixed Bottom Bar */
.fixed-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 250px;
  right: 0;
  background: #fff;
  padding: 1rem;
  border-top: 1px solid var(--card-border);
  z-index: 1030;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
}

.fixed-bottom-bar .btn-group {
  display: flex;
  gap: 0.5rem;
}

/* Responsive Styles */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    top: 0;
    left: 0;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .navbar {
    width: 100% !important;
  }

  .menu-toggle {
    display: block;
  }

  .navbar-collapse {
    margin-top: 1rem;
  }

  .settings-row {
    flex-direction: column;
  }

  .settings-col-left,
  .settings-col-right {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .editor-row {
    flex-direction: column;
    gap: 1rem;
  }

  .editor-column {
    width: 100%;
    padding: 0 !important;
  }

  /* Remove column dividers on mobile */
  .editor-column:not(:last-child)::after {
    display: none;
  }

  .fixed-bottom-bar {
    left: 0;
  }
}

@media (max-width: 767.98px) {
  .stat-cards .col-md-3 {
    margin-bottom: 1rem;
  }
  
  .card-title {
    font-size: 1.25rem;
  }

  .card h2 {
    font-size: 1.5rem;
  }
}