/* Scrollbar styles */
body::-webkit-scrollbar {
  width: 4px;
  /* Width of the scrollbar */
}

body::-webkit-scrollbar-track {
  background: transparent;
  /* Track background */
  border-radius: 10px;
  /* Rounded corners */
}

body::-webkit-scrollbar-thumb {
  background: #e5e5e5;
  /* Thumb color */
  border-radius: 20px;
  /* Rounded corners */
}

/* ===================================================
   Main Editor Container 
   =================================================== */

#workspace {
  display: none;
  position: fixed;
  top: 0;
  z-index: 99999999;
  width: 100vw;
  height: 100vh;
  color: #fff;
  left: 0;
}

.editor-container {
  display: flex;
  height: calc(100vh - 55px);
}

.editor-container .editor-body {
  display: flex;
  width: 100%;
}

/* ===================================================
   Editor Header 
   =================================================== */

#editor-header {
  grid-auto-columns: 1fr 1fr auto;
  grid-auto-flow: column;
  background-color: white;
  padding: 5px 16px;
  height: 64px;
  align-items: center;
  border-bottom: 1px solid #d9d9d9;
}

#editor-header .header-left {
  display: flex;
  align-items: center;
}

#editor-header .header-left .files-menu {
  display: none;
  background: white;
  border: 1px solid #e0e0e0;
  position: absolute;
  top: 55px;
  left: 205px;
  border-radius: 8px;
  width: 350px;
  z-index: 999;
  text-align: left;
  padding: 15px;
}

#editor-header .header-left .files-menu #newProjectButton {
  padding: 0 12px;
  border: none;
  outline: none;
  color: #616161;
  background-color: transparent;
  font-weight: 600;
  font-size: 15px;
  height: 40px;
}

#editor-header .header-left .files-menu #newProjectButton:hover {
  transition: all 0.5s ease-in-out;
  background-color: #e7e7e7;
  color: #4d4d4d;
  border: none;
  border-radius: 8px;
  width: 100%;
  text-align: left;
}

#editor-header .header-left #fileButton {
  padding: 0 12px;
  border: none;
  outline: none;
  color: #616161;
  background-color: transparent;
  font-weight: 600;
  font-size: 15px;
}

#editor-header .header-left #fileButton:hover {
  transition: all 0.5s ease-in-out;
  background-color: #e7e7e7;
  color: #4d4d4d;
  height: 40px;
  border: none;
  border-radius: 8px;
}

#editor-header .undo-redo {
  display: flex;
  gap: 10px;
}

#editor-header .undo-redo button {
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#editor-header .undo-redo button:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

#editor-header .undo-redo button:not(:disabled):hover {
  background-color: #f0f0f0;
}

#editor-header .export-btn {
  background-color: #1b2de7;
  font-weight: 600;
  gap: 6px;
  color: white;
  border: none;
  height: 40px;
  padding: 0px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 14px;
}

#editor-header .export-btn:hover {
  background-color: #1a5fd7;
}

/* ===================================================
   Sidebar (Left tools menu )
   =================================================== */

.sidebar {
  padding: 10px;
  width: 92px;
  background-color: white;
  border-right: 1px solid #d9d9d9;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar .sidebar-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 5px;
  cursor: pointer;
  font-size: 12px;
  color: #616161;
  transition: background-color 0.2s;
  border-radius: 4px;
  font-weight: 600;
  /* height: 64px; */
  padding: 8px 0px;
  width: 72px;
}

.sidebar .sidebar-tool:hover {
  background-color: #f0f0f0;
}

.sidebar .sidebar-tool.active {
  background-color: #e5e5e5;
  color: #000;
}

.sidebar .sidebar-tool.active svg {
  fill: #000;
}

.sidebar .sidebar-tool svg {
  width: 24px;
  height: 24px;
  margin-bottom: 5px;
}

.tool-panels {
  overflow-y: scroll;
  width: 340px;
  background-color: white;
  border-right: 1px solid #e0e0e0;
  padding: 2rem 1rem;

}

.tool-panels-inner {
  /* overflow-y: scroll; */
  /* padding: 20px; */
  height: 100%;
}

.tool-panel {
  display: none;
}

.tool-panel.active {
  display: block;
}

.tool-panel h3 {
  margin-bottom: 15px;
  color: #333;
  font-weight: 600;
  font-size: 22px;
}

.toggle-panel-button-container {
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-panel-button-container {
  position: relative;
  left: 10px;
  z-index: 99;
}

.toggle-panel-button-container #toggle-panel-button {
  position: absolute;
}

/* ===================================================
   Workspace (Center Panel )
   =================================================== */

