/* ========================================
   FORM COMPONENT STYLES
   ========================================
   Consolidated form styles from across the codebase.
   
   USAGE:
   - Import after tokens.css
   - Use .form-group for field containers
   - Use .form-control for inputs
   
   COMPONENTS:
   - .form-group: Field wrapper with label
   - .form-control: Input, select, textarea
   - .form-label: Field labels
   - .input-group: Input with icon
   - .form-message: Success/error messages
   - .form-actions: Button row
   
   AUTH COMPONENTS:
   - .auth-container: Centered auth page wrapper
   - .auth-card: Auth form card
   - .auth-modal: Modal overlay for auth
   - .role-selector: Radio button role picker
   
   MIGRATION NOTE:
   - Consolidates styles from auth.css, admin.css, styles.css
   - Uses tokens.css variables for consistency
*/

/* ==========================================
   FORM GROUP
   ========================================== */
.form-group {
  margin-bottom: var(--space-5);
}

.form-group.inline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ==========================================
   FORM LABELS
   ========================================== */
.form-label,
.form-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.form-label.required::after {
  content: ' *';
  color: var(--color-danger);
}

/* ==========================================
   FORM CONTROLS
   ========================================== */
.form-control,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background-color: var(--surface-input);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  transition: all var(--transition-base);
}

.form-control:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(127, 209, 199, 0.2);
}

.form-control:disabled,
.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: rgba(255, 255, 255, 0.02);
}

/* Textarea specific */
textarea.form-control,
.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

/* Select specific */
select.form-control,
.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0a0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
}

/* ==========================================
   INPUT GROUP (with icon)
   ========================================== */
.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-accent);
  font-size: var(--text-lg);
  pointer-events: none;
}

.input-group .form-control,
.input-group input {
  padding-left: var(--space-12);
}

/* Right icon variant */
.input-group.icon-right .input-icon {
  left: auto;
  right: var(--space-4);
}

.input-group.icon-right .form-control,
.input-group.icon-right input {
  padding-left: var(--space-4);
  padding-right: var(--space-12);
}

/* ==========================================
   FORM MESSAGES
   ========================================== */
.form-message,
.error-message,
.success-message {
  margin-top: var(--space-4);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  text-align: center;
  animation: messageFadeIn 0.3s ease;
}

@keyframes messageFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-message.error,
.error-message {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ff6b6b;
}

.form-message.success,
.success-message {
  background-color: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4caf50;
}

.form-message.warning {
  background-color: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}

.form-message.info {
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #3b82f6;
}

/* ==========================================
   FORM ACTIONS
   ========================================== */
.form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.form-actions.right {
  justify-content: flex-end;
}

.form-actions.center {
  justify-content: center;
}

.form-actions.between {
  justify-content: space-between;
}

/* ==========================================
   FORM OPTIONS (Remember me, etc.)
   ========================================== */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}

.remember-me {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
}

.remember-me input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.forgot-password {
  color: var(--color-primary-light);
  text-decoration: none;
}

.forgot-password:hover {
  text-decoration: underline;
}

/* ==========================================
   FORM FOOTER
   ========================================== */
.form-footer {
  margin-top: var(--space-5);
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
}

.form-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-base);
}

.form-footer a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ==========================================
   AUTH CONTAINER
   ========================================== */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 150px);
  padding: var(--space-12) var(--space-5);
  background: linear-gradient(135deg, rgba(26, 47, 53, 0.02) 0%, rgba(127, 209, 199, 0.05) 100%);
}

/* ==========================================
   AUTH CARD
   ========================================== */
.auth-card {
  background: var(--text-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 480px;
  padding: var(--space-10);
  transition: transform var(--transition-base);
}

.auth-card:hover {
  transform: translateY(-5px);
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-header h1 {
  font-family: var(--font-body);
  font-weight: var(--font-semibold);
  font-size: var(--text-3xl);
  color: var(--color-secondary);
  margin-bottom: var(--space-2);
}

.auth-header p {
  color: #4A6B63;
  font-size: var(--text-lg);
}

/* Auth form specific overrides for light background */
.auth-form .form-label {
  color: var(--color-secondary);
}

.auth-form .form-control {
  background-color: var(--text-primary);
  border-color: #e0e0e0;
  color: var(--text-inverse);
}

.auth-form .form-control:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(127, 209, 199, 0.2);
}

/* ==========================================
   AUTH DIVIDER
   ========================================== */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: var(--space-8) 0;
  color: #4A6B63;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #e0e0e0;
}

