:root {
  --card-bg: var(--surface);
  --card-border: var(--border);
  --card-shadow: var(--shadow);
}

.qr-panel {
  max-width: 1100px;
  margin: 0 auto;
}

.calc-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-header h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.card-header p {
  margin: 0;
  color: var(--muted);
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 700;
  color: var(--muted);
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.field-label {
  font-weight: 600;
  color: var(--muted);
}

.textarea-field textarea {
  min-height: calc(1.5rem * 1 + 24px);
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  resize: vertical;
}

.select-input,
.text-input,
.color-input,
.file-input {
  padding: 10px 12px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.file-input {
  padding: 10px 20px;
}

.file-drop-zone {
  cursor: pointer;
}

.file-drop-zone:hover .file-input-wrapper {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.05);
}

.file-input-wrapper {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  transition: all 0.3s ease;
  overflow: hidden;
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 8px;
  color: var(--muted);
  transition: color 0.3s ease;
}

.file-display i {
  font-size: 2rem;
}

.file-display span {
  font-size: 0.9rem;
  text-align: center;
}

.recent-logos {
  margin-top: 12px;
}

.recent-logos.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.recent-logos-header {
  margin-bottom: 8px;
}

.recent-logos-header span {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.recent-logos-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.recent-logo-item {
  width: 180px;
  height: 180px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all 0.2s ease;
  position: relative;
}

.recent-logo-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.2);
}

.recent-logo-item .remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  z-index: 10;
}

.recent-logo-item:hover .remove-btn {
  display: flex;
}

.recent-logo-item.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  cursor: default;
}

.recent-logo-item.empty:hover {
  border-color: var(--border);
  box-shadow: none;
}

.recent-logo-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.options-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  cursor: pointer;
  user-select: none;
  justify-content: center;
}

.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.check span {
  font-size: 0.95rem;
  color: var(--text);
}

/* Color Picker Styles */
.color-picker-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picker-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picker-panel--horizontal {
  flex-direction: row;
  gap: 8px;
  align-items: center;
  width: fit-content;
}

.hue-control {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 160px;
}

.hue-control--vertical {
  height: 200px;
  width: 24px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hue-track {
  width: 32px;
  height: 200px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
}

.hue-thumb {
  position: absolute;
  width: 30px;
  height: 6px;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  left: 50%;
  transform: translate(-50%, -50%);
}

.sv-picker {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.sv-picker canvas {
  display: block;
}

.sv-thumb {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  transform: translate(-5px, -5px);
  pointer-events: none;
}

.picker-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-indicator {
  width: 200px;
  height: 200px;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Disabled color picker styles */
.color-picker--disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(50%);
}

.color-input {
  height: 44px;
  padding: 0;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}

.preview-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.preview {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 520px;
}

.actions {
  display: flex;
  justify-content: stretch;
}

.actions .primary-btn {
  width: 100%;
}



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

.preview-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.qr-preview {
  width: 100%;
  min-height: 380px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: repeating-conic-gradient(#1f2937 0% 25%, #111827 0% 50%) 50% / 24px 24px;
  display: grid;
  place-items: center;
  padding: 24px;
}

.remove-btn {
  background-color: var(--surface-2)!important;
}

.remove-btn:hover {
  background-color: #ef4444!important;
}

@media (max-width: 900px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: flex-start;
  }
}

/* Drag and drop styles */
.file-drop-zone.drag-over .file-input-wrapper {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
}

.file-drop-zone.drag-over .file-display {
  color: var(--primary);
}

/* Input with button row */

.input-button-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-button-row .text-input {
  flex: 1;
}

.input-button-row .ghost-btn {
  flex-shrink: 0;
}

.input-button-row .text-input:hover {
  border-color: var(--primary);
}

.input-button-row .ghost-btn:hover {
  background-color: var(--btn-hover);
  color: var(--text);
}

#remove-logo-btn {
  width: 100%;
  padding: 12px 16px;
  margin-top: 20px;
  background-color: var(--btn-secondary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

#remove-logo-btn:hover {
  background-color: var(--btn-hover);
  border-color: var(--primary);
}

/* Modern Collapsible Design */
.options-collapsible {
  position: relative;
  z-index: 10;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.options-collapsible:not(.collapsed) {
  border: none;
  box-shadow: none;
  overflow: visible;
}

.options-collapsible.collapsed {
  background: transparent;
  overflow: visible;
}

.options-toggle {
  width: 100%;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  line-height: 1;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  z-index: 20;
}

/* Collapsed State: Prominent Action Button */
.options-collapsible.collapsed .options-toggle {
  background: linear-gradient(135deg, #6366f1, #a855f7); /* Indigo -> Purple */
  color: white;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
  margin-bottom: 0;
}

.options-collapsible.collapsed .options-toggle:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px -5px rgba(99, 102, 241, 0.5);
  filter: brightness(1.1);
}

/* Expanded State: Subtle Control Button */
.options-collapsible:not(.collapsed) .options-toggle {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin-bottom: 24px; /* Distinct spacing from content */
}

.options-collapsible:not(.collapsed) .options-toggle:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.options-toggle i {
  font-size: 1.1em;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}

.options-collapsible.collapsed .options-toggle i {
  transform: rotate(180deg);
}

.options-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.12); /* Clean floating shadow */
  overflow: hidden;
  
  /* Initial State (Hidden) */
  max-height: 0;
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  transform-origin: top center;
  
  transition: 
    max-height 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.4s ease,
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.options-content:not(.collapsed) {
  max-height: 2500px;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.options-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.options-content .options {
  padding: 16px;
}

@media (max-width: 768px) {
  /* 모바일 QR 미리보기 크기 조정 */
  .qr-preview {
    min-height: 280px;
    padding: 16px;
  }

  .qr-preview canvas {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: auto 200 / 200;
  }

  .preview {
    min-height: unset;
  }

  /* 모바일 색상 선택기 크기 조정 */
  .color-input {
    height: 40px;
    min-width: 60px;
  }

  /* 모바일 최근 로고 1줄 배치, 작은 크기 */
  .recent-logos-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 10px;
    padding-bottom: 8px;
  }

  .recent-logo-item {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
  }
  .picker-panel--horizontal {
    display: grid;
    grid-template-columns: auto 2fr;
  }
  .color-indicator {
    height: 20px;
    width: 20px;
  }
}