.editor-top-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  background: white;
  width: 100%;
  height: 50px;
  padding: 0;
  position: absolute;
  top: 0;
  border-bottom: 1px solid #e0e0e0;
}

.canvas-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #f0f0f0;
}

.canvas-wrapper {
  outline: 2px solid #d9d9d9;
  padding: 2px;
  position: relative;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

canvas {
  display: block;
  max-width: 100%;
}

.bottom-bar {
  position: absolute;
  right: 15px;
  bottom: 22px;
  height: 50px;
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-top: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #f7f7f7;
  border: 1px solid #e0e0e0;
}

.zoom-controls {
  color: #000;
  display: flex;
  align-items: center;
  gap: 10px;
}

.zoom-btn {
  color: #616161;
  width: 30px;
  height: 30px;
  background-color: transparent;
  border: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 25px;
  transition: background-color 0.2s;
}

.zoom-btn:hover {
  background-color: #e0e0e0;
}

/* ===================================================
   Tool-specific UI panels (Crop Tool)
   =================================================== */

.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.crop-area {
  position: absolute;
  border: 2px solid #2472f9;
  box-sizing: content-box;
  cursor: move;
}

/* ===================================================
   Tool-specific UI panels (Resize Tool)
   =================================================== */

.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: #2472f9;
  border-radius: 50%;
}

.resize-handle.tl {
  top: -5px;
  left: -5px;
  cursor: nwse-resize;
}

.resize-handle.tr {
  top: -5px;
  right: -5px;
  cursor: nesw-resize;
}

.resize-handle.bl {
  bottom: -5px;
  left: -5px;
  cursor: nesw-resize;
}

.resize-handle.br {
  bottom: -5px;
  right: -5px;
  cursor: nwse-resize;
}

.input-group label {
  display: block;
  margin-bottom: 5px;
  color: #555;
}

.input-group input[type="number"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.checkbox-group {
  display: flex;
  align-items: center;
}

.checkbox-group input {
  margin-right: 8px;
}

.slider-group {
  margin-bottom: 15px;
}

.slider-group label {
  display: block;
  margin-bottom: 5px;
  color: #555;
}

.slider-group input[type="range"] {
  width: 100%;
  margin-bottom: 5px;
}

.slider-value {
  color: #777;
  font-size: 12px;
}

.apply-btn,
.reset-btn,
.cancel-btn {
  background-color: #2472f9;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
  transition: background-color 0.2s;
  width: 100%;
}

.apply-btn:hover {
  background-color: #1a5fd7;
}

.reset-btn,
.cancel-btn {
  background-color: #e0e0e0;
  color: #333;
  margin-top: 10px;
}

.reset-btn:hover,
.cancel-btn:hover {
  background-color: #d0d0d0;
}

.crop-controls {
  display: flex;
  gap: 10px;
}

.crop-controls .input-group {
  flex: 1;
}

/* Resize panel specific styles */
.resize-panel-heading {
  font-size: 17px;
  font-weight: bold;
}

.resize-panel-subheading {
  font-size: 12px;
  margin: 10px 0px;
}

.resize-panel-options-title {
  font-size: 12px;
  margin: 10px 0px;
}

.custom-options {
  display: flex;
}

.custom-options input {
  border: 1px solid #ddd;
  width: 90px;
  background-color: #f9f9f9;
  border-radius: 4px;
  padding: 4px 5px;
  margin-right: 4px;
}

.custom-options select {
  border: 1px solid #ddd;
  background-color: #f9f9f9;
  border-radius: 4px;
  padding: 4px 5px;
}

.form-control {
  border: 1px solid #ddd;
  background-color: #f9f9f9;
  border-radius: 4px;
  padding: 5px 5px;
  width: 100%;
  margin-bottom: 10px;
}

/* Color picker styles */
.input-group {
  display: flex;
  margin-bottom: 15px;
}

#bg-color-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  width: 50px;
  padding: 0;
  height: 32px;
}

.input-group-text {
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-left: none;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  color: #666;
  font-size: 12px;
}

.color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.color-preset {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s;
}

.color-preset:hover {
  transform: scale(1.1);
}

/* Helper classes */
.mt-3 {
  margin-top: 15px;
}

.mt-4 {
  margin-top: 20px;
}

.mb-2 {
  margin-bottom: 10px;
}

.mb-3 {
  margin-bottom: 15px;
}

