* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #fdfdff 0%, #4ea24b 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  position: relative;
}

body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="10" cy="60" r="0.5" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="40" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  pointer-events: none;
}

.container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  max-width: 800px;
  width: 100%;
  padding: 40px 50px;
  border-radius: 24px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  animation: slideUp 0.8s ease-out;
  margin: 20px auto;
  max-height: 95vh;
  overflow-y: auto;
}

.container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #55883B, #88c56a, #55883B);
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0%, 100% { background-position: 200% 0; }
  50% { background-position: -200% 0; }
}

.logo {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, #55883B, #88c56a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  position: relative;
}

h1 {
  text-align: center;
  font-size: 28px;
  margin-bottom: 8px;
  color: #2c3e50;
  font-weight: 600;
}

.container > p {
  text-align: center;
  margin-bottom: 35px;
  color: #64748b;
  font-size: 16px;
  font-weight: 400;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-bottom: 20px;
}

.form-col {
  position: relative;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #374151;
  transition: color 0.3s ease;
}

.input-wrapper {
  position: relative;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 400;
  background: #fafbfc;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus {
  border-color: #55883B;
  background: #ffffff;
  outline: none;
  box-shadow: 
    0 0 0 3px rgba(85, 136, 59, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

input[type="text"]:valid,
input[type="email"]:valid,
input[type="tel"]:valid {
  border-color: #10b981;
  background: #f0fdf4;
}

input[type="text"]:invalid:not(:placeholder-shown),
input[type="email"]:invalid:not(:placeholder-shown),
input[type="tel"]:invalid:not(:placeholder-shown) {
  border-color: #ef4444;
  background: #fef2f2;
}

.input-wrapper::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.input-wrapper:has(input:valid)::after {
  content: '✓';
  color: #10b981;
  font-weight: bold;
  opacity: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.submit-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #55883B, #88c56a);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  margin-top: 25px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-height: 52px;
}

.submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(85, 136, 59, 0.3);
}

.submit-btn:hover::before {
  left: 100%;
}

.submit-btn:active {
  transform: translateY(0);
}

.terms {
  margin-top: 25px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  border-left: 4px solid #55883B;
  font-size: 14px;
  color: #64748b;
  position: relative;
}

.terms label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  margin-bottom: 0;
  font-weight: 400;
  line-height: 1.5;
}

.terms input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #55883B;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.terms a {
  color: #55883B;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.terms a:hover {
  color: #88c56a;
  text-decoration: underline;
}

.login-link {
  text-align: center;
  margin-top: 30px;
  font-size: 15px;
  color: #64748b;
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.login-link a {
  color: #55883B;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  padding: 4px 8px;
  border-radius: 6px;
}

.login-link a:hover {
  background: #55883B;
  color: white;
  text-decoration: none;
}

/* Floating labels effect */
.form-col:focus-within label {
  color: #55883B;
  transform: scale(0.95);
}

/* ----- PASSWORD TOGGLE STYLES ----- */
/* Style for the input wrapper */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 40px;
}

.password-input-wrapper i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.2em;
    color: #555;
    z-index: 2; 
}
/* RESPONSIVE BREAKPOINTS */

/* Large tablets and small desktops (1024px and down) */
@media (max-width: 1024px) {
  .container {
    max-width: 700px;
    padding: 35px 40px;
  }
  
  .form-row {
    gap: 20px;
  }
}

/* Tablets (768px and down) */
@media (max-width: 768px) {
  body {
    padding: 15px;
    align-items: flex-start;
    padding-top: 30px;
  }

  .container {
    padding: 30px 25px;
    margin: 0;
    border-radius: 20px;
    max-height: none;
    min-height: auto;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 18px;
  }

  .logo {
    font-size: 28px;
    margin-bottom: 15px;
  }

  .logo::after {
    right: calc(50% - 70px);
    font-size: 22px;
  }

  h1 {
    font-size: 24px;
    margin-bottom: 6px;
  }

  .container > p {
    margin-bottom: 25px;
    font-size: 15px;
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="password"] {
    padding: 12px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 10px;
  }

  .submit-btn {
    padding: 14px;
    font-size: 16px;
    margin-top: 20px;
    min-height: 48px;
  }

  .terms {
    padding: 15px;
    margin-top: 20px;
    font-size: 13px;
  }

  .login-link {
    padding: 15px;
    margin-top: 20px;
    font-size: 14px;
  }
}
 
