/* Custom CSS for Coop Registration Form - Soft Pastel Sage Theme */

:root {
  --primary-color: #2e7d32; /* Rich Medical Sage Green (Original Color) */
  --primary-light: #e8f5e9; /* Original Light Green Tint */
  --primary-dark: #1b5e20; /* Original Forest Green */
  --accent-color: #00796b; /* Original Medical Teal */
  --accent-light: #e0f2f1;
  --bg-color: #d2e7d6; /* Soft Sage Green Background (สว่างกำลังดี ไม่เข้มมืดและไม่สว่างจ้าจนแบนราบ) */
  --card-bg: rgba(255, 255, 255, 0.92); /* Frosted White Glass card */
  --text-main: #1c3d23; /* Deep Greenish Indigo text for great readability */
  --text-muted: #557f5f; /* Sage green muted text */
  --error-color: #d32f2f;
  --error-bg: #ffebee;
  --success-color: #2e7d32;
  --success-bg: #e8f5e9;
  --border-color: #b7d8be;
  --border-focus: #2e7d32;
  --shadow-main: 0 15px 35px rgba(46, 125, 50, 0.08);
  --shadow-hover: 0 20px 40px rgba(46, 125, 50, 0.15);
  --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.03);
  --font-heading: 'Kanit', sans-serif;
  --font-body: 'Sarabun', sans-serif;
  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 8px;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Background decorative circles & gradients */
.background-decor {
  position: fixed;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(135deg, #edf7ee 0%, #d5edd9 50%, #bedebd 100%);
}

.circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}

.circle-1 {
  width: 500px;
  height: 500px;
  background-color: #a5d6a7; /* Soft Green glow */
  top: -100px;
  right: -100px;
  animation: pulse-slow 15s infinite alternate;
}

.circle-2 {
  width: 600px;
  height: 600px;
  background-color: #80cbc4; /* Soft Teal glow */
  bottom: -150px;
  left: -150px;
  animation: pulse-slow 20s infinite alternate-reverse;
}

@keyframes pulse-slow {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.1) translate(40px, 40px); }
}

/* Container */
.container {
  width: 100%;
  max-width: 650px;
  padding: 40px 16px;
  margin: auto;
  animation: fade-in-up 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 25px;
}

.logo-area {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 80px;
  height: 80px;
  background: white;
  border: 1px solid rgba(46, 125, 50, 0.15);
  border-radius: 50%;
  margin-bottom: 15px;
  box-shadow: 0 8px 25px rgba(46, 125, 50, 0.12);
  color: var(--primary-color);
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.med-icon {
  stroke: var(--primary-color);
  filter: drop-shadow(0 2px 4px rgba(46, 125, 50, 0.15));
  animation: pulse-heart 2s infinite ease-in-out;
}

@keyframes pulse-heart {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.15); }
  28% { transform: scale(1); }
  42% { transform: scale(1.15); }
  70% { transform: scale(1); }
}

.title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--accent-color);
  margin-bottom: 15px;
}

.divider {
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 2px;
  margin: 0 auto 18px auto;
  box-shadow: 0 2px 8px rgba(46, 125, 50, 0.15);
}

.notice {
  font-size: 0.88rem;
  color: #374151;
  line-height: 1.5;
  background-color: rgba(255, 255, 255, 0.75);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary-color);
  max-width: 95%;
  margin: 0 auto;
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

/* Card */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-main);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

/* Form Styles */
.form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-main);
  transition: color 0.3s ease;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 16px;
  width: 24px;
  height: 24px;
  color: #8caba2;
  pointer-events: none;
  transition: color 0.3s ease, transform 0.3s ease;
}

.form-control {
  width: 100%;
  padding: 16px 16px 16px 48px;
  font-family: var(--font-body);
  font-size: 1.25rem;
  color: var(--text-main);
  background-color: white;
  border: 2px solid rgba(46, 125, 50, 0.15);
  border-radius: var(--radius-md);
  outline: none;
  box-shadow: var(--shadow-inset);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Custom Dropdown Styling */
.custom-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232e7d32' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.15);
  background-color: white;
}

/* Icon change on focus */
.form-group:focus-within .input-icon {
  color: var(--primary-color);
  transform: scale(1.08);
}

.form-group:focus-within .form-label {
  color: var(--primary-color);
}

.help-text {
  font-size: 0.8rem;
  color: #4b6b55;
}

/* Input validation styles */
.form-control.invalid {
  border-color: var(--error-color);
  background-color: rgba(244, 63, 94, 0.02);
}

.form-control.invalid:focus {
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.15);
}

.error-message {
  font-size: 0.8rem;
  color: var(--error-color);
  margin-top: 4px;
  animation: slide-down 0.2s ease-out;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Submit Button & Spinner */
.form-actions {
  margin-top: 10px;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 16px 24px;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  outline: none;
  box-shadow: 0 6px 20px rgba(46, 125, 50, 0.22);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.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: 0.5s;
}

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

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(46, 125, 50, 0.3);
}

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

.btn:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
  color: #94a3b8;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  margin-left: 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 25px;
  font-size: 0.85rem;
  color: #4b6b55;
}

/* Custom Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(12, 35, 16, 0.4);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: opacity 0.3s ease;
}

.modal-box {
  background: white;
  border: 1px solid rgba(46, 125, 50, 0.1);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(46, 125, 50, 0.12);
  text-align: center;
  animation: scale-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scale-in {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-icon-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.modal-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.5) 0.1s both;
}

@keyframes pop-in {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.icon-success {
  background-color: var(--primary-light);
  color: #10b981;
}

.icon-error {
  background-color: var(--error-bg);
  color: var(--error-color);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: var(--text-main);
  margin-bottom: 12px;
}

.modal-message {
  font-size: 1.05rem;
  color: #4b6b55;
  line-height: 1.6;
  margin-bottom: 30px;
  white-space: pre-line;
}

.btn-modal {
  max-width: 160px;
  padding: 12px 30px;
  font-size: 1rem;
}

/* Status Option Buttons (Marital Status Grid) */
.status-options-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.status-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 14px;
  background-color: white;
  border: 2px solid rgba(46, 125, 50, 0.15);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 600;
  color: #4b6b55;
  box-shadow: var(--shadow-inset);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  outline: none;
}

