/* Editor styles */
/* === Base Layout (Mobile First) === */
.snap-editor {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background-color: #f9f9f9;
}
.snap-editor button {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}
.snap-editor img {
  max-width: 100%;
  height: auto;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}
.snap-editor section {
  width: auto;
  padding: 0;
  text-align: left;
}
.snap-editor #page-wrapper {
  display: flex;
  flex-direction: column; /* default mobile layout */
}
.snap-editor #content{
  order: 1;
  height: auto; /*previously 540px*/
  width: 100vw; /*previously 1440px*/
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.snap-editor .toolbar{
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.snap-editor #toolbar-bottom{
  padding: 16px 12px;
  background-color: #E0E0E0; /*#f5f5f5;*/
  /* border-radius: 8px; */
  /* box-shadow: 0 13px 5px #00000003,0 7px 4px #0000000d,0 3px 3px #00000017,0 1px 2px #0000001a; */
  transition: border-radius 0.2s ease-in-out; /* Smooth transition for rounding */
  position: relative; /* Needed for z-index if overlapping */
  z-index: 10; /* Ensure it's above the aspect ratio row visually if needed */
}
.snap-editor #toolbar-top{
  margin-bottom: 16px;
}
.snap-editor #toolbar-top a, .snap-editor #toolbar-bottom a{
  text-decoration: none;
  color: #424242;
  font-size: 24px;
}
.snap-editor #toolbar-bottom{
  order: 3;
  margin-top: 0;
}
.snap-editor .toolbar-button {
  /* display: flex; */
  border: none;
  border-radius: 8px;
  padding: 8px 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  vertical-align: middle; /* Align icon and text */
  text-decoration: none;
  color: #424242;
}
.snap-editor .toolbar-button:hover {
    background-color: #b8b8b8; /* Add hover effect */
}
.snap-editor .toolbar-button svg {
    vertical-align: middle; /* Align icon better */
}
.snap-editor .toolbar-button span {
    vertical-align: middle; /* Align text better */
    margin-left: 4px; /* Space between icon and text */
}
.snap-editor .toolbar-button.dark {
  background-color: #BDBDBD;
}
.snap-editor .toolbar-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.snap-editor #downloadBtn {
  background-color: #fc5303;
  color: #fff;
  font-weight: 700;
}
.snap-editor #downloadBtn:hover {
  background-color: #ff8103;
}
.snap-editor #settingscontainer h2 {
  margin: 0 0 18px;
  color: #424242;
}
.snap-editor .customize-section {
  margin-bottom: 24px;
}
.snap-editor .customize-section h3 {
  margin: 0 0 10px;
  color: #777985;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.snap-editor .control-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.snap-editor .control-header h3 {
  margin: 0;
}
.snap-editor .control-value {
  color: #424242;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}
.snap-editor .section-toggle {
  display: none;
}
.snap-editor #aspectRatioRow {
  display: block;
  width: 100%;
  box-sizing: border-box;
}
/* Style the form inside the size section */
.snap-editor #aspectRatioRow #ratioForm {
    display: flex;
    justify-content: space-around; /* Distribute buttons */
    align-items: center;
    gap: 8px; /* Space between buttons */
    flex-wrap: wrap; /* Allow wrapping on smaller screens if needed */
}
/* Adjust ratio buttons for horizontal layout */
.snap-editor #aspectRatioRow .ratio-btn {
   width: auto; /* Let content determine width */
   padding: 6px 10px; /* Adjust padding */
   flex-grow: 1; /* Allow buttons to grow */
   margin: 0; /* Remove default vertical margin */
   min-width: 80px; /* Ensure minimum tap target size */
}
/* Ensure label takes full width for flexbox */
.snap-editor #aspectRatioRow label {
    flex-basis: calc(50% - 4px); /* Two buttons per row, adjust gap */
    display: flex; /* Use flex for label content */
    justify-content: center;
}
/* Remove line breaks */
.snap-editor #aspectRatioRow br {
    display: none;
}
.snap-editor .background-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: #d4d4d8;
  border-radius: 10px;
}
.snap-editor .background-tab {
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: #777985;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.snap-editor .background-tab.active {
  background: #fff;
  color: #222;
  box-shadow: 0 2px 5px rgba(0,0,0,0.12);
}
.snap-editor .background-options {
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.snap-editor .background-options.active {
  display: grid;
}
.snap-editor #settingscontainer{
  order: 4;
  width: 244px;
  background-color: #E0E0E0;  /*#f5f5f5;*/  
  border-radius: 0 0 8px 8px;
  padding: 24px;
  width: 100%;
  margin-top: 2px;
  box-sizing: border-box;
  box-shadow: 0px -5px 0px #d4d4d8;
}
.snap-editor #imgcontainer{
  display: flex;
  position: relative;
  aspect-ratio: 1 / 1;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 540px; /* Limits width, scales height automatically */
  min-width: 300px;
  height: auto; /* Let height adjust with aspect-ratio */
  margin: auto;
  padding: 8%;
  background: linear-gradient(135deg, rgba(255,129,3,1) 12.8%, rgba(252,83,3,1) 84.34%);
  text-align: center;
  box-sizing: border-box;
  box-shadow: 0 13px 5px #00000003,0 7px 4px #0000000d,0 3px 3px #00000017,0 1px 2px #0000001a;
  filter: drop-shadow(0 28px 11px rgba(0,0,0,.01)) drop-shadow(0 16px 10px rgba(0,0,0,.05)) drop-shadow(0 7px 7px rgba(0,0,0,.09));
  transition: 0.5s;
}
.snap-editor #imgcontainer img{
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-sizing: border-box;
  border: solid 16px #fff;
  border-radius: 8%;
  box-shadow: 0 28px 11px 5px rgba(0, 0, 0, 0.01),
            0 16px 10px rgba(0, 0, 0, 0.05),
            0 7px 7px rgba(0, 0, 0, 0.09);
  transition: 0.5s;  /* Smooth hover effects */
}
.snap-editor #file{
  display: none;
}
.snap-editor #imgcontainer img {
   cursor: pointer;
   max-width: 100%;
   height: auto;
}
/* Settings for Aspect Ratio clickable sizes */
.snap-editor .ratio-btn {
  display: inline-block;
  padding: 8px;
  background-color: #BDBDBD;
  border: 2px solid #424242;
  border-radius: 8px;
  margin: 4px 0;
  cursor: pointer;
  width: 90%;
  text-align: center;
}
.snap-editor input[type="radio"] {
  display: none;
}
.snap-editor input[type="radio"]:checked + .ratio-btn {
    background-color: #fff3ed;
    color: #000;
    border-color: #fc5303;
}
/* Settings for Background Color clickable circles */
.snap-editor .color-circle {
  display: inline-block;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 2px solid #E0E0E0;
  margin: 0;
  /* margin-right:-12px; */
  cursor: pointer;
  transition: 0.2s;
}
.snap-editor input[type="radio"] {
  display: none;
}
.snap-editor input[type="radio"]:checked+.color-circle{
  /* border: 2px solid #424242; */
  box-shadow: rgb(255, 255, 255) 0px 0px 0px 1px, rgb(252, 83, 3) 0px 0px 0px 3px
}
.snap-editor .custom-color-label {
  position: relative;
  display: inline-block;
}
.snap-editor .custom-color-label.active .color-circle {
  border: 2px solid #424242;
}
.snap-editor .custom-color-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.snap-editor .slidecontainer {
  width: 100%;
}
.snap-editor .border-control-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.snap-editor .border-control-row .slidecontainer {
  flex: 1;
}
.snap-editor .border-color-label {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
}
.snap-editor .border-color-swatch {
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid #BDBDBD;
  border-radius: 10px;
  background: #fff;
  box-sizing: border-box;
  cursor: pointer;
  transition: 0.2s;
}
.snap-editor .border-color-label:focus-within .border-color-swatch,
.snap-editor .border-color-label:hover .border-color-swatch {
  box-shadow: rgb(255, 255, 255) 0px 0px 0px 1px, rgb(252, 83, 3) 0px 0px 0px 3px;
}
.snap-editor .crop-modal[hidden] {
  display: none;
}
.snap-editor .crop-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
  box-sizing: border-box;
}
.snap-editor .crop-dialog {
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  max-height: min(720px, 92vh);
  background: #f9f9f9;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}
.snap-editor .crop-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: #E0E0E0;
}
.snap-editor .crop-dialog-header h2 {
  margin: 0;
  color: #424242;
  font-size: 1.35rem;
}
.snap-editor .crop-dialog-header p {
  margin: 4px 0 0;
  color: #777985;
}
.snap-editor .crop-close-button {
  font-size: 1.8rem;
  line-height: 1;
  padding: 2px 10px;
}
.snap-editor .crop-stage {
  min-height: 280px;
  height: min(58vh, 520px);
  padding: 16px;
  background: #161616;
  box-sizing: border-box;
}
.snap-editor #cropPreview {
  display: block;
  max-width: 100%;
  max-height: 100%;
}
.snap-editor .crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  background: #E0E0E0;
}
.snap-editor #applyCropBtn {
  background-color: #fc5303;
  color: #fff;
  font-weight: 700;
}
.snap-editor .slider {
  width: 100%;
  height: 15px;
  border-radius: 24px;
  background: #BDBDBD;
  outline: none;
  opacity: 0.7;
  -webkit-transition: .2s;
  transition: opacity .2s;
  accent-color: #fc5303;
}
.snap-editor .slider:hover {
  opacity: 1;
}
.snap-editor .slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #424242;
  cursor: pointer;
}

