/**
 * OpenMolecular Form Styles
 * Styles for form messages, states, and interactions
 */

/* Form Messages */
.form-message {
  padding: 1.5rem;
  border-radius: 12px;
  margin: 2rem 0;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-success {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  border-left: 4px solid #2e7d32;
}

.form-error {
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
  border-left: 4px solid #c62828;
}

.form-warning {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  border-left: 4px solid #f57c00;
}

.message-icon {
  font-size: 2rem;
  line-height: 1;
}

.message-content h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
}

.message-content p {
  margin: 0;
  line-height: 1.5;
}

/* Form States */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input.error,
textarea.error,
select.error {
  border-color: #c62828;
}

input.success,
textarea.success,
select.success {
  border-color: #2e7d32;
}

/* Loading States */
.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

/* Form Validation */
.field-error {
  color: #c62828;
  font-size: 0.85rem;
  margin-top: 0.3rem;
  display: block;
}

.field-success {
  color: #2e7d32;
  font-size: 0.85rem;
  margin-top: 0.3rem;
  display: block;
}

/* Interest Tags (for newsletter page) */
.interest-tag {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #f0f0f0;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s;
  user-select: none;
}

.interest-tag:hover {
  background: #e8eef9;
  border-color: #667eea;
}

.interest-tag.selected {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

/* Character Counter */
.char-counter {
  text-align: right;
  font-size: 0.85rem;
  color: #7f8c8d;
  margin-top: 0.3rem;
}

.char-counter.warning {
  color: #f57c00;
}

.char-counter.error {
  color: #c62828;
}

/* Form Progress Indicator */
.form-progress {
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.form-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 0.3s ease;
}

/* Required Field Indicator */
label .required {
  color: #c62828;
  font-weight: bold;
}

/* File Upload States */
.file-upload-success {
  border-color: #2e7d32 !important;
  background: #e8f5e9 !important;
}

.file-upload-error {
  border-color: #c62828 !important;
  background: #ffebee !important;
}

/* Tooltip */
.form-tooltip {
  position: relative;
  display: inline-block;
  margin-left: 0.3rem;
  cursor: help;
}

.form-tooltip .tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: #2c3e50;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 0.5rem;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.85rem;
}

.form-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .form-message {
    padding: 1rem;
  }

  .message-icon {
    font-size: 1.5rem;
  }

  .message-content h4 {
    font-size: 1rem;
  }

  .message-content p {
    font-size: 0.9rem;
  }
}