.status-option-btn:hover {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
  color: var(--primary-color);
  transform: translateY(-2px);
}

.status-option-btn.active {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 6px 20px rgba(46, 125, 50, 0.25);
}

.status-icon {
  width: 28px;
  height: 28px;
  stroke-width: 2;
  transition: transform 0.25s ease;
}

.status-option-btn:hover .status-icon {
  transform: scale(1.1);
}

.status-option-btn.active .status-icon {
  stroke: white;
}

.status-options-container.invalid .status-option-btn {
  border-color: var(--error-color);
  background-color: rgba(244, 63, 94, 0.01);
}

/* Birthdate Selects Container */
.birthdate-selects-container {
  display: flex;
  gap: 10px;
  width: 100%;
}

.birthdate-select-wrapper {
  flex: 1;
  min-width: 0;
}

.birthdate-select-wrapper.select-month-wrapper {
  flex: 2;
}

.form-control.select-mini {
  padding-left: 14px;
}

/* Modal Detail Card */
.modal-detail-card {
  background-color: #f0fdf4;
  border: 1px solid #dcfce7;
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 15px;
  margin-bottom: 20px;
  text-align: left;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01);
  animation: slide-up 0.4s ease-out 0.15s both;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}

.detail-row:not(:last-child) {
  border-bottom: 1px dashed #e2e8f0;
}

.detail-row.header-row {
  padding-top: 0;
}

.detail-label {
  color: #4b6b55;
  font-size: 0.9rem;
  font-weight: 500;
}

.detail-value {
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

.detail-value.highlight {
  color: var(--primary-dark);
  font-size: 1.05rem;
  font-weight: 700;
}

.detail-divider {
  height: 1px;
  background-color: #e2e8f0;
  margin: 6px 0;
}

/* Stars decoration inside register screen (Soft Green Stars) */
.register-star {
  position: absolute;
  background-color: #a5d6a7; 
  border-radius: 50%;
  animation: register-twinkle 3s ease-in-out infinite;
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}

@keyframes register-twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 0.95; transform: scale(1.2); }
}

.register-meteor {
  position: absolute;
  width: 1.5px;
  height: 70px;
  background: linear-gradient(to top, rgba(165, 214, 167, 0), rgba(165, 214, 167, 0.85));
  transform: rotate(-45deg);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  animation: register-meteor-fall var(--duration, 7s) infinite linear;
  animation-delay: var(--delay, 0s);
}

@keyframes register-meteor-fall {
  0% { transform: rotate(-45deg) translate3d(0, -70px, 0); opacity: 0; }
  2% { opacity: 0.80; }
  12% { transform: rotate(-45deg) translate3d(0, 450px, 0); opacity: 0; }
  100% { transform: rotate(-45deg) translate3d(0, 450px, 0); opacity: 0; }
}

/* ======================================================== */
/* Responsive & Reposize Configurations for All Devices   */
/* ======================================================== */

/* Small Devices (Tablets, max-width: 768px) */
@media (max-width: 768px) {
  .container {
    padding: 30px 16px;
    max-width: 580px;
  }
  
  .card {
    padding: 30px;
  }
  
  .title {
    font-size: 1.85rem;
  }
}

/* Mobile Phones (max-width: 480px) */
@media (max-width: 480px) {
  .container {
    padding: 20px 8px;
    max-width: 100%;
  }

  .card {
    padding: 24px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.6);
  }
  
  .title {
    font-size: 1.6rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .notice {
    font-size: 0.82rem;
    max-width: 100%;
    padding: 10px 12px;
  }

  .form {
    gap: 20px;
  }

  .form-control {
    padding: 14px 14px 14px 44px;
    font-size: 1.15rem;
  }
  
  .input-icon {
    left: 12px;
    width: 22px;
    height: 22px;
  }

  /* Marital status buttons padding & sizes */
  .status-options-container {
    gap: 8px;
  }

  .status-option-btn {
    padding: 14px 8px;
    font-size: 0.95rem;
    gap: 6px;
  }

  .status-icon {
    width: 24px;
    height: 24px;
  }

  /* Adjust birthdate select spacing */
  .birthdate-selects-container {
    gap: 8px;
  }

  .form-control.select-mini {
    padding-left: 10px;
  }

  /* Modal responsive adjustments */
  .modal-box {
    padding: 30px 16px;
  }

  .modal-icon {
    width: 70px;
    height: 70px;
  }

  .modal-title {
    font-size: 1.4rem;
  }

  .modal-message {
    font-size: 0.98rem;
    margin-bottom: 24px;
  }

  /* Stack detail rows on small viewports to prevent overflow */
  .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 0;
  }

  .detail-value {
    text-align: left;
    width: 100%;
    font-size: 0.92rem;
  }

  .detail-value.highlight {
    font-size: 1rem;
  }
}

/* Extra small displays & Older Phones (max-width: 360px) */
@media (max-width: 360px) {
  .status-options-container {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .status-option-btn {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 20px;
    gap: 14px;
    font-size: 1.05rem;
  }

  .birthdate-selects-container {
    flex-direction: column;
    gap: 8px;
  }

  .birthdate-select-wrapper.select-month-wrapper {
    flex: 1;
  }
  
  .form-control.custom-select {
    padding-left: 16px;
  }
}
