/* Select Form - Advanced Premium Design */
/* Reusing the same design system as CreateAudit */

/* CSS Custom Properties for Design System */
:root {
  --primary-50: #fff7ed;
  --primary-100: #ffedd5;
  --primary-200: #fed7aa;
  --primary-400: #fb923c;
  --primary-500: #f21b23;
  --primary-600: #d91820;
  --primary-700: #c2410c;
  
  --neutral-50: #fafafa;
  --neutral-100: #e5e5e5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Main Container */
.select-form-container {
  padding: 2.5rem 3rem;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 1.5rem;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Header */
.select-form-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--neutral-200);
}

.select-form-title {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--neutral-800) 0%, var(--neutral-600) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 0.5rem 0;
}

.select-form-subtitle {
  font-size: 1rem;
  color: var(--neutral-600);
  margin: 0;
}

.select-form-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Observation requirement banner (min 2 observations) */
.select-form-observation-requirement {
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: 0.75rem;
  font-size: 0.9375rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.select-form-observation-requirement.requirement-pending {
  background: linear-gradient(135deg, #fef2f2 0%, #fff7ed 100%);
  border: 1px solid var(--primary-200);
  color: var(--neutral-700);
}

.select-form-observation-requirement.requirement-met {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #86efac;
  color: var(--neutral-800);
}

.select-form-observation-requirement .requirement-label {
  font-weight: 600;
}

.select-form-observation-requirement .requirement-count {
  font-weight: 800;
  color: var(--primary-600);
}

.select-form-observation-requirement.requirement-met .requirement-count {
  color: #15803d;
}

.select-form-observation-requirement .requirement-hint {
  width: 100%;
  font-size: 0.875rem;
  color: var(--neutral-600);
  font-weight: 500;
}

/* Forms Tabs */
.forms-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--neutral-200);
  padding-bottom: 0;
}

.tab-button {
  padding: 0.875rem 2rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--neutral-600);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  bottom: -2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tab-button:hover {
  color: var(--primary-600);
  background: var(--primary-50);
}

.tab-button.active {
  color: var(--primary-600);
  border-bottom-color: var(--primary-500);
  background: transparent;
}

.tab-button.active:hover {
  background: transparent;
}

/* Disabled tab state */
.tab-button.disabled,
.tab-button:disabled {
  color: var(--neutral-400);
  cursor: not-allowed;
  background: transparent;
  border-bottom-color: transparent;
}

.tab-button.disabled:hover,
.tab-button:disabled:hover {
  color: var(--neutral-400);
  background: transparent;
}

/* Forms List Container */
.forms-list-container {
  margin-top: 1rem;
}

.forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.form-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 250, 250, 0.95) 100%);
  border: 2px solid var(--neutral-200);
  border-radius: 0.875rem;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.form-card:hover {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  background: linear-gradient(135deg, #ffffff 0%, rgba(255, 237, 213, 0.3) 100%);
}

.form-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.form-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--neutral-800);
  margin: 0;
  flex: 1;
}

.form-card-type {
  padding: 0.25rem 0.75rem;
  background: var(--primary-100);
  color: var(--primary-700);
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-card-description {
  font-size: 0.875rem;
  color: var(--neutral-600);
  margin: 0.75rem 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.form-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--neutral-200);
}

.form-card-questions {
  font-size: 0.8125rem;
  color: var(--neutral-500);
  font-weight: 500;
}

/* No Forms Message */
.no-forms-message {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--neutral-500);
  font-size: 1.125rem;
}

/* Buttons */
.btn {
  padding: 0.875rem 2rem;
  border-radius: 0.75rem;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  letter-spacing: 0.03em;
}

.btn-secondary {
  background: linear-gradient(135deg, #ffffff 0%, var(--neutral-50) 100%);
  color: var(--neutral-700);
  border: 2px solid var(--neutral-200);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, var(--neutral-50) 0%, var(--neutral-100) 100%);
  border-color: var(--neutral-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(255, 152, 0, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-400) 0%, var(--primary-500) 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 152, 0, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary:disabled:hover {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  transform: none;
  box-shadow: 0 4px 14px rgba(255, 152, 0, 0.35);
}

/* Error Message */
.error-message {
  padding: 1.125rem 1.5rem;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #b91c1c;
  border-radius: 0.75rem;
  border: 1px solid #fecaca;
  font-size: 0.875rem;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .select-form-container {
    padding: 1.5rem;
  }

  .select-form-title {
    font-size: 1.5rem;
  }

  .select-form-header {
    flex-direction: column;
    gap: 1rem;
  }

  .select-form-header-actions {
    flex-direction: column;
    width: 100%;
  }

  .select-form-header .btn,
  .select-form-header-actions .btn {
    width: 100%;
  }

  .forms-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
  }

  .tab-button {
    flex-shrink: 0;
  }

  .forms-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .select-form-container {
    padding: 1rem;
  }

  .select-form-title {
    font-size: 1.25rem;
  }
}

/* ================================ DARK THEME (night mode) ================================ */
body.night-mode .select-form-container {
  background: rgba(58, 56, 56, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .select-form-header {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}
body.night-mode .select-form-title {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.85) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
body.night-mode .select-form-subtitle {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .select-form-header .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.25);
}
body.night-mode .select-form-header .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
}
body.night-mode .select-form-observation-requirement.requirement-pending {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
  color: rgba(255, 255, 255, 0.9);
}
body.night-mode .select-form-observation-requirement.requirement-met {
  background: rgba(52, 211, 153, 0.2);
  border-color: rgba(52, 211, 153, 0.4);
  color: rgba(255, 255, 255, 0.95);
}
body.night-mode .select-form-observation-requirement .requirement-hint {
  color: rgba(255, 255, 255, 0.75);
}
body.night-mode .forms-tabs {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}
body.night-mode .tab-button {
  color: rgba(255, 255, 255, 0.85);
}
body.night-mode .tab-button:hover {
  color: #f87171;
  background: rgba(255, 255, 255, 0.08);
}
body.night-mode .tab-button.active {
  color: #f87171;
  border-bottom-color: #f87171;
}
body.night-mode .no-forms-message {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .form-card {
  background: rgba(58, 56, 56, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
}
body.night-mode .form-card:hover {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(255, 255, 255, 0.06);
}
body.night-mode .form-card-title {
  color: rgba(255, 255, 255, 0.98);
}
body.night-mode .form-card-description,
body.night-mode .form-card-questions {
  color: rgba(255, 255, 255, 0.8);
}
body.night-mode .form-card-type {
  background: rgba(248, 113, 113, 0.25);
  color: #fca5a5;
}
body.night-mode .form-card-footer {
  border-top-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .error-message {
  background: rgba(248, 113, 113, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, 0.4);
}