/* Large phones (480px and down) */
@media (max-width: 480px) {
  body {
    padding: 10px;
    padding-top: 20px;
  }

  .container {
    padding: 25px 20px;
    border-radius: 16px;
  }

  .logo {
    font-size: 24px;
    margin-bottom: 12px;
  }

  .logo::after {
    right: calc(50% - 60px);
    font-size: 18px;
  }

  h1 {
    font-size: 22px;
  }

  .container > p {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .form-row {
    gap: 15px;
    margin-bottom: 15px;
  }

  label {
    font-size: 13px;
    margin-bottom: 6px;
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="password"] {
    padding: 12px 14px;
    font-size: 16px;
    border-radius: 8px;
  }

  .submit-btn {
    padding: 12px;
    font-size: 15px;
    border-radius: 8px;
    margin-top: 15px;
  }

  .terms {
    padding: 12px;
    font-size: 12px;
    margin-top: 15px;
    border-radius: 8px;
  }

  .terms label {
    gap: 8px;
  }

  .terms input[type="checkbox"] {
    width: 16px;
    height: 16px;
  }

  .login-link {
    padding: 12px;
    font-size: 13px;
    margin-top: 15px;
    border-radius: 8px;
  }
}

/* Extra small phones (360px and down) */
@media (max-width: 360px) {
  .container {
    padding: 20px 15px;
  }

  .logo {
    font-size: 22px;
  }

  .logo::after {
    right: calc(50% - 55px);
    font-size: 16px;
  }

  h1 {
    font-size: 20px;
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="password"] {
    padding: 10px 12px;
    font-size: 16px;
  }

  .submit-btn {
    padding: 10px;
    font-size: 14px;
  }
}

/* Landscape orientation for phones */
@media (max-height: 600px) and (orientation: landscape) {
  body {
    padding: 10px;
    align-items: flex-start;
  }

  .container {
    margin: 10px auto;
    padding: 20px 25px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .logo {
    font-size: 20px;
    margin-bottom: 8px;
  }

  .logo::after {
    font-size: 14px;
    right: calc(50% - 50px);
  }

  h1 {
    font-size: 18px;
    margin-bottom: 5px;
  }

  .container > p {
    font-size: 13px;
    margin-bottom: 15px;
  }

  .form-row {
    gap: 15px;
    margin-bottom: 12px;
  }

  label {
    font-size: 12px;
    margin-bottom: 4px;
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="password"] {
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 8px;
  }

  .submit-btn {
    padding: 10px;
    font-size: 14px;
    margin-top: 12px;
    min-height: 40px;
  }

  .terms {
    padding: 10px;
    font-size: 11px;
    margin-top: 12px;
  }

  .terms label {
    gap: 6px;
  }

  .terms input[type="checkbox"] {
    width: 14px;
    height: 14px;
  }

  .login-link {
    padding: 10px;
    font-size: 12px;
    margin-top: 12px;
  }
}

/* Success Modal Enhancements */
#success-modal {
  backdrop-filter: blur(10px);
}

#success-modal > div {
  animation: modalSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Custom scrollbar */
.container::-webkit-scrollbar {
  width: 6px;
}

.container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.container::-webkit-scrollbar-thumb {
  background: #55883B;
  border-radius: 3px;
}

.container::-webkit-scrollbar-thumb:hover {
  background: #88c56a;
}

/* Input focus animations */
@keyframes inputFocus {
  0% { box-shadow: 0 0 0 0 rgba(85, 136, 59, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(85, 136, 59, 0); }
  100% { box-shadow: 0 0 0 0 rgba(85, 136, 59, 0); }
}

input:focus {
  animation: inputFocus 0.6s ease-out;
}

/* Loading state for submit button */
.submit-btn:disabled {
  background: linear-gradient(135deg, #9ca3af, #d1d5db);
  cursor: not-allowed;
  transform: none;
}

.submit-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Password strength indicator styles */
.password-strength {
  font-size: 12px;
  margin-top: 5px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.password-strength.very-weak { color: #dc2626; }
.password-strength.weak { color: #ea580c; }
.password-strength.medium { color: #ca8a04; }
.password-strength.good { color: #16a34a; }
.password-strength.strong { color: #15803d; }

.password-match {
  font-size: 12px;
  margin-top: 5px;
  font-weight: 500;
  transition: all 0.3s ease;
}

/* Fade-in animation for form elements */
.fade-in {
  animation: fadeInUp 0.6s ease-out both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Shake animation for invalid inputs */
.input-group input:invalid {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Button text and icon transitions */
.btn-text, .btn-icon {
  transition: all 0.3s ease;
}

.submit-btn:hover .btn-icon {
  transform: translateX(5px);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .container {
    border: 2px solid #000;
    background: #fff;
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="password"] {
    border: 2px solid #000;
    background: #fff;
  }

  .submit-btn {
    background: #000;
    border: 2px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .logo::after {
    animation: none;
  }

  .container::before {
    animation: none;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
  }

  .container {
    box-shadow: none;
    border: 1px solid #000;
    background: white;
  }

  .submit-btn {
    background: #000;
    color: white;
  }
}

/* Custom styles for the Barangay, City, and Zip Code select fields */
#barangay, #city, #zip {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 400;
  background: #fafbfc;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  appearance: none; /* Removes default dropdown arrow */
  background-position: right 12px center; /* Position the arrow */
  background-repeat: no-repeat;
  background-size: 16px;
}

/* Focus effect for Barangay, City, and Zip Code select fields */
#barangay:focus, #city:focus, #zip:focus {
  border-color: #55883B;
  background: #ffffff;
  outline: none;
  box-shadow: 
    0 0 0 3px rgba(85, 136, 59, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

/* Valid and invalid states for select fields */
#barangay:valid, #city:valid, #zip:valid {
  border-color: #10b981;
  background: #f0fdf4;
}

#barangay:invalid, #city:invalid, #zip:invalid {
  border-color: #ef4444;
  background: #fef2f2;
}

/* ===================================================
   FORMATTED TERMS & PRIVACY POLICY STYLE (AgriBayan)
   =================================================== */

/* ================== MODAL STYLES ================== */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: #fff;
  margin: 5% auto;
  border-radius: 14px;
  width: 90%;
  max-width: 750px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.3s ease;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  background: linear-gradient(135deg, #2E7D32, #1B5E20);
  color: white;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  position: sticky;
  top: 0;
}

.modal-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
}

.modal-header i {
  font-size: 1.4rem;
}

.modal-body {
  padding: 25px 35px;
  overflow-y: auto;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: #333;
  font-size: 0.96rem;
  line-height: 1.7;
}

.modal-body p {
  margin-bottom: 14px;
  text-align: justify;
}

.modal-body ul {
  margin: 10px 0 15px 25px;
  padding-left: 15px;
}

.modal-body li {
  margin-bottom: 8px;
}

.modal-body strong {
  color: #1B5E20;
}

.modal-body b {
  color: #2E7D32;
}

.close {
  cursor: pointer;
  color: #fff;
  font-size: 26px;
  transition: color 0.3s;
}

.close:hover {
  color: #C8E6C9;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
