/* Import Google Font "Prompt" */
@import url("https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap");

/* Apply border-box to all elements */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* --- General Styles --- */
body {
  font-family: "Prompt", sans-serif;
  background: linear-gradient(
    135deg,
    #f0f2f5 0%,
    #e0e4eb 100%
  ); /* More subtle gradient */
  min-height: 100vh;
}

.form-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* A more modern, subtle shadow */
  /* Remove backdrop-filter for performance, unless really needed */
  /* backdrop-filter: blur(10px);  Consider removing this */
  /* padding: 0; */
  overflow: hidden; /* Ensure the header's gradient doesn't overflow*/
  width: 100%; /* Add width: 100% */
  max-width: 900px; /* Keep max-width */
}

/* --- Form Header --- */
.form-header {
  background: linear-gradient(135deg, #1a5f7a 0%, #2980b9 50%, #3498db 100%);
  color: white;
  border-radius: 15px 15px 0 0;
  padding: 25px;
  margin: -24px -24px 25px -24px;
  box-shadow: 0 4px 15px rgba(41, 128, 185, 0.2);
}

.form-header h3 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.form-header h6 {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.9;
}

/* --- Form Controls --- */
.form-control,
.form-select {
  border-radius: 8px;
  border: 1px solid #ced4da; /* Lighter border color */
  padding: 10px 15px; /* Slightly adjusted padding */
  transition: all 0.2s ease-in-out; /* Smoother transitions */
  font-family: "Prompt", sans-serif;
  font-size: 1rem; /* Slightly larger font for better readability */
  line-height: 1.5; /* Increased line-height for readability*/
}

.form-control:focus,
.form-select:focus {
  border-color: #3498db; /* Use the brighter blue for focus */
  box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25); /* Consistent focus shadow */
  outline: none;
}

