/* __V3D_TEMPLATE__ - template-based file; delete this line to prevent this file from being updated */
* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  box-sizing: border-box;
  font-family: "Roboto", sans-serif;
}

body {
  margin: 0px;
  overflow: hidden;
}

#v3d-container {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100%;
}

.cf_button.cf_sticker-button {
  background: linear-gradient(135deg, #4d97e7 0%, #6a7cfb 100%) !important;
  color: white !important;
}

.cf_block.cf_sticker {
  margin-bottom: 0 !important;
}



/* Mobile Layout Adjustments */
@media (max-width: 768px) {

  /* Canvas Container Mobile */
  #myClass {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-height: 70vh !important;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0.9;
  }

  /* Canvas Wrapper Mobile */
  .cf_canvas__wrapper {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 15px !important;
  }

  /* Canvas Content Mobile - Keep original size */
  .konvajs-content {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px !important;
  }

  /* Tools Container Mobile */
  .cf_tools-container {
    width: 100% !important;
    order: 2 !important;
  }

  .cf_tools-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding: 15px !important;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 15px;
    margin: 0 15px 15px !important;
    opacity: 0.85;
    position: relative;
    transition: all 0.3s ease;
  }

  /* Tools Close Button Mobile */
  .cf_tools-close {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    background: rgba(220, 53, 69, 0.1) !important;
    color: #dc3545 !important;
    border: 1px solid rgba(220, 53, 69, 0.2) !important;
    font-size: 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 10 !important;
    transition: all 0.2s ease !important;
  }

  .cf_tools-close:hover {
    background: rgba(220, 53, 69, 0.2) !important;
    transform: scale(1.1) !important;
  }

  /* Tools Toggle Button - Show when tools are hidden */
  .cf_tools-toggle {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #4d97e7 0%, #6a7cfb 100%) !important;
    color: white !important;
    border: none !important;
    font-size: 18px !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 1001 !important;
    box-shadow: 0 4px 15px rgba(77, 151, 231, 0.3) !important;
    transition: all 0.3s ease !important;
  }

  .cf_tools-toggle:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(77, 151, 231, 0.4) !important;
  }

  .cf_tools-toggle.show {
    display: flex !important;
  }

  /* Hidden state for tools wrapper */
  .cf_tools-wrapper.hidden {
    transform: translateY(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Drawing Block Mobile */
  .cf_block.cf_drawing {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 12px !important;
    background: rgba(77, 151, 231, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(77, 151, 231, 0.08);
    opacity: 0.9;
  }

  /* Text Block Mobile */
  .cf_block.cf_text {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 12px !important;
    background: rgba(76, 175, 80, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(76, 175, 80, 0.08);
    opacity: 0.9;
  }

  /* Image Blocks Mobile */
  .cf_block.cf_image {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px !important;
  }

  /* Buttons Mobile */
  .cf_button {
    min-height: 40px !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    transition: all 0.2s ease !important;
  }

  .cf_button.cf_image-wrapper {
    background: linear-gradient(135deg, #4d97e7 0%, #6a7cfb 100%) !important;
    color: white !important;
    min-width: 120px !important;
  }

  .cf_button.cf_text-add {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%) !important;
    color: white !important;
    min-width: 120px !important;
  }

  /* Input Controls Mobile */
  .cf_drawing-size,
  .cf_text-size {
    width: 50px !important;
    height: 35px !important;
    padding: 5px 8px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
  }

  .cf_drawing-color,
  .cf_text-color {
    width: 35px !important;
    height: 35px !important;
    border: 2px solid #fff !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  }

  .cf_text-font {
    min-width: 100px !important;
    height: 35px !important;
    padding: 5px 8px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
  }

  /* Checkbox Labels Mobile */
  .cf_label-checkbox {
    width: 35px !important;
    height: 35px !important;
    border-radius: 8px !important;
    background: #f8f9fa !important;
    border: 2px solid #dee2e6 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
  }

  .cf_drawing-enable:checked+.cf_label-checkbox {
    background: #4d97e7 !important;
    border-color: #4d97e7 !important;
    color: white !important;
  }

  /* Close Button Mobile */
  #closecanvas {
    position: absolute !important;
    top: 12px !important;
    right: 15px !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: rgba(220, 53, 69, 0.1) !important;
    color: #dc3545 !important;
    border: 1px solid rgba(220, 53, 69, 0.2) !important;
    font-size: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    cursor: pointer !important;
  }


}

/* Small Mobile */
@media (max-width: 480px) {

  .cf_canvas__wrapper {
    padding: 10px !important;
  }

  .cf_tools-wrapper {
    margin: 0 10px 10px !important;
    padding: 12px !important;
  }

  .cf_button {
    min-height: 38px !important;
    font-size: 13px !important;
    padding: 6px 12px !important;
  }

  .cf_button.cf_image-wrapper,
  .cf_button.cf_text-add {
    min-width: 100px !important;
  }

  .cf_drawing-size,
  .cf_text-size {
    width: 45px !important;
    height: 32px !important;
    font-size: 13px !important;
  }

  .cf_text-font {
    min-width: 80px !important;
    height: 32px !important;
    font-size: 13px !important;
  }

  .cf_drawing-color,
  .cf_text-color {
    width: 32px !important;
    height: 32px !important;
  }

  .cf_label-checkbox {
    width: 32px !important;
    height: 32px !important;
  }

  #closecanvas {
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
    top: 10px !important;
    right: 12px !important;
  }

  .cf_tools-close {
    width: 24px !important;
    height: 24px !important;
    font-size: 12px !important;
    top: 6px !important;
    right: 6px !important;
  }

  .cf_tools-toggle {
    width: 45px !important;
    height: 45px !important;
    bottom: 15px !important;
    right: 15px !important;
  }

  .cf_tools-toggle svg {
    width: 20px !important;
    height: 20px !important;
  }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  #myClass {
    max-height: 85vh !important;
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    border-radius: 15px !important;
  }



  .cf_tools-wrapper {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
}

/* Touch Optimizations */
@media (hover: none) and (pointer: coarse) {
  .cf_button {
    min-height: 44px !important;
    min-width: 44px !important;
  }

  .cf_drawing-color,
  .cf_text-color {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  .cf_label-checkbox {
    min-width: 44px !important;
    min-height: 44px !important;
  }
}

/* Hide toggle button and close button on desktop */
@media (min-width: 769px) {

  .cf_tools-toggle,
  .cf_tools-close {
    display: none !important;
  }
}

#preloader {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 99;

  display: flex;
  align-items: center;
  justify-content: center;

  background: white;
}

#preloader .preloader__logo svg {
  width: 400px;
  height: 130px;
}

#preloader .preloader__progress {
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  padding-left: 35px;
}

