#cropbox-container,
#cropbox-container *,
#cropbox-container *::before,
#cropbox-container *::after {
  box-sizing: border-box;
}

#cropbox-container {
  width: 100%;
  max-width: var(--wp--style--global--content-size);
  margin: 0 auto;
  padding: 1.5rem 0;
}

#cropbox-container section {
  margin-top: 1.5rem;
}

#cropbox-container .d-flex {
  display: flex;
}

#cropbox-container .flex-wrap {
  flex-wrap: wrap;
}

#cropbox-container .align-items-center {
  align-items: center;
}

#cropbox-container .align-items-end {
  align-items: flex-end;
}

#cropbox-container .gap-2,
#cropbox-container .g-2 {
  gap: 0.5rem;
}

#cropbox-container .mt-1 { margin-top: 0.25rem; }
#cropbox-container .mt-2 { margin-top: 0.5rem; }
#cropbox-container .mt-3 { margin-top: 1rem; }
#cropbox-container .mt-4 { margin-top: 1.5rem; }
#cropbox-container .mb-1 { margin-bottom: 0.25rem; }
#cropbox-container .mb-2 { margin-bottom: 0.5rem; }
#cropbox-container .mb-3 { margin-bottom: 1rem; }
#cropbox-container .ms-2 { margin-left: 0.5rem; }
#cropbox-container .p-3 { padding: 1rem; }

#cropbox-container .d-none {
  display: none !important;
}

#cropbox-container .d-block {
  display: block !important;
}

#cropbox-container .text-secondary { color: #6c757d; }
#cropbox-container .text-danger { color: #dc3545; }
#cropbox-container .fw-normal { font-weight: 400; }
#cropbox-container .user-select-none { user-select: none; }

#cropbox-container .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#cropbox-container .col-4 {
  flex: 0 0 calc(33.333333% - 0.5rem);
  max-width: calc(33.333333% - 0.5rem);
}

#cropbox-container .col-auto {
  flex: 0 0 auto;
  width: auto;
}

#cropbox-container .form-label {
  display: block;
}

#cropbox-container .form-select,
#cropbox-container .form-control {
  display: block;
  width: 100%;
  min-height: 2rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  background-color: #fff;
  color: #333;
  font: inherit;
}

#cropbox-container .form-select-sm,
#cropbox-container .form-control-sm {
  min-height: 1.85rem;
  padding: 0.2rem 0.45rem;
}

#cropbox-container .form-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

#cropbox-container .form-check-input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

#cropbox-container .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  background: transparent;
  color: #333;
  font: inherit;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
}

#cropbox-container .btn:disabled {
  opacity: 0.65;
  cursor: default;
}

#cropbox-container .btn-sm {
  padding: 0.25rem 0.5rem;
}

#cropbox-container .btn-primary {
  border-color: #337ab7;
  background: #337ab7;
  color: #fff;
}

#cropbox-container .btn-outline-primary {
  border-color: #337ab7;
  color: #337ab7;
}

#cropbox-container .btn-outline-primary:hover,
#cropbox-container .btn-outline-primary:focus,
#cropbox-container .btn-outline-primary.selected {
  background: #337ab7;
  color: #fff;
}

#cropbox-container .btn-outline-secondary {
  border-color: #6c757d;
  color: #6c757d;
}

#cropbox-container .dropdown {
  position: relative;
}

#cropbox-container .dropdown-toggle::after {
  display: inline-block;
  margin-left: 0.3rem;
  vertical-align: 0.15em;
  content: "";
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-left: 0.3em solid transparent;
}

#cropbox-container .dropdown-menu {
  position: absolute;
  z-index: 1000;
  display: none;
  min-width: 10rem;
  margin: 0.125rem 0 0;
  padding: 0.5rem 0;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 0.25rem;
  background: #fff;
  list-style: none;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.12);
}

#cropbox-container .dropdown-menu.show {
  display: block;
}

#cropbox-container .dropdown-item {
  display: block;
  width: 100%;
  padding: 0.3rem 1rem;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
}

#cropbox-container .dropdown-item:hover,
#cropbox-container .dropdown-item:focus {
  background: #f2f2f2;
}

#serviceBtns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#imgDropArea {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90%;
  height: 70px;
  margin-top: 10px;
  border: 2px dashed #ccc;
  border-radius: 4px;
  background: #fafafa;
  color: #999;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.3s;
}

#imgDropArea.loaded { color: #333; }

#imgDropArea.drag-over {
  animation: glowDropArea 5s ease;
}

@keyframes glowDropArea {
  0% { background: rgba(255, 255, 0, 0.3); }
  50% { background: rgba(255, 255, 0, 0.1); }
  100% { background: transparent; }
}

#cropbox-container .service-btn {
  min-width: 7rem;
  padding: 0.35rem 0.55rem;
}

#cropbox-container .service-btn.selected {
  border-color: #337ab7 !important;
  background: #337ab7 !important;
  color: #fff !important;
}

#canvas-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90%;
  max-width: 600px;
  aspect-ratio: 1 / 1;
  margin: auto;
  overflow: hidden;
  border: 2px solid rgba(100, 100, 100, 0.4);
}

.checkerboard {
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
  background-image: linear-gradient(90deg, #ccc 50%, #eee 50%), linear-gradient(90deg, #ccc 50%, #eee 50%);
}

#cropbox-container .cropper-container .cropper-view-box,
#cropbox-container .cropper-container .cropper-face {
  background: none !important;
  outline: 2px solid #f00 !important;
  outline-offset: 0 !important;
}

#cropbox-container .cropper-container .cropper-modal,
#cropbox-container .cropper-container .cropper-drag-box {
  background: none !important;
}

#cropbox-container .dropdown-menu.p-3 .custom-input {
  min-width: 6.5rem;
}

#rotateL,
#rotateR,
#zoomReset {
  min-width: 7rem;
  border-color: #337ab7 !important;
  background: #fff !important;
  color: #337ab7 !important;
  transition: background 0.15s, color 0.15s;
}

#rotateL:hover,
#rotateR:hover,
#zoomReset:hover,
#rotateL:focus,
#rotateR:focus,
#zoomReset:focus {
  background: #337ab7 !important;
  color: #fff !important;
}

#downloadBtn {
  min-width: 10.5rem;
  padding: 0.675rem 1.125rem;
  font-size: 1.125rem;
  line-height: 1.5;
}

@media (min-width: 576px) {
  #cropbox-container .col-sm-2 {
    flex-basis: calc(16.666667% - 0.5rem);
    max-width: calc(16.666667% - 0.5rem);
  }

  #cropbox-container .col-sm-3 {
    flex-basis: calc(25% - 0.5rem);
    max-width: calc(25% - 0.5rem);
  }
}

@media (max-width: 575.98px) {
  #cropbox-container .col-4 {
    flex-basis: 100%;
    max-width: 100%;
  }

  #imgDropArea,
  #canvas-wrapper {
    width: 100%;
  }
}