/* --- Buttons --- */
.btn {
  padding: 12px 24px;
  border-radius: 10px;
  font-family: "Prompt", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1a5f7a 0%, #2980b9 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(41, 128, 185, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
  border: none;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #962d22 0%, #c0392b 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

/* --- Labels --- */
.form-label {
  font-weight: 500;
  color: #444;
  margin-bottom: 0.5rem; /* Consistent spacing */
  font-family: "Prompt", sans-serif;
  display: inline-block; /* Already inline-block */
  margin-right: 0.5rem;
  position: relative; /* Make the label a positioning context*/
}

/* --- Required Field Indicator --- */
.required-star {
  color: red;
}

/* --- Input Groups --- */
.input-group {
  margin-bottom: 0px;
}

/* Style the input group text (e.g., "บาท") */
.input-group-text {
  background-color: #e9ecef; /* Keep existing style */
  border: 1px solid #ced4da; /* Keep existing style */
  border-radius: 10px; /* Keep existing style */
  color: #495057; /* Keep existing style */
  /* NEW STYLES */
  font-size: 1rem; /* Match the .form-control font-size */
  line-height: 1.5; /* Match .form-control for vertical alignment */
  display: flex; /* Use flexbox for vertical centering */
  align-items: center; /* Center vertically within the input group */
}

/* --- Form Hints (smaller text below labels) --- */
.form-hint {
  font-size: 0.9rem;
  color: #6c757d;
  font-weight: 400;
  margin-left: 0.5rem;
}

/* --- Error Messages --- */
.invalid-feedback {
  display: none;
  color: red;
  font-size: 0.875em;
  margin-top: 0.55rem;
}

/* Show error (when .was-validated is present) */
.was-validated .form-control:invalid ~ .invalid-feedback,
.was-validated .form-select:invalid ~ .invalid-feedback {
  display: block;
}

/* Highlight invalid fields (when .was-validated is present) */
.was-validated .form-control:invalid,
.was-validated .form-select:invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.custom-link {
  margin: 0 30px;
  color: #2980b9;
  font-weight: normal;
  text-decoration: none;
}

.custom-link:hover {
  text-decoration: underline;
  color: #3498db;
}

/* --- Mobile First Styles (max-width: 576px) --- */
@media (max-width: 576px) {
  /* 1. Buttons */
  .d-flex.justify-content-center {
    flex-direction: column; /* Stack buttons vertically */
  }

  .btn {
    width: 100%; /* Full-width buttons */
    margin-bottom: 0.5rem; /* Spacing between stacked buttons */
    padding: 10px 20px; /* Slightly smaller padding */
    font-size: 0.95rem; /* Slightly smaller font-size */
    /* Remove icons (optional, but good for very small screens): */
    /* i { display: none; } */
  }

  /*Remove margin-right from all labels */
  .form-label {
    font-size: 0.9rem; /* Slightly smaller font size for labels */
    margin-right: 0;
  }

  /* Adjust padding/margin (optional, for better spacing):*/
  .form-container {
    padding: 1rem;
  }

  /* 2. Form elements */
  .form-control,
  .form-select {
    width: 100%; /* Full-width form elements */
    font-size: 0.9rem; /* Smaller font for inputs */
    margin-bottom: 1rem; /* More spacing between elements */
  }

  .form-label {
    margin-bottom: 0.3rem; /* Less margin above labels */
    font-size: 0.9rem; /* Slightly smaller font size for labels */
  }

  /* Make sure input groups don't break */
  .input-group {
    margin-bottom: 1rem; /* Consistent spacing */
    align-items: stretch; /* Ensure children stretch to full height */
  }

  .input-group .form-control {
    height: auto;
    padding: 8px 12px; /* Adjust padding to control height */
    margin-bottom: 0; /* Remove bottom margin when in input group */
  }

  .input-group-text {
    font-size: 0.9rem; /* Match input font size */
    padding: 8px 12px; /* Match padding with input */
    display: flex;
    align-items: center;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 0 8px 8px 0; /* Keep right side rounded */
  }

  /* Ensure left input has correct border radius */
  .input-group > .form-control:first-child {
    border-radius: 8px 0 0 8px;
  }

  /* 3. General Layout */
  .form-header {
    padding: 20px;
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
  }
  .form-header h3 {
    font-size: 1.5rem; /* Smaller heading */
  }
  .form-header h6 {
    font-size: 0.9rem; /* Smaller sub-heading */
  }

  /* Form Hints on Mobile */
  /* .form-hint {
    display: block;
    margin-left: 0;
    margin-top: 0.25rem;
  } */

  /* --- Responsive adjustments for specific sections --- */
  .row.g-4 {
    --bs-gutter-x: 1rem; /* Reduce horizontal gutter */
    --bs-gutter-y: 1rem; /* Reduce vertical gutter */
  }

  /* Force full-width columns in the form */
  .row > div {
    width: 100%;
    padding-left: 0; /* Remove default padding */
    padding-right: 0; /* Remove default padding */
    margin-bottom: 0; /* Remove any extra bottom margin */
  }
}

/* --- Larger Screen Button Styles (optional, kept from original)--- */
@media (min-width: 577px) {
  .form-group.d-flex.justify-content-center {
    padding-top: 1rem;
  }

  .form-group.d-flex.justify-content-center button {
    min-width: 200px;
    margin: 0 0.5rem;
    border-radius: 8px;
  }
}

/* SweetAlert2 Custom Styles */
.swal2-popup {
  font-family: "Prompt", sans-serif !important;
  border-radius: 15px !important;
  padding: 2em !important;
}

.swal2-title {
  font-size: 1.5em !important;
  font-weight: 600 !important;
  color: #2c3e50 !important;
}

.swal2-html-container {
  font-size: 1.1em !important;
  color: #34495e !important;
}

/* Success style */
.swal2-icon.swal2-success {
  border-color: #2980b9 !important;
  color: #2980b9 !important;
}

.swal2-success-circular-line-left,
.swal2-success-circular-line-right,
.swal2-success-fix {
  background-color: transparent !important;
}

.swal2-success-ring {
  border-color: rgba(41, 128, 185, 0.3) !important;
}

.swal2-confirm.swal2-styled {
  background: linear-gradient(135deg, #2980b9 0%, #3498db 100%) !important;
  border-radius: 8px !important;
  padding: 12px 24px !important;
  font-family: "Prompt", sans-serif !important;
  font-weight: 500 !important;
  box-shadow: 0 2px 5px rgba(41, 128, 185, 0.2) !important;
}

.swal2-confirm.swal2-styled:hover {
  background: linear-gradient(135deg, #1a5f7a 0%, #2980b9 100%) !important;
  transform: translateY(-1px);
}

/* Info style */
.swal2-icon.swal2-info {
  border-color: #3498db !important;
  color: #3498db !important;
}

/* Error style */
.swal2-icon.swal2-error {
  border-color: #e74c3c !important;
}

.swal2-icon.swal2-error [class^="swal2-x-mark-line"] {
  background-color: #e74c3c !important;
}

/* Warning style */
.swal2-icon.swal2-warning {
  border-color: #f1c40f !important;
  color: #f1c40f !important;
}

/* --- Footer Styles --- */
.footer {
  position: relative;
  padding: 2rem 0;
  color: #2c3e50;
  background: linear-gradient(
    135deg,
    rgba(41, 128, 185, 0.02) 0%,
    rgba(52, 152, 219, 0.05) 50%,
    rgba(41, 128, 185, 0.02) 100%
  );
}

.footer p {
  font-family: "Prompt", sans-serif;
  line-height: 1.8;
  margin: 0;
  text-align: center;
}

.footer .small {
  font-size: 0.95rem;
  color: #5f6c7b;
  opacity: 0.85;
  max-width: 600px;
  margin: 0 auto;
}

/* Footer responsive styles */
@media (max-width: 768px) {
  .footer {
    padding: 1.75rem 0;
    margin-top: 2rem;
  }

  .footer .small {
    font-size: 0.9rem;
    line-height: 1.7;
    padding: 0 1rem;
  }
}

@media (max-width: 576px) {
  .footer {
    padding: 1.5rem 0;
    margin-top: 2rem;
  }

  .footer .small {
    font-size: 0.85rem;
    line-height: 1.6;
  }

  .footer br {
    display: none;
  }

  .footer .small br:nth-child(2) {
    display: block;
    content: "";
    margin-top: 0.5rem;
  }
}

@media (max-width: 375px) {
  .footer {
    padding: 1.25rem 0;
  }

  .footer .small {
    font-size: 0.75rem;
    line-height: 1.5;
  }
}

/* Add these new styles after your existing styles */
.date-picker-toggle {
  cursor: pointer;
  background-color: #f8f9fa;
  border: 1px solid #ced4da;
  border-left: none;
}

.date-picker-toggle:hover {
  background-color: #e9ecef;
}

/* Tempus Dominus custom styles */
.tempus-dominus-widget {
  padding: 0;
  font-family: "Prompt", sans-serif;
  z-index: 1060 !important; /* Ensure picker shows above other elements */
}

.tempus-dominus-widget .date-container-days .day {
  font-weight: normal;
}

.tempus-dominus-widget .date-container-decades .decade,
.tempus-dominus-widget .date-container-years .year,
.tempus-dominus-widget .date-container-months .month {
  font-weight: normal;
}

/* Mobile responsiveness for date picker */
@media (max-width: 576px) {
  .tempus-dominus-widget {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    max-width: 90vw;
  }
}

/* Ensure proper positioning */
.tempus-dominus-widget.show {
  display: block !important;
  position: absolute;
  background-color: white;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
}

/* Style the calendar days */
.tempus-dominus-widget .calendar-header {
  padding: 0.5rem;
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.tempus-dominus-widget .calendar-days {
  padding: 0.5rem;
}