.fullscreen-button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 50px;
  height: 50px;
  cursor: pointer;
  background-size: 100% 100%;
  display: none;
  z-index: 1;
}

.fullscreen-open {
  background-image: url('media/fullscreen_open.svg');
}

.fullscreen-close {
  background-image: url('media/fullscreen_close.svg');
}

/* Popup Remove BG Modern UI */
.remove-bg-container {
  position: relative;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 22px;
  box-shadow: 0 8px 32px rgba(40, 60, 120, 0.18);
  padding: 32px 28px 28px 28px;
  max-width: 420px;
  width: 95%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: fadeIn 0.25s cubic-bezier(.4, 1.4, .6, 1);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  overflow: hidden;
  z-index: 10;
  transition: box-shadow 0.25s, backdrop-filter 0.25s, transform 0.18s;
}

.remove-bg-container::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.32) 0%, rgba(77, 151, 231, 0.10) 100%);
  backdrop-filter: blur(18px) saturate(1.4) brightness(1.12);
  opacity: 0.92;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  pointer-events: none;
  transition: backdrop-filter 0.25s, opacity 0.25s;
}

.remove-bg-container::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  width: 180%;
  height: 180%;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(ellipse at 60% 0%, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0.08) 60%, transparent 100%),
    linear-gradient(120deg, rgba(77, 151, 231, 0.08) 0%, rgba(255, 255, 255, 0.10) 100%);
  opacity: 0.55;
  filter: blur(8px);
  transition: opacity 0.25s, filter 0.25s, transform 0.25s;
  transform: translate(-50%, -10%) scale(1.05);
}

.remove-bg-container:hover {
  box-shadow: 0 12px 48px 0 rgba(77, 151, 231, 0.22), 0 1.5px 8px 0 rgba(255, 255, 255, 0.18);
  transform: scale(1.025);
}

.remove-bg-container:hover::before {
  backdrop-filter: blur(26px) saturate(1.6) brightness(1.18);
  opacity: 1;
}

.remove-bg-container:hover::after {
  opacity: 0.72;
  filter: blur(12px) brightness(1.12);
  transform: translate(-50%, -4%) scale(1.09);
  animation: glassHighlightMove 1.6s cubic-bezier(.4, 1.4, .6, 1) infinite alternate;
}

@keyframes glassHighlightMove {
  0% {
    transform: translate(-50%, -10%) scale(1.05);
    opacity: 0.55;
  }

  100% {
    transform: translate(-50%, -4%) scale(1.09);
    opacity: 0.72;
  }
}

/* Đảm bảo nội dung trên layer 1 */
.remove-bg-container>* {
  position: relative;
  z-index: 3;
}

