/* ============================================
   Nhập Liệu Thông Tin - Responsive Styles
   Breakpoint: 768px (mobile / desktop)
   ============================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f7fa;
  min-height: 100vh;
  padding: 16px;
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 24px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* --- Typography --- */
h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
  text-align: center;
}

p {
  color: #666;
  text-align: center;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* --- Password Gate Section --- */
#password-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 32px);
}

#password-gate .container {
  text-align: center;
}

#password-gate .form-group {
  text-align: left;
}

/* --- Data Form Section --- */
#data-form {
  padding: 24px 0;
}

#data-form .container {
  padding-top: 32px;
  padding-bottom: 40px;
}

/* --- Form Group --- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

/* --- Inputs & Selects --- */
.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  color: #333;
  background-color: #fff;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #4a6cf7;
  box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.12);
}

.form-group input::placeholder {
  color: #aaa;
}

/* Select arrow styling */
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* Input with validation error state */
.form-group input.input-error,
.form-group select.input-error,
.form-group.has-error input,
.form-group.has-error select {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.08);
}

/* --- Error Messages --- */
.error-message {
  display: block;
  font-size: 0.82rem;
  color: #e74c3c;
  margin-top: 5px;
  min-height: 0;
  line-height: 1.4;
}

.error-message:empty {
  display: none;
}

/* --- Success Message --- */
.success-message {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

/* --- Submit Error Message --- */
.submit-error-message {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

/* --- Buttons --- */
#password-confirm-btn,
#submit-btn {
  display: block;
  width: 100%;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background-color: #4a6cf7;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  margin-top: 8px;
}

#password-confirm-btn:hover,
#submit-btn:hover {
  background-color: #3a5ce5;
}

#password-confirm-btn:active,
#submit-btn:active {
  transform: scale(0.98);
}

#password-confirm-btn:disabled,
#submit-btn:disabled {
  background-color: #a0b4f7;
  cursor: not-allowed;
  transform: none;
}

/* --- Loading state text on button --- */
#submit-btn.loading {
  background-color: #a0b4f7;
  cursor: wait;
}

/* --- Date Input Styling (normalize across browsers) --- */
input[type="date"] {
  min-height: 44px;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}

/* ============================================
   Responsive - Desktop (>= 768px)
   ============================================ */
@media (min-width: 768px) {
  body {
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .container {
    max-width: 600px;
    padding: 40px 48px;
  }

  h1 {
    font-size: 1.75rem;
  }

  #password-confirm-btn,
  #submit-btn {
    width: auto;
    min-width: 180px;
    margin-left: auto;
    margin-right: auto;
  }

  #data-form #submit-btn {
    display: block;
    margin-left: auto;
    margin-right: auto;
  }

  .form-group input,
  .form-group select {
    padding: 10px 14px;
  }
}

/* ============================================
   Responsive - Small Mobile (<= 360px)
   ============================================ */
@media (max-width: 360px) {
  body {
    padding: 8px;
  }

  .container {
    padding: 24px 16px;
    border-radius: 8px;
  }

  h1 {
    font-size: 1.25rem;
  }
}

/* --- Accessibility: Focus visible for keyboard navigation --- */
#password-confirm-btn:focus-visible,
#submit-btn:focus-visible,
.form-group input:focus-visible,
.form-group select:focus-visible {
  outline: 2px solid #4a6cf7;
  outline-offset: 2px;
}

/* --- Utility: Hidden but accessible --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
