/* styles.css */

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background: #f2f2f2;
}

form {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.btn {
  flex: 1; /* works only if parent uses display:flex */
  position: fixed; /* fixes element to the viewport */
  top: 10px; /* position from top */
  left: 10px; /* position from left */
  display: inline-block;
  padding: 8px 16px;
  background: #444;
  color: #fff;
  border-radius: 5px;
  text-decoration: none;
}

.btn:hover {
  background: #666;
}

h2 {
  margin-top: 0;
  text-align: center;
}

/* Form structure */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
}

.form-group {
  flex: 1;
  padding-top: 8px;
  min-width: 250px;
  display: flex;
  flex-direction: column;
}

/* Label and input styling */
label {
  margin-bottom: 5px;
  font-weight: bold;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select {
  padding: 10px;
  font-size: 1em;
  border: 1.5px solid #bbb;
  border-radius: 5px;
  transition: border-color 0.3s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: #0066cc;
}

/* Only show red borders if the field has been touched and is invalid */
input.invalid:not(.touched) {
  border: 1.5px solid #bbb;
}

input.invalid.touched {
  border: 2px solid red;
}

/* Error message styling */
.error-msg {
  color: red;
  font-size: 0.9em;
  display: none;
  margin-top: 5px;
}

/* Success indicator */
.valid {
  border: 2px solid green;
}

/* Submit button */
button[type="submit"] {
  background-color: #0066cc;
  color: white;
  padding: 12px 20px;
  font-size: 1em;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
  transition: background-color 0.3s ease;
}

button[type="submit"]:hover {
  background-color: #004a99;
}

/* Shared style for add buttons */
.add-button {
  margin-top: 4px;
  padding: 10px 4px;
  font-size: 1em;
  font-weight: 600;
  color: white;
  background-color: #0077cc;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.add-button:disabled {
  background-color: #a1a1a1;
  cursor: not-allowed;
}

.add-button:hover:not(:disabled) {
  background-color: #005fa3;
}

/* Remove buttons */
.remove-btn {
  height: 36px;
  margin-left: auto; /* aligns the button to the right */
  background-color: #d43f3a;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0 12px;
  font-weight: 600;
  font-size: 1em;
  line-height: 1;
  transition: background-color 0.3s ease;
}

.remove-btn:hover {
  background-color: #a92f2c;
}

/* Facility row styling */
.facility-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.facility-row input {
  flex: 1 1 200px; /* flexible, min 200px */
}

.facility-group {
  flex: 1;
}

.facility-label {
  display: block;
  margin-bottom: 4px;
}

.facility-input {
  width: 100%;
}

/* Fieldset and legend */
fieldset {
  margin-top: 30px;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 20px;
  font-family: Arial, sans-serif;
}

legend {
  font-weight: 700;
  font-size: 1.2em;
  color: #004a99;
  padding: 0 10px;
}

/* Nursing container and member */
#nursing-container {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.nursing-member {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px 20px;
  background-color: #fafafa;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 20px;
  align-items: end;
  position: relative;
}

.nursing-member > div {
  display: flex;
  flex-direction: column;
}

.nursing-member label {
  font-weight: 600;
  margin-bottom: 6px;
  color: #222;
}

.nursing-member input,
.nursing-member select {
  padding: 8px 10px;
  border-radius: 5px;
  border: 1.5px solid #ccc;
  font-size: 1em;
  transition: border-color 0.25s ease;
}

.nursing-member input:focus,
.nursing-member select:focus {
  outline: none;
  border-color: #0077cc;
  box-shadow: 0 0 5px rgba(0, 119, 204, 0.4);
}

/* Error messages */
.error-message {
  color: #d43f3a;
  font-size: 0.85em;
  margin-top: 4px;
}

/* Input validation states */
input.invalid,
select.invalid {
  border-color: #d43f3a !important;
  background-color: #ffe5e5;
}

input.valid,
select.valid {
  border-color: #3ca34d !important;
  background-color: #e7f8e7;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .nursing-member {
    grid-template-columns: 1fr;
  }

  .remove-btn {
    position: static;
    margin-top: 12px;
    align-self: start;
    width: 100%;
  }
}

/*pricvate insurance */
#private-insurance-container {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.private-insurance-row {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px 20px;
  background-color: #fafafa;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 20px;
  align-items: end;
  position: relative; /* IMPORTANT for absolute remove btn */
}

.private-insurance-row > div {
  display: flex;
  flex-direction: column;
}

.private-insurance-row label {
  font-weight: 600;
  margin-bottom: 6px;
  color: #222;
}

.private-insurance-row input {
  padding: 8px 10px;
  border-radius: 5px;
  border: 1.5px solid #ccc;
  font-size: 1em;
  transition: border-color 0.25s ease;
}

.private-insurance-row input:focus {
  outline: none;
  border-color: #0077cc;
  box-shadow: 0 0 5px rgba(0, 119, 204, 0.4);
}

.remove-btn {
  position: absolute; /* absolute inside container */
  top: 125px;
  right: 12px;
  background-color: #d43f3a;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 6px 12px;
  font-weight: bold;
  font-size: 1.1em;
  line-height: 1;
  transition: background-color 0.2s ease;
  margin: 0;
  height: 36px;
}

.remove-btn:hover {
  background-color: #a92f2c;
}

.error-message {
  color: #d43f3a;
  font-size: 0.85em;
  margin-top: 4px;
  display: none;
}

input.invalid {
  border-color: #d43f3a !important;
  background-color: #ffe5e5;
}

input.valid {
  border-color: #3ca34d !important;
  background-color: #e7f8e7;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .private-insurance-row {
    grid-template-columns: 1fr;
  }

  .remove-btn {
    position: static;
    margin-top: 12px;
    align-self: start;
    width: 100%;
  }
}

.form-background-image {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 150px; /* Adjust as needed */
  opacity: 0.1; /* Low opacity so it's subtle */
  z-index: 0; /* Ensure it's behind the form */
  pointer-events: none; /* So it doesn't block form interaction */
}

form {
  position: relative;
  z-index: 1; /* Ensures it's on top of the image */
  background-color: rgba(
    255,
    255,
    255,
    0
  ); /* Optional: semi-transparent background for the form */
  padding: 20px;
}

