/* ============================================
   Restaurant Events, Inc. - Form Styles
   ============================================ */

/* ============================================
   Form Container
   ============================================ */

.form-container {
  background-color: #fff;
  padding: var(--spacing-lg);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.form-container.dark {
  background-color: var(--bg-dark);
  color: var(--text-light);
}

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

.form-container.dark .form-title {
  color: var(--accent-color);
}

.form-description {
  color: var(--gray);
  margin-bottom: var(--spacing-md);
}

/* ============================================
   Form Elements
   ============================================ */

.form {
  width: 100%;
}

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-sm);
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-dark);
}

.form-container.dark .form-label {
  color: var(--text-light);
}

.form-label.required::after {
  content: '*';
  color: #e74c3c;
  margin-left: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 4px;
  background-color: #fff;
  color: var(--text-dark);
  transition: var(--transition-normal);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(164, 210, 51, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #999;
}

.form-textarea {
  min-height: 150px;
  resize: vertical;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* ============================================
   Checkbox & Radio Styles
   ============================================ */

.checkbox-group,
.radio-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-sm);
}

.checkbox-item,
.radio-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-checkbox,
.form-radio {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent-color);
}

.checkbox-label,
.radio-label {
  cursor: pointer;
  user-select: none;
}

/* ============================================
   Form Validation States
   ============================================ */

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: #e74c3c;
}

.form-input.success,
.form-select.success,
.form-textarea.success {
  border-color: #27ae60;
}

.form-error {
  display: none;
  color: #e74c3c;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.form-error.show {
  display: block;
}

.form-success {
  display: none;
  color: #27ae60;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.form-success.show {
  display: block;
}

/* ============================================
   Form Buttons
   ============================================ */

.form-submit {
  width: 100%;
  padding: 1rem 2rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.125rem;
  background-color: var(--accent-color);
  color: var(--primary-color);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-normal);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: var(--spacing-sm);
}

.form-submit:hover:not(:disabled) {
  background-color: #8fb82a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(164, 210, 51, 0.3);
}

.form-submit:active:not(:disabled) {
  transform: translateY(0);
}

.form-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-submit.loading {
  position: relative;
  color: transparent;
}

.form-submit.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0,0,0,0.3);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ============================================
   Form Messages
   ============================================ */

.form-message {
  padding: var(--spacing-sm);
  border-radius: 4px;
  margin-bottom: var(--spacing-md);
  display: none;
}

.form-message.show {
  display: block;
}

.form-message.success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.form-message.error {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.form-message.info {
  background-color: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

/* ============================================
   Helper Text
   ============================================ */

.form-helper {
  font-size: 0.875rem;
  color: var(--gray);
  margin-top: 0.25rem;
}

.form-container.dark .form-helper {
  color: #aaa;
}

/* ============================================
   Required Field Indicator
   ============================================ */

.required-note {
  font-size: 0.875rem;
  color: var(--gray);
  margin-bottom: var(--spacing-md);
}

.required-note::before {
  content: '*';
  color: #e74c3c;
  margin-right: 0.25rem;
}

/* ============================================
   File Upload
   ============================================ */

.file-upload {
  position: relative;
}

.file-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.file-label {
  display: inline-block;
  padding: 0.875rem 1.5rem;
  background-color: #f5f5f5;
  border: 2px dashed #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-normal);
  text-align: center;
  width: 100%;
}

.file-label:hover {
  border-color: var(--accent-color);
  background-color: rgba(164, 210, 51, 0.05);
}

.file-name {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray);
}

/* ============================================
   Date & Time Inputs
   ============================================ */

.form-input[type="date"],
.form-input[type="time"],
.form-input[type="datetime-local"] {
  cursor: pointer;
}

/* ============================================
   Number Input
   ============================================ */

.form-input[type="number"] {
  -moz-appearance: textfield;
}

.form-input[type="number"]::-webkit-inner-spin-button,
.form-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ============================================
   Phone Input
   ============================================ */

.form-input[type="tel"] {
  letter-spacing: 0.5px;
}

/* ============================================
   Search Input
   ============================================ */

.search-wrapper {
  position: relative;
}

.search-input {
  padding-left: 2.5rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  pointer-events: none;
}

/* ============================================
   Form Grid Layouts
   ============================================ */

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-sm);
}

@media (min-width: 768px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-sm);
}

@media (min-width: 768px) {
  .form-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   Animations
   ============================================ */

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

.shake {
  animation: shake 0.5s;
}

/* ============================================
   Accessibility
   ============================================ */

.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible,
.form-checkbox:focus-visible,
.form-radio:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}