/* Custom CSS for Coop Registration Form - Premium Medical Sage Theme */

:root {
  --primary-color: #2e7d32; /* Rich Medical Sage Green */
  --primary-light: #e8f5e9; /* Light green tint */
  --primary-dark: #1b5e20; /* Dark forest green */
  --accent-color: #00796b; /* Medical Teal */
  --accent-light: #e0f2f1;
  --bg-color: #f1f8e9; /* Soft greenish background */
  --card-bg: rgba(255, 255, 255, 0.9);
  --text-main: #263238; /* Slate gray/black */
  --text-muted: #546e7a;
  --error-color: #c62828; /* Crimson / Dark Red */
  --error-bg: #ffebee;
  --success-color: #2e7d32;
  --success-bg: #e8f5e9;
  --border-color: #cfd8dc;
  --border-focus: #2e7d32;
  --shadow-main: 0 10px 30px rgba(46, 125, 50, 0.1);
  --shadow-hover: 0 15px 35px rgba(46, 125, 50, 0.15);
  --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  --font-heading: 'Kanit', sans-serif;
  --font-body: 'Sarabun', sans-serif;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  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 */
.background-decor {
  position: fixed;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 50%, #b2dfdb 100%);
}

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

.circle-1 {
  width: 500px;
  height: 500px;
  background-color: #81c784;
  top: -100px;
  right: -100px;
  animation: pulse-slow 15s infinite alternate;
}

.circle-2 {
  width: 600px;
  height: 600px;
  background-color: #4db6ac;
  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(50px, 50px); }
}

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

@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-radius: 50%;
  margin-bottom: 15px;
  box-shadow: 0 8px 20px rgba(46, 125, 50, 0.15);
  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.2));
  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: 2rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 5px;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 1.1rem;
  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 15px auto;
}

.notice {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  background-color: rgba(255, 255, 255, 0.6);
  padding: 10px 15px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-color);
  max-width: 90%;
  margin: 0 auto;
}

/* Card */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  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: 0.95rem;
  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: 14px;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.3s ease, transform 0.3s ease;
}

.form-control {
  width: 100%;
  padding: 14px 14px 14px 44px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-main);
  background-color: white;
  border: 1px solid var(--border-color);
  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='%23546e7a' 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: var(--text-muted);
}

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

.form-control.invalid:focus {
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 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.1rem;
  font-weight: 500;
  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 4px 15px rgba(46, 125, 50, 0.3);
  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 6px 20px rgba(46, 125, 50, 0.4);
}

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

.btn:disabled {
  background: #b0bec5;
  box-shadow: none;
  cursor: not-allowed;
}

.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: var(--text-muted);
}

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

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

@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: var(--primary-color);
}

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

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

.modal-message {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 30px;
  white-space: pre-line; /* Support line breaks in messages */
}

.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: 16px 12px;
  background-color: white;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  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-dark);
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 6px 15px 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(198, 40, 40, 0.02);
}

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

.birthdate-select-wrapper {
  flex: 1;
}

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

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

/* Modal Detail Card */
.modal-detail-card {
  background-color: #f1f8e9;
  border: 1px solid #c8e6c9;
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 15px;
  margin-bottom: 20px;
  text-align: left;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
  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 #e0e0e0;
}

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

.detail-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

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

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

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

/* Responsive adjustments */
@media (max-width: 480px) {
  .container {
    padding: 15px 8px;
  }

  .card {
    padding: 24px 16px;
    border-radius: var(--radius-md);
  }
  
  .title {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

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

  .form {
    gap: 18px;
  }

  /* Adjust marital status buttons for small screens */
  .status-option-btn {
    padding: 12px 6px;
    font-size: 0.85rem;
    gap: 6px;
  }

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

  /* Adjust modal spacing for small screens */
  .modal-box {
    padding: 24px 16px;
  }

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

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

  .modal-message {
    font-size: 0.95rem;
    margin-bottom: 20px;
  }

  /* Stack detail rows on small viewports to prevent layout break */
  .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 0;
  }

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

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

/* Extra support for extremely narrow displays (e.g. 320px) */
@media (max-width: 350px) {
  .status-options-container {
    grid-template-columns: 1fr; /* Stack buttons vertically for very small screen */
    gap: 8px;
  }

  .status-option-btn {
    flex-direction: row;
    justify-content: flex-start;
    padding: 10px 16px;
    gap: 12px;
  }
}
