/* =============================================
   UPLOAD PAGE
   ============================================= */

/* ============================================
   SafeGuard Section
   ============================================ */

/* wrapper ระหว่าง 3 กล่อง */
.sg-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

/* กล่อง 1.1 / 1.2 / 1.3 */
.sg-card-box {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e5ea;
}

/* header ของแต่ละกล่อง */
.sg-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
}
.sg-header-blue   { background: #eff6ff; border-bottom: 1px solid #bfdbfe; }
.sg-header-purple { background: #f5f3ff; border-bottom: 1px solid #ddd6fe; }
.sg-header-gray   { background: #f4f4f5; border-bottom: 1px solid #e4e4e7; }

.sg-card-num {
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  padding: 2px 8px; border-radius: 20px; flex-shrink: 0;
}
.sg-header-blue   .sg-card-num { background: #dbeafe; color: #1d4ed8; }
.sg-header-purple .sg-card-num { background: #ede9fe; color: #6d28d9; }
.sg-header-gray   .sg-card-num { background: #e4e4e7; color: #52525b; }

.sg-card-title {
  font-size: 14px; font-weight: 700;
}
.sg-header-blue   .sg-card-title { color: #1e3a8a; }
.sg-header-purple .sg-card-title { color: #4c1d95; }
.sg-header-gray   .sg-card-title { color: #27272a; }

.sg-card-en {
  font-size: 12px; color: #9ca3af;
  margin-left: auto; flex-shrink: 0;
}

/* เนื้อหาในกล่อง — spacing ชัดเจน */
.sg-card-body {
  padding: 18px 20px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sg-card-body p {
  font-size: 14px;
  color: #3a3a3c;
  line-height: 1.8;
  margin: 0;
}
.sg-sub-label {
  font-size: 13px;
  font-weight: 700;
  color: #FF6B35;
  margin: 0;
}

/* badge + desc สำหรับ 1.2 */
.sg-type-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 14px; color: #3a3a3c; line-height: 1.7;
}
.sg-badge {
  font-size: 11.5px; font-weight: 700;
  padding: 2px 10px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
}
.sg-blue   { background: #dbeafe; color: #1d4ed8; }
.sg-purple { background: #ede9fe; color: #6d28d9; }

/* เส้นแบ่ง */
.sg-divider {
  height: 1px;
  background: #e5e5ea;
  margin: 8px 0 20px;
}

/* Consent */
.sg-consent-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px; color: #3a3a3c; line-height: 1.6;
  margin-bottom: 0;
}
.sg-consent-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 17px; height: 17px;
  accent-color: #FF6B35;
  cursor: pointer;
}

/* Button */
.sg-actions { margin-top: 24px; }
.sg-btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 32px; border-radius: 12px;
  background: linear-gradient(135deg, #FF6B35 0%, #f05a1f 100%);
  color: #fff;
  font-size: 15px; font-weight: 700; border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(255,107,53,.40), 0 1px 3px rgba(255,107,53,.20);
  transition: transform .15s, box-shadow .15s, opacity .15s;
  letter-spacing: .01em;
}
.sg-btn-primary:disabled {
  opacity: .35; cursor: not-allowed;
  box-shadow: none; background: #ccc; transform: none;
}
.sg-btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255,107,53,.50), 0 2px 6px rgba(255,107,53,.25);
}
.sg-btn-primary:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255,107,53,.30);
}

/* Free panel */
.sg-free-panel {
  margin-top: 20px;
  background: #f9f9fb;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  padding: 20px;
}
.sg-free-panel-title {
  font-size: 14px; font-weight: 600; color: #1c1c1e;
  margin: 0 0 16px;
}
.sg-radio-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: 8px;
  border: 1.5px solid #e5e5ea;
  margin-bottom: 10px; cursor: pointer; background: #fff;
  transition: border-color .15s;
}
.sg-radio-item:last-child { margin-bottom: 0; }
.sg-radio-item:hover { border-color: #FF6B35; }
.sg-radio-item input[type="radio"] { margin-top: 3px; flex-shrink: 0; accent-color: #FF6B35; }
.sg-radio-content strong { display: block; font-size: 14px; color: #1c1c1e; margin-bottom: 4px; }
.sg-radio-content span { font-size: 13px; color: #6d6d72; line-height: 1.6; }

.breadcrumb-bar-up {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.bc-up-inner {
  max-width: 860px;
  margin: 0 auto;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.bc-up-link   { color: var(--text-3); transition: color .15s; }
.bc-up-link:hover { color: var(--orange); }
.bc-up-current { font-weight: 600; color: var(--text-1); }

/* Layout */
.upload-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* Page header */
.upload-page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.upload-page-icon {
  width: 56px;
  height: 56px;
  background: var(--orange-bg);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upload-page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.4px;
  color: var(--text-1);
  margin-bottom: 4px;
}

.upload-page-sub {
  font-size: 14px;
  color: var(--text-3);
}

/* Warning banner */
.upload-warning {
  display: flex;
  gap: 16px;
  background: #FFF5F0;
  border: 1.5px solid #FFB89A;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 28px;
}

.uw-icon {
  width: 40px;
  height: 40px;
  background: #FFE8DC;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.uw-text {
  font-size: 14px;
  color: #7C2D12;
  line-height: 1.6;
}

.uw-text strong {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: #C2410C;
  margin-bottom: 8px;
}

.uw-text ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
}

.uw-text ul li::before {
  content: '— ';
  color: #FB923C;
  font-weight: 600;
}

/* =============================================
   FORM SECTIONS
   ============================================= */
.upload-form { display: flex; flex-direction: column; gap: 20px; }

.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-sm);
}

.form-section-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.section-num {
  width: 30px;
  height: 30px;
  background: var(--orange-bg);
  color: var(--orange);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.form-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -.2px;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.optional-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-4);
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: 2px 8px;
  letter-spacing: .02em;
}

.author-name-input { max-width: 400px; }

.form-section-desc {
  font-size: 13px;
  color: var(--text-3);
}

/* Grid */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Field */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field-group:last-child { margin-bottom: 0; }

.field-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
}

.req { color: var(--orange); }

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  padding: 0 13px;
  height: 42px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field-textarea {
  height: auto;
  padding: 12px 13px;
  resize: vertical;
  line-height: 1.65;
}

.field-input::placeholder,
.field-textarea::placeholder { color: var(--text-5); }

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,107,53,.10);
  background: var(--surface);
}

.field-input.has-icon { padding-left: 38px; }

.field-hint {
  font-size: 12px;
  color: var(--text-4);
}

.field-hint-warn {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 10px;
  padding: 10px 12px;
  background: #FFF5F0;
  border: 1px solid #FFB89A;
  border-radius: 8px;
  font-size: 12px;
  color: #7C2D12;
  line-height: 1.6;
}

.field-hint-warn strong {
  color: #C2410C;
}

.char-count {
  font-size: 12px;
  color: var(--text-5);
  text-align: right;
}

/* Input with icon */
.input-with-icon { position: relative; }

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Checkboxes */
.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

.check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
  cursor: pointer;
}

/* =============================================
   FILE DROP ZONE
   ============================================= */
.file-drop-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-md);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--bg);
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--orange);
  background: var(--orange-bg);
}

