/* ========================================
   ENHANCED FORM STYLES
   ======================================== */

/* ========================================
   FORM CONTAINERS
   ======================================== */
.form-container {
  background: var(--bg-darker);
  border-radius: 16px;
  padding: var(--spacing-2xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--spacing-xl);
}

.form-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.form-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.form-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ========================================
   FORM GROUPS & FIELDS
   ======================================== */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.form-field {
  position: relative;
  margin-bottom: var(--spacing-md);
}

/* ========================================
   LABELS
   ======================================== */
.form-label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
  font-size: 0.875rem;
  letter-spacing: 0.025em;
}

.form-label.required::after {
  content: ' *';
  color: #dc2626;
  font-weight: 700;
}

.form-label-hint {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 2px;
  line-height: 1.4;
}

/* ========================================
   INPUT FIELDS
   ======================================== */
.form-input {
  width: 100%;
  padding: var(--spacing-md);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-dark);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  transition: all var(--transition-base);
  font-family: var(--font-primary);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(0, 178, 138, 0.1);
  background: var(--bg-dark);
}

.form-input:disabled {
  background: var(--bg-darker);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Input States */
.form-input.error {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.form-input.success {
  border-color: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.form-input.loading {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300d4a4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 11-6.219-8.56'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  animation: spin 1s linear infinite;
}

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

/* ========================================
   TEXTAREA
   ======================================== */
.form-textarea {
  width: 100%;
  padding: var(--spacing-md);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-dark);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  transition: all var(--transition-base);
  font-family: var(--font-primary);
  resize: vertical;
  min-height: 120px;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(0, 178, 138, 0.1);
}

/* ========================================
   SELECT DROPDOWNS
   ======================================== */
.form-select {
  width: 100%;
  padding: var(--spacing-md);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-dark);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  transition: all var(--transition-base);
  cursor: pointer;
  font-family: var(--font-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23666' 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 12px center;
  background-size: 20px;
  padding-right: 40px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(0, 178, 138, 0.1);
}

.form-select option {
  background: var(--bg-dark);
  color: var(--text-primary);
  padding: var(--spacing-sm);
}

/* ========================================
   CHECKBOXES & RADIOS
   ======================================== */
.form-checkbox,
.form-radio {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  cursor: pointer;
  line-height: 1.5;
}

.form-checkbox input[type="checkbox"],
.form-radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.form-checkbox-custom,
.form-radio-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  background: var(--bg-dark);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  position: relative;
  margin-top: 2px;
}

.form-checkbox-custom {
  border-radius: 4px;
}

.form-radio-custom {
  border-radius: 50%;
}

.form-checkbox input[type="checkbox"]:checked ~ .form-checkbox-custom,
.form-radio input[type="radio"]:checked ~ .form-radio-custom {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.form-checkbox input[type="checkbox"]:checked ~ .form-checkbox-custom::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 6px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.form-radio input[type="radio"]:checked ~ .form-radio-custom::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

.form-checkbox-label,
.form-radio-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  cursor: pointer;
}

.form-checkbox:hover .form-checkbox-custom,
.form-radio:hover .form-radio-custom {
  border-color: var(--primary-color);
}

/* ========================================
   FORM BUTTONS
   ======================================== */
.form-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  min-height: 48px;
  font-family: var(--font-primary);
  letter-spacing: 0.025em;
}

.form-button-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 178, 138, 0.2);
}

.form-button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 178, 138, 0.3);
}

.form-button-secondary {
  background: var(--bg-dark);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.form-button-secondary:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.form-button-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid transparent;
}

.form-button-ghost:hover {
  background: rgba(0, 178, 138, 0.05);
  color: var(--primary-color);
}

.form-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.form-button-loading {
  pointer-events: none;
  opacity: 0.8;
}

.form-button-loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: var(--spacing-xs);
}

/* ========================================
   FORM ACTIONS
   ======================================== */
.form-actions {
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

.form-actions.centered {
  justify-content: center;
}

.form-actions.full-width .form-button {
  flex: 1;
}

/* ========================================
   FORM MESSAGES
   ======================================== */
.form-message {
  padding: var(--spacing-md);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.form-message-success {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.form-message-error {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.form-message-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.form-message-info {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ========================================
   FIELD ERRORS
   ======================================== */
.field-error {
  color: #dc2626;
  font-size: 0.75rem;
  margin-top: var(--spacing-xs);
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-error::before {
  content: '⚠';
  font-size: 0.875rem;
}

.field-success {
  color: #10b981;
  font-size: 0.75rem;
  margin-top: var(--spacing-xs);
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-success::before {
  content: '✓';
  font-size: 0.875rem;
}

/* ========================================
   FORM PROGRESS
   ======================================== */
.form-progress {
  margin-bottom: var(--spacing-xl);
}

.form-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
}

.form-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  flex: 1;
  position: relative;
}

.form-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--border-color);
  z-index: 1;
}

.form-step.completed::after {
  background: var(--primary-color);
}

.form-step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-darker);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  z-index: 2;
  position: relative;
}

.form-step.active .form-step-number {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.form-step.completed .form-step-number {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.form-step-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  font-weight: 500;
}

.form-step.active .form-step-label {
  color: var(--text-primary);
}

/* ========================================
   FORM SEARCH
   ======================================== */
.form-search {
  position: relative;
  margin-bottom: var(--spacing-lg);
}

.form-search-input {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-md) var(--spacing-md) 48px;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-dark);
  color: var(--text-primary);
  transition: all var(--transition-base);
}

.form-search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(0, 178, 138, 0.1);
}

.form-search-icon {
  position: absolute;
  left: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.form-search-button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: var(--spacing-xs) var(--spacing-md);
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-search-button:hover {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 178, 138, 0.3);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
  .form-container {
    padding: var(--spacing-lg);
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions .form-button {
    width: 100%;
  }
  
  .form-steps {
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  .form-step:not(:last-child)::after {
    display: none;
  }
  
  .form-step {
    flex-direction: row;
    justify-content: flex-start;
  }
}

/* ========================================
   FILTER SPECIFIC STYLES
   ======================================== */
.filter-count {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 400;
  margin-left: auto;
}

.form-checkbox-label .filter-count {
  margin-left: 8px;
}

.filter-group {
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.filter-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.filter-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.clear-filters {
  font-size: 0.875rem;
  color: var(--primary-color);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: opacity var(--transition-fast);
}

.clear-filters:hover {
  opacity: 0.8;
}

/* ========================================
   FORM ANIMATIONS
   ======================================== */
.form-field {
  opacity: 0;
  transform: translateY(20px);
  animation: formFieldSlideIn 0.4s ease forwards;
}

.form-field:nth-child(1) { animation-delay: 0.1s; }
.form-field:nth-child(2) { animation-delay: 0.2s; }
.form-field:nth-child(3) { animation-delay: 0.3s; }
.form-field:nth-child(4) { animation-delay: 0.4s; }
.form-field:nth-child(5) { animation-delay: 0.5s; }

@keyframes formFieldSlideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-button {
  position: relative;
  overflow: hidden;
}

.form-button::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;
}

.form-button:hover::before {
  left: 100%;
}