.snap-editor .slider::-moz-range-thumb {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #424242;
  cursor: pointer;
}
@media (max-width: 767px) {
  .snap-editor .size-section h3 {
    display: none;
  }
  .snap-editor .section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    padding: 0 0 12px;
    background: transparent;
    color: #777985;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  .snap-editor .section-toggle-summary {
    color: #424242;
    letter-spacing: 0;
    text-transform: none;
  }
  .snap-editor .section-toggle-icon {
    color: #424242;
    font-size: 1rem;
    letter-spacing: 0;
    transition: transform 0.2s ease;
  }
  .snap-editor .section-toggle[aria-expanded="true"] .section-toggle-icon {
    transform: rotate(180deg);
  }
  .snap-editor #aspectRatioRow.section-collapse {
    display: none;
  }
  .snap-editor #aspectRatioRow.section-collapse.open {
    display: block;
  }
}
/* === Desktop Layout (Screen >= 768px) === */
@media only screen and (min-width: 768px) {
  .snap-editor {
    /* Define a smaller scale for more compact screens */
    --image-scale-small: 0.5;
    --image-small-size: calc(1080px * var(--image-scale-small));
  }
  .snap-editor #page-wrapper {
    flex-direction: row; /* desktop switches to horizontal */
    align-items: flex-start;
    /* gap: 23px; */
    padding: 0;
    flex-wrap: wrap;
  }
  .snap-editor #toolbar-top {
    /* width: 100%; */ /* Removed for flex behaviour */
    padding: 0 24px;
    margin-bottom: 0;
    order: 1; /* Top toolbar first */
  }
  .snap-editor #content{
    order: 3;
    flex-grow: 1;
    max-width: 540px;
    height: auto;
    margin: 24px auto 0;
  }
  .snap-editor #imgcontainer{
    flex: 1 1 auto;
    max-height: 100%; /* Previously 540px - Important! Sets max-height for mobile and desktop */
    max-width: 100%;
    width: auto; /* Width will adjust automatically based on aspect-ratio */
    margin: auto;
  }
  .snap-editor #imgcontainer img:hover {
    transform: scale(1.05);/* Subtle zoom effect */
  }
  .snap-editor #settingscontainer {
    order: 2;
    flex: 0 0 25%; /* fixed sidebar width */
    margin: 2px 24px 0 0;
    padding: 19px;
  }
  .snap-editor #toolbar-bottom {
    display: flex;
    justify-content: space-between;
    order: 1;
    width: 100%;
    margin-top: 0;
    align-self: flex-start; /* Align with the start of the flex container */
  }
  .snap-editor #aspectRatioRow {
    display: block;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}
}
