/* Fade-in animation for the page on load */
/* Page Fade-in / Fade-out Transition */
body {
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  background-color: #f4f6f8; /* same as profile body background */
  color: #333; /* same text color */
}

body.fade-in {
  opacity: 1;
}

body.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}


    .container {
      max-width: 900px;
      width: 95%;
      margin: 3rem auto;
      background: #fff;
      border-radius: 20px;
      padding: 2.5rem 3rem;
      box-shadow: 0 12px 35px rgba(0,0,0,0.1);
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      color: #222;
    }

    /* Responsive grid form with consistent gaps */
    .form {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
      gap: 1.8rem 2rem;
    }

    /* Labels on top with clear typography */
    .form label {
      font-weight: 600;
      font-size: 0.95rem;
      margin-bottom: 0.4rem;
      display: block;
      color: #444;
    }

    /* Inputs, selects, textarea subtle border & background */
    .form input[type="text"],
    .form input[type="number"],
    .form input[type="file"],
    .form select,
    .form textarea {
      width: 100%;
      padding: 0.8rem 1rem;
      font-size: 1rem;
      border: 1.6px solid #ccc;
      border-radius: 12px;
      background-color: #fafafa;
      box-sizing: border-box;
      transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }

    /* Highlight inputs with green on focus */
    .form input[type="text"]:focus,
    .form input[type="number"]:focus,
    .form input[type="file"]:focus,
    .form select:focus,
    .form textarea:focus {
      border-color: #36c36c;
      box-shadow: 0 0 6px rgba(54, 195, 108, 0.5);
      outline: none;
      background-color: #fff;
    }

    /* Textarea styling */
    .form textarea {
      resize: vertical;
      min-height: 120px;
      line-height: 1.5;
    }

    .checkbox-label {
  grid-column: 1 / -1;
  justify-content: flex-start;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  border: 2px solid #ccc;
  border-radius: 14px;
  padding: 0.85rem 1.2rem;
  user-select: none;
  transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
  background-color: #fafafa;
}

.checkbox-label input[type="checkbox"] {
  cursor: pointer;
  width: 24px;
  height: 24px;
  accent-color: #36c36c;
  margin: 0;
  flex-shrink: 0;
  border-radius: 6px;
  transition: box-shadow 0.3s ease;
  box-shadow: inset 0 0 0 1.5px #999;
}

.checkbox-label input[type="checkbox"]:checked {
  background-color: #36c36c;
  box-shadow: inset 0 0 0 1.5px #2ca155;
}

.checkbox-label:hover {
  border-color: #36c36c;
  background-color: #e6f4ea;
  box-shadow: 0 0 8px rgba(54, 195, 108, 0.3);
}

.checkbox-label input[type="checkbox"]:focus {
  outline-offset: 3px;
  outline: 3px solid #36c36c;
}

/* Optional: add a small flame icon next to label text */
.checkbox-label .icon-flame {
  color: #e74c3c;
  font-size: 1.25rem;
  user-select: none;
  pointer-events: none;
}

    .button-group {
      grid-column: 1 / -1;
      display: flex;
      justify-content: flex-end;
      gap: 1rem;
      margin-top: 1.5rem;
    }

    /* Primary Add button */
    .form button.add-btn {
      padding: 1rem 2.5rem;
      font-size: 1.15rem;
      font-weight: 700;
      border-radius: 12px;
      border: none;
      cursor: pointer;
      user-select: none;
      background-color: #36c36c;
      color: white;
      box-shadow: 0 6px 15px rgba(54,195,108,0.5);
      transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    }

    .form button.add-btn:hover,
    .form button.add-btn:focus {
      background-color: #2ca155;
      box-shadow: 0 8px 22px rgba(38,154,65,0.6);
      transform: translateY(-3px);
      outline: none;
    }

    /* Subtle red Close button */
    .form button.close-btn {
      padding: 1rem 2.5rem;
      font-size: 1.15rem;
      font-weight: 700;
      border-radius: 12px;
      border: none;
      cursor: pointer;
      user-select: none;
      background-color: #fce4e4;
      color: #e74c3c;
      box-shadow: none;
      transition: background-color 0.3s ease;
    }

    .form button.close-btn:hover,
    .form button.close-btn:focus {
      background-color: #f8c2c2;
      outline: none;
    }

    /* Responsive tweaks */
    @media (max-width: 400px) {
      .form {
        grid-template-columns: 1fr;
      }
    }

    /* Header styling to match previous */
    header {
      background: #fff;
      border-bottom: 1px solid #ddd;
      padding: 12px 20px;
      position: sticky;
      top: 0;
      width: 100%;
      z-index: 1000;
      box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    .branding {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .back-arrow {
      font-size: 1.9rem;
      cursor: pointer;
      color: #333;
      text-decoration: none;
      padding: 6px 10px;
      border-radius: 8px;
      user-select: none;
      transition: background-color 0.3s ease, color 0.3s ease;
    }

    .back-arrow:hover,
    .back-arrow:focus {
      background-color: #e6f4ea;
      color: #217a1e;
      outline: none;
    }

    .branding img {
      height: 48px;
      user-select: none;
    }

    .branding h1 {
      font-size: 1.6rem;
      font-weight: 700;
      margin: 0;
      color: #222;
      user-select: none;
    }
    .checkbox-label {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.button-group {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
}

.container {
  max-width: 600px;
  width: 90%;
  margin: 3rem auto;
}

.form input[type="text"],
.form input[type="number"],
.form input[type="file"],
.form select,
.form textarea {
  max-width: 100%;
}
main.container {
  display: flex;
  gap: 2rem;             /* space between form and preview */
  align-items: flex-start; /* align tops */
  flex-wrap: wrap;        /* wrap on smaller screens */
  padding: 1rem;
  max-width: 1100px;
  margin: 5 auto;
  box-sizing: border-box;
}

form.form {
  flex: 1 1 400px;        /* grow, shrink, basis */
  max-width: 600px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#previewSection {
  flex: 1 1 300px;
  min-width: 280px;
  padding: 1rem;
  margin-top: 10px;
  border-radius: 12px;
  box-sizing: border-box;
  height: fit-content;
  position: sticky;
  top: 1rem;              /* sticks when you scroll */
  overflow-wrap: break-word; /* prevent text overflow */
  z-index: 10;            /* prevent overlap with other elements */
}


#previewSection h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #000000;
}

#previewSection p {
  margin: 0.3rem 0;
}

#imagePreview {
  max-width: 100%;
  max-height: 200px;
  display: block;
  margin-top: 1rem;
  border-radius: 12px;
  border: 1px solid #ddd;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  main.container {
    flex-direction: column;
  }

  #previewSection {
    position: static;
    margin-top: 2rem;
  }
}
.input-error {
  border: 2px solid #e74c3c !important;  
  background-color: #fdecea;             
  outline: none;
}