.fdz-icon {
  width: 56px;
  height: 56px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.fdz-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.fdz-sub {
  font-size: 13px;
  color: var(--text-4);
}

.fdz-selected {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  color: #16A34A;
}

.fdz-size {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-4);
}

/* =============================================
   IMAGE UPLOAD BOX
   ============================================= */
.img-upload-box {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-md);
  aspect-ratio: 5/3;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg);
  overflow: hidden;
  transition: border-color .2s, background .2s;
}

.img-upload-box:hover { border-color: var(--orange); background: var(--orange-bg); }

.iub-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-3);
  font-weight: 500;
}

.iub-hint { font-size: 12px; color: var(--text-5); font-weight: 400; }

.img-upload-box img.preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =============================================
   SUBMIT SECTION
   ============================================= */
.submit-section {
  background: var(--bg);
  border: 1px solid var(--border);
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
  cursor: pointer;
  margin-bottom: 20px;
}

.consent-check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--orange);
  cursor: pointer;
  flex-shrink: 0;
}

.submit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.btn-cancel {
  height: 46px;
  padding: 0 22px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: background .15s, border-color .15s;
}

.btn-cancel:hover { background: var(--bg); border-color: var(--text-4); }

.btn-submit {
  height: 46px;
  padding: 0 28px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .15s;
}

.btn-submit:hover { background: var(--orange-2); }
.btn-submit:disabled { background: var(--text-5); cursor: not-allowed; }

.submit-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-4);
}

/* =============================================
   SUCCESS MODAL
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  max-width: 420px;
  width: calc(100% - 48px);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.modal-icon {
  width: 72px;
  height: 72px;
  background: #F0FFF4;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.modal-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 10px;
}

.modal-desc {
  font-size: 14.5px;
  color: var(--text-3);
  line-height: 1.7;
  margin-bottom: 24px;
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 28px;
  background: var(--orange);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 700;
  transition: background .15s;
}

.modal-btn:hover { background: var(--orange-2); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 640px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-section { padding: 20px 18px; }
  .upload-wrapper { padding: 20px 16px 60px; }
}