.remove-bg-container h3 {
  font-size: 1.35rem;
  font-weight: 600;
  color: #2a3550;
  margin-bottom: 0.5em;
  letter-spacing: 0.01em;
}

.remove-bg-button {
  background: linear-gradient(90deg, #4d97e7 0%, #6a7cfb 100%);
  color: #fff;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(77, 151, 231, 0.08);
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
}

.remove-bg-button:hover {
  background: linear-gradient(90deg, #3d7bc8 0%, #4d97e7 100%);
  box-shadow: 0 4px 16px rgba(77, 151, 231, 0.13);
  transform: translateY(-2px) scale(1.03);
}

.remove-bg-process {
  background: linear-gradient(90deg, #4caf50 0%, #6adf7c 100%);
  color: #fff;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.08);
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
}

.remove-bg-process:hover {
  background: linear-gradient(90deg, #3d9c3d 0%, #4caf50 100%);
  box-shadow: 0 4px 16px rgba(76, 175, 80, 0.13);
  transform: translateY(-2px) scale(1.03);
}

.remove-bg-add-to-canvas {
  background: linear-gradient(90deg, #4d97e7 0%, #6a7cfb 100%);
  color: #fff;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(77, 151, 231, 0.08);
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
}

.remove-bg-add-to-canvas:hover {
  background: linear-gradient(90deg, #3d7bc8 0%, #4d97e7 100%);
  box-shadow: 0 4px 16px rgba(77, 151, 231, 0.13);
  transform: translateY(-2px) scale(1.03);
}

.remove-bg-preview {
  width: 100%;
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 8px;
}

.preview-original,
.preview-result {
  flex: 1;
  min-width: 160px;
  text-align: center;
  background: #f7f9fc;
  border-radius: 10px;
  padding: 12px 8px 18px 8px;
  box-shadow: 0 1px 4px rgba(77, 151, 231, 0.06);
}

.preview-original img,
.preview-result img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 6px;
  margin-top: 4px;
  box-shadow: 0 2px 8px rgba(77, 151, 231, 0.10);
}

.preview-original p,
.preview-result p {
  color: #6a7cfb;
  font-weight: 500;
  margin-bottom: 0.5em;
}

.remove-bg-loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.97);
  padding: 28px 36px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(77, 151, 231, 0.13);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading-dots span {
  width: 12px;
  height: 12px;
  background: #4d97e7;
  border-radius: 50%;
  animation: loading 1.4s infinite ease-in-out;
}

.cart-section {
  padding: 25px 39px 25px 25px;
  position: fixed;
  /* bottom: 444px; */
  z-index: 1000;
  transform-style: preserve-3d;
  background-color: #fffffff2;
  border-radius: 0 20px 20px 0;
  box-shadow: 0 20px 100px #c4cae340;
  transition: all 0.3s ease;
}

.cart-section .cart-button {
  background: linear-gradient(135deg, #4d97e7 0%, #6a7cfb 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(77, 151, 231, 0.3);
  transition: all 0.3s ease;
  font-family: 'Roboto', sans-serif;
}

.cart-section .cart-button:hover {
  background: linear-gradient(135deg, #3d7bc8 0%, #5a6cf5 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(77, 151, 231, 0.4);
}

.cart-section .cart-button:active {
  transform: translateY(0);
}

/* Cart button loading state */
.cart-section .cart-button.loading {
  opacity: 0.6;
  filter: blur(1px);
  cursor: not-allowed;
  pointer-events: none;
}

.cart-section .cart-button.loading:hover {
  transform: none;
  background: linear-gradient(135deg, #4d97e7 0%, #6a7cfb 100%);
  box-shadow: 0 4px 12px rgba(77, 151, 231, 0.3);
}

/* Cart loading overlay */
.cart-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.cart-loading-overlay.show {
  display: flex;
}

.cart-loading-popup {
  background: white;
  padding: 30px 40px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: popIn 0.3s ease;
}

.cart-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4d97e7;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.cart-loading-text {
  font-size: 16px;
  color: #333;
  font-weight: 500;
  font-family: 'Roboto', sans-serif;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes loading {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

#close-remove-bg {
  background: #f0f0f0;
  color: #333;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(77, 151, 231, 0.08);
  position: absolute;
  top: 10px;
  right: 10px;
  transition: background 0.18s;
}

#close-remove-bg:hover {
  background: #e0e0e0;
}

@media (max-width: 600px) {
  .remove-bg-container {
    padding: 18px 4vw 18px 4vw;
    max-width: 98vw;
  }

  .remove-bg-loading {
    padding: 18px 4vw;
  }

  .preview-original,
  .preview-result {
    min-width: 120px;
    padding: 8px 2vw 12px 2vw;
  }
}