@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600&display=swap');

:root {
  --primary: #ff6b00;
  --primary-hover: #e65c00;
  --primary-light: #fff5eb;
  --text-dark: #2d3748;
  --text-light: #718096;
  --border: #e2e8f0;
  --bg-main: #fffaf0;
}

* { box-sizing: border-box; font-family: 'Kanit', sans-serif; margin: 0; padding: 0; }

body { background-color: var(--bg-main); display: flex; justify-content: center; min-height: 100vh; padding: 20px; }

.app-wrapper { 
  width: 100%; 
  max-width: 1000px; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  animation: pageFadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* แอนิเมชันตอนเปิดหน้า */
@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ปุ่มกดย้อนกลับหน้า Hub */
.back-hub-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 14px;
  padding: 8px 16px;
  border-radius: 99px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.back-hub-btn svg {
  transition: transform 0.2s ease;
}

.back-hub-btn:hover {
  color: var(--primary);
  border-color: rgba(255, 107, 0, 0.35);
  background: var(--primary-light);
  transform: translateX(-4px);
}

.back-hub-btn:hover svg {
  stroke: var(--primary);
  transform: translateX(-2px);
}

.app-container {
  background: #ffffff;
  width: 100%;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(255, 107, 0, 0.08);
  display: flex;
  overflow: hidden;
  margin-bottom: 20px;
}

.sidebar {
  width: 35%;
  background: linear-gradient(160deg, #ff8c00 0%, #ff512f 100%); 
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.logo-circle {
  width: 80%;
  max-width: 220px;
  height: auto; 
  background: #ffffff;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px 20px;
  margin-bottom: 20px;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  animation: pulse-glow 2.5s infinite;
}

.company-logo {
  width: 100%;
  height: auto;
  object-fit: contain;
}

@keyframes pulse-glow {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(255, 255, 255, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.sidebar h3 { font-size: 16px; font-weight: 400; margin-bottom: 5px; opacity: 0.9; }
.sidebar h1 { font-size: 32px; font-weight: 600; letter-spacing: 1px; }

.form-section { width: 65%; padding: 50px; }
.form-title { color: var(--primary); font-size: 28px; font-weight: 600; margin-bottom: 30px; } 

.grid-2-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-dark); margin-bottom: 5px; }
.form-group label span { color: #ef4444; }

.input-field {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-dark);
  background: transparent;
  outline: none;
  transition: all 0.3s;
}

.input-field::placeholder { color: #a0aec0; font-weight: 300; }
.input-field:focus { border-bottom: 2px solid var(--primary); padding-bottom: 7px; }

.upload-box {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 20px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; cursor: pointer; background: #ffffff; transition: all 0.2s;
}
.upload-box:hover { border-color: var(--primary); background: #fffaf0; }
.upload-box span { font-size: 12px; color: var(--text-light); text-align: center; word-break: break-all;}
.upload-box:hover svg { stroke: var(--primary); transition: stroke 0.2s;}

.submit-btn {
  width: 100%; background-color: var(--primary); color: white; border: none;
  padding: 14px; border-radius: 8px; font-size: 16px; font-weight: 600;
  cursor: pointer; margin-top: 10px; box-shadow: 0 4px 10px rgba(255, 107, 0, 0.2);
  transition: all 0.3s;
}
.submit-btn:hover { background-color: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(255, 107, 0, 0.3); }
.submit-btn:disabled { background-color: #cbd5e1; cursor: not-allowed; box-shadow: none; transform: none;}

.footer { width: 100%; max-width: 1000px; background: #2d3748; color: #fff; text-align: center; padding: 15px; font-size: 12px; border-radius: 8px; }

@media (max-width: 768px) {
  .app-container { flex-direction: column; }
  .sidebar { width: 100%; padding: 40px 30px; }
  .form-section { width: 100%; padding: 30px 20px; }
  .grid-2-cols { grid-template-columns: 1fr; gap: 15px; }
}

/* Modal Popup */
.status-modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; z-index: 99999;
  opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s ease;
}
.status-modal-overlay.active { opacity: 1; visibility: visible; }
.status-modal-card {
  background: #ffffff; width: 90%; max-width: 350px; border-radius: 24px;
  padding: 32px 24px 28px; text-align: center; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  transform: scale(0.85); transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.status-modal-overlay.active .status-modal-card { transform: scale(1); }
.status-modal-card.anim-pop { animation: modalPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes modalPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  80% { transform: scale(0.96); }
  100% { transform: scale(1); }
}
.status-modal-card.anim-shake { animation: modalShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes modalShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-7px, 0, 0); }
  40%, 60% { transform: translate3d(7px, 0, 0); }
}
.modal-icon-box { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.modal-icon-box.loading-bg { background: #fff5eb; }
.modal-icon-box.success-bg { background: #ecfdf5; }
.modal-icon-box.error-bg { background: #fef2f2; }
.svg-spin { animation: iconSpin 0.9s linear infinite; }
@keyframes iconSpin { 100% { transform: rotate(360deg); } }
.check-path { stroke-dasharray: 48; stroke-dashoffset: 48; animation: drawStroke 0.4s ease-out 0.15s forwards; }
@keyframes drawStroke { to { stroke-dashoffset: 0; } }
.modal-title { font-size: 20px; font-weight: 600; color: var(--text-dark); margin-bottom: 8px; }
.modal-desc { font-size: 14px; color: var(--text-light); line-height: 1.5; margin-bottom: 22px; word-break: break-word; }
.modal-btn {
  width: 100%; padding: 12px; border-radius: 10px; border: none; font-size: 15px; font-weight: 500;
  cursor: pointer; background: #f1f5f9; color: #334155; transition: all 0.2s;
}
.modal-btn:hover { background: #e2e8f0; }
.modal-btn.btn-primary { background: var(--primary); color: #ffffff; }
.modal-btn.btn-primary:hover { background: var(--primary-hover); }