.d-flex {
  display: flex;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-1 {
  gap: 5px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -5px;
}

.col-6 {
  width: 50%;
  padding: 0 5px;
}

.g-2>* {
  padding: 5px;
}


/* Effects panel specific styles */
.edit-options {
  height: 90vh;
  overflow-y: scroll;
  padding-bottom: 5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 2rem;
  margin-bottom: 5rem;
}

.effect-item {
  position: relative;
  cursor: pointer;
}

.effect-image {
  border-radius: 8px;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0c66e40d;
}

.edit-options .effect-name {
  color: #4c4c4c;
  background: #D9D9D9;
  border-radius: 16px;
  position: absolute;
  p: 100%;
  bottom: 4px;
  text-align: center;
  margin: 0 auto;
  /* height: 16px; */
  overflow: hidden;
  font-size: 10px;
  text-align: center;
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 4px 4px;
  left: 4px;
  right: 4px;
}

.selected {
  border: 2px solid #000;
  padding: .1rem;
}

.effect-edit-button {
  display: none;
  position: absolute;
  top: 0;
  border-radius: 30px;
  border: none;
  outline: none;
  background: #1b2de7;
  padding: 10px;
  text-align: center;
  margin: 0 auto;
  left: 30%;
  top: 25%;
}

.popup-overlay {
  position: fixed;
  top: 65px;
  left: 93px;
  width: auto;
  height: 100%;
  z-index: 1000;
}

.popup-content {
  overflow-y: scroll;
  background-color: white;
  padding: 20px;
  padding-bottom: 5rem;
  border-radius: 0;
  width: 337px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  height: 100vh;
}

.range-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  color: #000;
  margin-bottom: 1rem;
}

.slider-container {
  width: 150px;
  /* margin: 100px auto; */
}

.number-input-wrapper input {
  padding: 2px 10px;
  border: none;
  border-radius: 30px;
  box-sizing: border-box;
  text-align: center;
  background: #f2f2f2;
  width: 50px;
}

.slider-output {
  padding: 2px 10px;
  border: none;
  border-radius: 30px;
  box-sizing: border-box;
  text-align: center;
  background: #f2f2f2;
  width: 50px;
}

.slider {
  padding: 0;
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #000;
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1b2de7 !important;
  cursor: pointer;
  outline: 1px solid rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1b2de7;
  cursor: pointer;
  border: none;
}

.slider:focus {
  outline: none;
}

.setting-label {
  font-size: 14px;
  color: gray;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.effect-spinner {
  display: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 9px solid;
  border-color: #dbdcef;
  border-right-color: #474bff;
  animation: spinner-d3wgkg 1s infinite linear;
}

@keyframes spinner-d3wgkg {
  to {
    transform: rotate(1turn);
  }
}




/* Stickers and elements panel specific styles */
.sticker-options {
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.sticker-item {
  position: relative;
  cursor: pointer;
}

.sticker-item:hover {
  border-color: #007bff;
  transform: scale(1.05);
}

.sticker-image {
  border-radius: 8px;
  width: 65px;
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0c66e40d;
  object-fit: contain;
  padding: 0.5rem;
}

.loading {
  width: 100%;
  text-align: center;
  padding: 20px;
  color: #666;
  font-style: italic;
}

#sentinel {
  width: 100%;
  height: 20px;
  background: transparent;
}







@media (max-width: 768px) {
  .editor-container {
    background-color: #fff;
  }

  .tool-panels::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 18px;
    width: 40px;
    height: 4px;
    background-color: #D9D9D9;
    border: 1px solid #D9D9D9;
    border-radius: 30px;
  }

  #editor-header .header-left #fileButton {
    display: none;
  }

  .editor-container .editor-body {
    display: unset;
  }

  .bottom-bar {
    display: none;
  }

  .toggle-panel-button-container {
    display: none;
  }

  .editor-container {
    flex-direction: column;
  }

  .sidebar {
    position: absolute;
    bottom: -27px;
    z-index: 99;
    width: 100%;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-top: 1px solid #e0e0e0;
  }


  ::-webkit-scrollbar {
    width: unset !important;
  }

  .sidebar-tool {
    padding: 8px 20px !important;
    flex-direction: row;
    gap: 5px;
    margin-bottom: 0px;
  }

  .sidebar-tool svg {
    margin-bottom: 0;
  }

  .tool-panels {
    /* display: flex !important;
    justify-content: center; */
    transition: top 0.3s ease;
    padding: 2.5rem 0 !important;
    width: 100%;
    height: 100% !important;
    border-left: none;
    border-top: 1px solid #e0e0e0;
    overflow-y: scroll;
    height: 500px;
    position: absolute;
    top: 60px;
    bottom: 0px;
    z-index: 99;
    /* padding-bottom: 4rem; */
    border-radius: 30px;
  }

  .canvas-container {
    height: 80vh;
  }

  .canvas-wrapper {
    height: auto !important;
  }

  .bottom-bar {
    left: 0;
  }
}