/* ── Bottom Sheet ── */
.bs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
}
.bs-overlay.active { display: block; }

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  z-index: 101;
  padding: 12px 20px 32px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 90vh;
  overflow-y: auto;
}
.bottom-sheet.active { transform: translateY(0); }

.bs-handle {
  width: 40px;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.bs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.bs-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-700);
}
.bs-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  font-size: 1.1rem;
  padding: 4px;
  line-height: 1;
}
.bs-img-wrap {
  position: relative;
  margin-bottom: 14px;
}
#bsPreviewImg {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  display: block;
  cursor: zoom-in;
}
.bs-zoom-hint {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  transition: opacity 0.4s;
  white-space: nowrap;
}
.bs-zoom-hint.hidden { opacity: 0; }
.bs-actions {
  display: flex;
  gap: 10px;
}

@media (max-width: 768px) {
  .btn-generate { font-size: 0.85rem; font-weight: 600; padding: 11px; }

  .ratio-group { gap: 6px; margin-bottom: 12px; }
  .ratio-btn {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: row;
    padding: 6px 8px;
    gap: 6px;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.2;
    border-radius: 8px;
    white-space: normal;
    text-align: center;
    word-break: break-word;
  }
  .ratio-btn.ratio-3x1,
  .ratio-btn.ratio-2x1 { flex: 1 1 0 !important; }
  .ratio-btn img { display: none; }
  .ratio-btn::before {
    content: '';
    display: block;
    flex-shrink: 0;
    border-radius: 2px;
    background: var(--gray-200);
    border: 1.5px solid currentColor;
    opacity: 0.5;
  }
  .ratio-btn.active::before { opacity: 1; }
  .ratio-btn.ratio-3x1::before { width: 30px; height: 10px; }
  .ratio-btn.ratio-2x1::before { width: 20px; height: 10px; }
}

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  width: 100%;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--teal);
  margin-bottom: 12px;
}

/* ── Form ── */
.form-group {
  margin-bottom: 14px;
}
label {
  display: block;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 5px;
}
input[type="text"] {
  width: 100%;
  padding: 10px 13px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  color: var(--gray-700);
  transition: border-color 0.2s;
  outline: none;
}
input[type="text"]:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,180,180,0.12);
}
input[type="text"].has-value {
  border-color: var(--teal);
  background: #f7fefe;
}
input[type="text"]::placeholder,
textarea::placeholder {
  color: var(--gray-500);
}

textarea {
  width: 100%;
  padding: 10px 13px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  color: var(--gray-700);
  transition: border-color 0.2s;
  outline: none;
  resize: vertical;
}
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,180,180,0.12);
}
textarea.has-value {
  border-color: var(--teal);
  background: #f7fefe;
}

.form-group label {
  transition: color 0.2s;
}
.form-group.active label {
  color: var(--teal);
}
.form-group .char-count {
  float: right;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  transition: color 0.2s;
}
.form-group.active .char-count {
  color: var(--teal);
}

/* ── Ratio Buttons ── */
.ratio-group {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.ratio-btn {
  padding: 8px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  background: var(--white);
  font-family: 'Poppins', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ratio-btn.ratio-3x1 { flex: 3; }
.ratio-btn.ratio-2x1 { flex: 2; }
.ratio-btn img {
  width: 100%;
  height: 70px;
  border-radius: 6px;
  object-fit: cover;
  pointer-events: none;
}
.ratio-btn:hover { border-color: var(--teal); color: var(--teal); }
.ratio-btn.active {
  border-color: var(--teal);
  background: var(--teal-light);
  color: var(--teal-dark);
}

/* ── Divider ── */
.divider { height: 1px; background: var(--gray-200); margin: 16px 0; }

/* ── Generate Btn ── */
.btn-generate {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-generate:hover { opacity: 0.92; }
.btn-generate:active { transform: scale(0.98); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Preview Panel internals ── */
.preview-panel .section-label {
  margin-bottom: 14px;
}

.preview-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  color: var(--gray-500);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  padding: 32px;
  gap: 8px;
}
.preview-placeholder-icon {
  font-size: 2rem;
  opacity: 0.4;
}

.loading-state {
  text-align: center;
  padding: 40px;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.9rem;
  display: none;
}
.loading-state .spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--teal-light);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

#previewCanvas {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  border: 1px solid var(--gray-200);
}

/* ── Action Row ── */
.action-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.btn-action {
  flex: 1;
  padding: 11px 12px;
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-700);
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}
.btn-action:not(:disabled):hover {
  border-color: var(--teal);
  color: var(--teal);
}
.btn-action:disabled,
.btn-action.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Info note ── */
.info-note {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-bottom: 14px;
  margin-top: -6px;
}
