/* --- Seamless Carousel Maker Styles --- */

/* Editor Layout */
.card-header {
  padding: 12px 20px;
  border-bottom: 1px solid #f2f4f6;
  background: #fff;
  z-index: 30; /* Higher than canvas */
  flex-shrink: 0;
  position: relative;
}

.header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-text {
  font-size: 14px;
  color: #6b7684;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f9fafb;
  font-weight: 500;
}
.btn-text:hover {
  background-color: #f2f4f6;
  color: #333d4b;
}

.editor-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e8eb;
}

.color-label {
  font-size: 13px;
  font-weight: 600;
  color: #6b7684;
  margin: 0;
}

.btn-primary.small {
  width: auto;
  height: 36px;
  padding: 0 16px;
  font-size: 14px;
}

.editor-main-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.editor-canvas-container {
  flex: 1;
  background-color: #e5e8eb;
  overflow-x: scroll !important;
  overflow-y: hidden !important;
  position: relative;
  scrollbar-width: auto;
  scrollbar-color: #4e5968 #d0d5dd;
  display: flex;
  align-items: center;
}

/* Custom scrollbar track - ALWAYS visible */
.editor-canvas-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(to bottom, #d0d5dd 0%, #d0d5dd 100%);
  border-top: 2px solid #b0b8c1;
  pointer-events: none;
  z-index: 1;
}

/* Chrome/Safari scrollbar */
.editor-canvas-container::-webkit-scrollbar {
  height: 24px !important;
  width: 24px !important;
}
.editor-canvas-container::-webkit-scrollbar-track {
  background: #d0d5dd !important;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.2);
}
.editor-canvas-container::-webkit-scrollbar-thumb {
  background-color: #4e5968 !important;
  border-radius: 10px;
  border: 6px solid #d0d5dd;
  min-width: 80px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.editor-canvas-container::-webkit-scrollbar-thumb:hover {
  background-color: #333d4b !important;
}
.editor-canvas-container::-webkit-scrollbar-thumb:active {
  background-color: #1a1f2e !important;
}

/* Firefox scrollbar */
.editor-canvas-container {
  scrollbar-width: thick !important;
  scrollbar-color: #4e5968 #d0d5dd !important;
}

/* Canvas Navigation Buttons */
.canvas-nav-btn {
  position: fixed !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  border: 4px solid #0070ff;
  font-size: 36px;
  font-weight: bold;
  color: #0070ff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999 !important;
  transition: all 0.2s;
  line-height: 1;
  pointer-events: auto !important;
  user-select: none;
}
.canvas-nav-btn:hover {
  background: #0070ff;
  color: white;
  transform: translateY(-50%) scale(1.2) !important;
  box-shadow: 0 6px 24px rgba(0,112,255,0.6);
}
.canvas-nav-btn:active {
  transform: translateY(-50%) scale(1.05) !important;
}
.canvas-nav-btn.prev {
  left: 30px !important;
}
.canvas-nav-btn.next {
  right: 30px !important;
}

.scroll-area {
  display: flex;
  align-items: center;
  padding: 40px 20px 50px 20px; /* Extra bottom padding for custom scrollbar */
  min-width: fit-content;
  height: 100%;
  box-sizing: border-box;
  gap: 10px;
}

.canvas-wrapper {
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  background: white;
  position: relative;
  flex-shrink: 0;
  display: inline-block; /* Prevent height collapse */
}

.canvas-guides-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  z-index: 100;
}

.add-slide-btn {
  width: 50px;
  align-self: stretch; /* Match parent height */
  background: rgba(255, 255, 255, 0.5);
  border: 2px dashed #b0b8c1;
  border-radius: 0 12px 12px 0;
  margin-left: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6b7684;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.add-slide-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: #0070ff;
  color: #0070ff;
}

/* Gallery Tray */
.gallery-tray {
  height: 140px; /* Fixed height for tray */
  background: #fff;
  border-top: 1px solid #f2f4f6;
  padding: 16px;
  flex-shrink: 0;
  z-index: 20;
  position: relative; /* For nav buttons */
  display: flex;
  align-items: center;
}

.gallery-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  height: 100%;
  align-items: center; /* Center items vertically */
  padding: 0 40px; /* Space for buttons */
  flex: 1;
  /* Scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: #cdd2d8 #f2f4f6;
}
.gallery-scroll::-webkit-scrollbar {
  height: 8px;
}
.gallery-scroll::-webkit-scrollbar-track {
  background: #f2f4f6;
}
.gallery-scroll::-webkit-scrollbar-thumb {
  background-color: #cdd2d8;
  border-radius: 4px;
}

.gallery-item {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  cursor: grab;
  flex-shrink: 0;
  border: 1px solid #e5e8eb;
  position: relative;
}
.gallery-item:active {
  cursor: grabbing;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none; /* Important for drag */
}

.gallery-add-btn {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 1px dashed #b0b8c1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6b7684;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
  background: #f9fafb;
}
.gallery-add-btn:hover {
  background: #f2f4f6;
  border-color: #0070ff;
  color: #0070ff;
}
.gallery-add-btn .icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.gallery-tray .nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  font-size: 20px;
}
.gallery-tray .nav-btn.prev { left: 8px; }
.gallery-tray .nav-btn.next { right: 8px; }

/* Form Elements */
.form-group {
  margin-bottom: 32px;
}

.form-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #333d4b;
  margin-bottom: 12px;
}

.radio-group {
  display: flex;
  gap: 12px;
}

.radio-option {
  flex: 1;
  position: relative;
  cursor: pointer;
}

.radio-option input {
  position: absolute;
  opacity: 0;
}

.radio-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border: 2px solid #e5e8eb;
  border-radius: 12px;
  transition: all 0.2s;
  height: 100%;
}

.radio-option input:checked + .radio-box {
  border-color: #0070ff;
  background-color: #f0f7ff;
  color: #0070ff;
}

.radio-box strong {
  font-size: 16px;
  margin-bottom: 4px;
}

.radio-box .desc {
  font-size: 13px;
  color: #8b95a1;
}
.radio-option input:checked + .radio-box .desc {
  color: #4e5968;
}

/* Slider */
.slider-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

input[type="range"] {
  flex: 1;
  height: 6px;
  background: #e5e8eb;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: #fff;
  border: 2px solid #0070ff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.slider-value {
  font-size: 18px;
  font-weight: 700;
  color: #0070ff;
  min-width: 40px;
  text-align: right;
}

/* Result Grid */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.result-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.result-item img {
  width: 100%;
  display: block;
}

.result-number {
  position: absolute;
  top: 6px;
  left: 6px;
  background: #0070ff;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

/* Color Picker Customization */
input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  background: none;
  transition: transform 0.2s;
}
input[type="color"]:hover {
  transform: scale(1.1);
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: 3px solid #e5e8eb;
  border-radius: 8px;
}
input[type="color"]::-moz-color-swatch {
  border: 3px solid #e5e8eb;
  border-radius: 8px;
}

/* --- Safari 하단 주소창 대응 --- */
.app-container {
  padding-bottom: env(safe-area-inset-bottom);
}

.card-footer,
.card-footer-simple,
.card-footer.button-group {
  padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
}

/* (v8.3) 에디터 하단 트레이 대응 */
.gallery-tray {
  padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
  height: auto !important; /* 고정 높이 해제 */
  min-height: 140px;
}