.auth-divider span {
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
}

/* ==========================================
   AUTH FOOTER
   ========================================== */
.auth-footer {
  margin-top: var(--space-8);
  text-align: center;
}

.auth-footer p {
  margin: var(--space-3) 0;
  color: #4A6B63;
  font-size: var(--text-sm);
}

.auth-footer a {
  color: var(--color-primary-light);
  text-decoration: none;
  font-weight: var(--font-medium);
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ==========================================
   AUTH MODAL
   ========================================== */
.auth-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: var(--z-modal);
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
}

.auth-modal.show {
  display: flex;
}

.auth-modal-content {
  background-color: var(--surface-dark);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  width: 90%;
  max-width: 450px;
  position: relative;
  box-shadow: 0 0 20px rgba(255, 87, 34, 0.3);
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.close-modal {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  font-size: var(--text-2xl);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-base);
  background: none;
  border: none;
}

.close-modal:hover {
  color: var(--color-primary);
}

.auth-modal h2 {
  margin-bottom: var(--space-5);
  color: var(--text-primary);
  text-align: center;
  font-size: var(--text-2xl);
}

/* ==========================================
   ROLE SELECTOR
   ========================================== */
.role-selector {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
}

.role-option {
  flex: 1;
}

.role-option input[type="radio"] {
  display: none;
}

.role-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.role-option input[type="radio"]:checked + label {
  border-color: var(--color-accent);
  background: rgba(127, 209, 199, 0.05);
  box-shadow: 0 0 0 2px rgba(127, 209, 199, 0.2);
}

.role-option label i {
  font-size: var(--text-2xl);
  color: var(--color-primary-light);
}

/* ==========================================
   SOCIAL AUTH
   ========================================== */
.social-auth {
  display: flex;
  gap: var(--space-4);
}

/* ==========================================
   DROPDOWN
   ========================================== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
}

.dropdown-toggle::after {
  content: '▼';
  font-size: var(--text-xs);
  margin-left: var(--space-2);
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 160px;
  background-color: var(--surface-dark);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-2) 0;
  z-index: var(--z-dropdown);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.dropdown-menu.show {
  display: block;
  animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-menu a {
  display: block;
  padding: var(--space-2) var(--space-4);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.dropdown-menu a:hover {
  background-color: rgba(255, 87, 34, 0.1);
  color: var(--color-primary);
}

/* ==========================================
   NEWSLETTER FORM (Mini)
   ========================================== */
.newsletter-mini-form {
  width: 100%;
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.action-card-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  color: var(--text-primary);
  font-size: var(--text-xs);
  text-align: center;
}

.action-card-input:focus {
  outline: none;
  border-color: var(--color-success);
  background: rgba(0, 0, 0, 0.5);
}

.action-card-btn {
  width: 100%;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #34d399;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--font-semibold);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-card-btn:hover {
  background: rgba(52, 211, 153, 0.25);
  border-color: rgba(52, 211, 153, 0.5);
}

/* ==========================================
   DURATION INPUTS (Podcast)
   ========================================== */
.duration-inputs {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.duration-input {
  width: 70px;
  text-align: center;
}

.duration-label {
  color: var(--text-muted);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
  .auth-modal-content {
    width: 95%;
    padding: var(--space-5);
  }
  
  .form-footer {
    flex-direction: column;
    gap: var(--space-3);
    align-items: center;
  }
  
  .auth-card {
    padding: var(--space-8) var(--space-5);
  }
  
  .auth-header h1 {
    font-size: var(--text-2xl);
  }
  
  .social-auth {
    flex-direction: column;
  }
  
  .form-options {
    flex-direction: column;
    gap: var(--space-3);
    align-items: flex-start;
  }
  
  /* Ensure touch-friendly button sizes on mobile */
  .btn,
  button[type="submit"],
  .form-actions button {
    min-height: 44px; /* iOS recommended touch target */
    padding: var(--space-3) var(--space-5);
  }
  
  /* Larger form inputs on mobile for easier tapping */
  .form-control,
  .form-group input,
  .form-group select,
  .form-group textarea {
    min-height: 44px;
    font-size: 16px; /* Prevents iOS zoom on focus */
  }
}
