/* =========================================================================
   dopic.app [change-bg] Mobile Workbench Styles
   iOS Native Minimalist Card System
   ========================================================================= */

.m-hero-avatar-wrap,
.m-hero-illustration {
  display: none !important;
}

/* Mobile Main Tool Card (Initial State) */
.m-main-card {
  margin: 0.5rem 1rem 1.5rem 1rem;
  background: #ffffff;
  border-radius: 20px;
  padding: 1.5rem 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

/* Mobile Interactive Showcase Box */
.m-showcase-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.m-showcase-avatar-wrap {
  width: 180px;
  height: 220px;
  border-radius: 14px;
  margin: 0 auto 0.75rem auto;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.9);
  transition: background-color 0.22s ease;
}

.m-showcase-cutout-img {
  width: 100%;
  height: 100%;
  max-width: 180px;
  max-height: 220px;
  object-fit: contain;
  object-position: bottom center;
  pointer-events: none;
}

.m-showcase-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
}

.m-demo-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 0.4rem;
}

.m-demo-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #e2e8f0;
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.m-demo-dot.active {
  transform: scale(1.2);
  border-color: #2563eb;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2563eb;
}

.m-demo-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0;
  text-align: center;
}

/* Mobile Dual Upload Buttons */
.m-dual-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 0.75rem;
}

.m-btn-camera, .m-btn-album {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.m-btn-camera {
  background: #ea580c;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
}

.m-btn-camera:active {
  transform: scale(0.97);
  background: #c2410c;
}

.m-btn-album {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #e2e8f0;
}

.m-btn-album:active {
  transform: scale(0.97);
  background: #e2e8f0;
}

/* Mobile Loading Indicator */
#dropzoneLoading {
  display: none;
  padding: 1.5rem 0;
  text-align: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3.5px solid #e2e8f0;
  border-top-color: #ea580c;
  border-radius: 50%;
  animation: cbSpin 0.8s linear infinite;
  margin: 0 auto 1rem auto;
}

@keyframes cbSpin {
  to { transform: rotate(360deg); }
}

.loading-progress-bar {
  width: 180px;
  height: 4px;
  background: #f1f5f9;
  border-radius: 9999px;
  margin: 0.75rem auto 0 auto;
  overflow: hidden;
  position: relative;
}

.loading-progress-bar::after {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 40%;
  background: #ea580c;
  border-radius: 9999px;
  animation: cbProgress 1.4s ease-in-out infinite;
}

@keyframes cbProgress {
  0% { left: -40%; width: 30%; }
  50% { left: 40%; width: 50%; }
  100% { left: 100%; width: 30%; }
}

/* State 3: Studio Editing Mode */
#editorWrap {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
}

.preview-box {
  width: 100%;
  min-height: 240px;
  max-height: 46vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#f1f5f9 0% 25%, #ffffff 0% 50%) 50% / 16px 16px;
  border-radius: 16px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 0.75rem;
  margin-bottom: 0.25rem;
}

#previewCanvas {
  max-width: 100%;
  max-height: 42vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.color-sec-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.35rem;
}

.m-color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.m-color-dot-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 2px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  cursor: pointer;
  min-height: 46px;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.m-color-dot-btn:active {
  transform: scale(0.95);
}

.m-color-dot-btn.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.18);
  transform: translateY(-1px);
}

.m-color-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  display: inline-block;
  transition: transform 0.15s ease;
}

.m-color-dot-btn.active .m-color-circle {
  transform: scale(1.1);
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px #2563eb;
}

.m-editor-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: 0.5rem;
}

.m-btn-reset, .m-btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.m-btn-reset {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.m-btn-reset:active {
  transform: scale(0.97);
  background: #e2e8f0;
}

.m-btn-download {
  background: #ea580c;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.28);
}

.m-btn-download:active {
  transform: scale(0.97);
  background: #c2410c;
}

/* Two-State Studio Mode (body.is-editing) overrides */
body.is-editing .m-hero,
body.is-editing #keyPromptBanner,
body.is-editing .m-toolbox-sec,
body.is-editing #toolbox-sec {
  display: none !important;
}

body.is-editing .m-main-card {
  margin-top: 0.5rem;
  padding: 0.85rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

@media (max-width: 768px) {
  body.is-editing .m-editor-actions {
    position: sticky;
    bottom: calc(var(--tab-height, 60px) + env(safe-area-inset-bottom, 12px) + 8px);
    z-index: 90;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 10px 12px;
    margin-left: -0.85rem;
    margin-right: -0.85rem;
    margin-bottom: -0.85rem;
    border-top: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 0 0 var(--radius-xl, 20px) var(--radius-xl, 20px);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
  }
}
