/* Import unified modal system */
@import url('modal.css');

/**
 * PMERIT Components CSS
 * Version: 3.4 - Unified Modal System
 * Last Updated: November 27, 2025
 * 
 * FIXES:
 * - Control buttons now horizontal (VH Mode + Read About on same line)
 * - Removed redundant "Connected to Educational Services" text
 * - Polished ChatGPT-style input with smooth interactions
 * - Added animated typing indicator for AI responses
 */

/* ========================================
   CHATGPT-STYLE INPUT BAR (MOBILE & DESKTOP)
   Enhanced with Phase 8.4 - Thumb-reach & Safe-area
   ======================================== */

/* === MOBILE INPUT CONTAINER === */
.chat-input-container {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  
  /* Phase 8.4 - iOS Safe Area Support */
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + var(--safe-area-bottom));
  
  /* Prevent viewport resize thrash */
  min-height: calc(56px + var(--safe-area-bottom));
  
  z-index: var(--z-sticky);
}

/* === MOBILE INPUT WRAPPER === */
.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  
  background: var(--bg-card);
  border: none;
  border-radius: 24px;
  
  /* Phase 8.4 - Increased height for thumb-reach */
  min-height: 56px;
  padding: 8px 12px;
  
  transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
  
  /* Subtle shadow instead of border */
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.08);
}

.chat-input-wrapper:focus-within {
  /* ✅ Subtle blue glow on focus */
  box-shadow: 
    0 0 0 1px rgba(42, 91, 140, 0.3),
    0 0 0 4px rgba(42, 91, 140, 0.08),
    0 4px 8px rgba(0, 0, 0, 0.1);
  
  /* Subtle lift */
  transform: translateY(-1px);
}

/* === ADD BUTTON (Plus Icon) - Phase 8.4 Enhanced === */
.input-add-btn {
  width: 44px;  /* Phase 8.4 - Min touch target */
  height: 44px;
  min-width: 44px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: transparent;
  border: none;
  border-radius: 50%;
  
  font-size: 18px;
  color: var(--text-secondary);
  
  cursor: pointer;
  transition: all 0.2s ease;
  
  /* Touch target feedback */
  -webkit-tap-highlight-color: rgba(42, 91, 140, 0.1);
}

.input-add-btn:hover {
  background: var(--bg-secondary);
  color: var(--primary);
  transform: rotate(90deg) scale(1.1);
}

.input-add-btn:active {
  transform: rotate(90deg) scale(0.95);
}

/* === TEXT INPUT - Phase 8.4 Enhanced === */
.chat-input {
  flex: 1;
  
  background: transparent;
  border: none;
  outline: none;
  
  font-family: var(--font-body);
  font-size: 16px;  /* Prevents iOS zoom */
  line-height: 1.5;
  color: var(--text-primary);
  
  padding: 8px 0;
  
  resize: none;
  min-height: 24px;
  max-height: 120px; /* Phase 8.4 - Max 3 lines before scroll */
  
  /* Remove iOS default styling */
  -webkit-appearance: none;
  appearance: none;
  
  /* Smooth multiline expansion */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

/* Ensure 16px on mobile to prevent iOS zoom */
@media (max-width: 767px) {
  .chat-input {
    font-size: 16px !important;
  }
}

/* === INPUT ACTIONS (Voice & Send) === */
.input-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* === VOICE BUTTON (Microphone) - Phase 8.4 Enhanced === */
.input-voice-btn {
  width: 44px;  /* Phase 8.4 - Min touch target */
  height: 44px;
  min-width: 44px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: transparent;
  border: none;
  border-radius: 50%;
  
  font-size: 18px;
  color: var(--text-secondary);
  
  cursor: pointer;
  transition: all 0.2s ease;
  
  /* Touch target feedback */
  -webkit-tap-highlight-color: rgba(42, 91, 140, 0.1);
}

.input-voice-btn:hover {
  background: var(--bg-secondary);
  color: var(--primary);
  transform: scale(1.1);
}

.input-voice-btn:active {
  transform: scale(0.95);
}

/* Pulse animation when recording */
.input-voice-btn.recording {
  color: var(--error);
  animation: pulse 1.5s ease-in-out infinite;
  background: rgba(220, 53, 69, 0.1);
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* === SEND BUTTON (Arrow Up) - Phase 8.4 Enhanced === */
.send-btn {
  width: 44px;  /* Phase 8.4 - Min touch target */
  height: 44px;
  min-width: 44px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: var(--primary);
  border: none;
  border-radius: 50%;
  
  color: white;
  font-size: 18px;
  
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
  
  /* Nice shadow */
  box-shadow: 0 2px 6px rgba(42, 91, 140, 0.25);
  
  /* Touch target feedback */
  -webkit-tap-highlight-color: rgba(42, 91, 140, 0.2);
}

.send-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(42, 91, 140, 0.35);
}

.send-btn:active {
  transform: scale(0.95);
}

/* Disabled state */
.send-btn:disabled {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  cursor: not-allowed;
  box-shadow: none;
}

.send-btn:disabled:hover {
  transform: none;
}

/* === CHARACTER COUNTER === */
.char-counter,
.desktop-char-counter {
  position: absolute;
  bottom: 4px;
  right: 48px;
  
  font-size: 11px;
  color: var(--text-tertiary);
  
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.chat-input-wrapper:focus-within .char-counter,
.desktop-input-wrapper:focus-within .desktop-char-counter {
  opacity: 1;
  visibility: visible;
}

.char-counter.hidden,
.desktop-char-counter.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
}

.char-counter.warning,
.desktop-char-counter.warning {
  color: var(--warning);
}

.char-counter.error,
.desktop-char-counter.error {
  color: var(--error);
}

/* ========================================
   DESKTOP INPUT BAR (CENTER PANEL)
   ======================================== */

.desktop-chat-input-area {
  position: sticky;
  bottom: 0;
  
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  
  padding: 16px;
  
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* === DESKTOP INPUT WRAPPER === */
.desktop-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  
  background: var(--bg-card);
  border: none; /* ✅ REMOVED hard border */
  border-radius: 26px;
  
  padding: 10px 14px;
  
  transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
  
  /* ✅ Subtle shadow instead of border */
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.08);
  
  position: relative;
}

.desktop-input-wrapper:focus-within {
  /* ✅ Subtle blue glow on focus */
  box-shadow: 
    0 0 0 1px rgba(42, 91, 140, 0.3),
    0 0 0 4px rgba(42, 91, 140, 0.08),
    0 4px 8px rgba(0, 0, 0, 0.1);
  
  transform: translateY(-1px);
}

/* === DESKTOP ADD BUTTON === */
.desktop-add-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: transparent;
  border: none;
  border-radius: 50%;
  
  font-size: 20px;
  color: var(--text-secondary);
  
  cursor: pointer;
  transition: all 0.2s ease;
}

.desktop-add-btn:hover {
  background: var(--bg-secondary);
  color: var(--primary);
  transform: rotate(90deg) scale(1.1);
}

/* === DESKTOP TEXT INPUT === */
.desktop-chat-input {
  flex: 1;
  
  background: transparent;
  border: none;
  outline: none;
  
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  
  padding: 6px 0;
  
  resize: none;
  min-height: 24px;
  max-height: 140px;
}

.desktop-chat-input::placeholder {
  color: var(--text-tertiary);
}

/* === DESKTOP INPUT ACTIONS === */
.desktop-input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === DESKTOP ATTACH BUTTON === */
.desktop-attach-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: transparent;
  border: none;
  border-radius: 50%;
  
  font-size: 18px;
  color: var(--text-secondary);
  
  cursor: pointer;
  transition: all 0.2s ease;
}

.desktop-attach-btn:hover {
  background: var(--bg-secondary);
  color: var(--primary);
  transform: scale(1.1) rotate(15deg);
}

/* === DESKTOP VOICE BUTTON === */
.desktop-voice-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: transparent;
  border: none;
  border-radius: 50%;
  
  font-size: 18px;
  color: var(--text-secondary);
  
  cursor: pointer;
  transition: all 0.2s ease;
}

.desktop-voice-btn:hover {
  background: var(--bg-secondary);
  color: var(--primary);
  transform: scale(1.1);
}

/* === DESKTOP SEND BUTTON === */
.desktop-send-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: var(--primary);
  border: none;
  border-radius: 50%;
  
  color: white;
  font-size: 18px;
  
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
  
  box-shadow: 0 2px 6px rgba(42, 91, 140, 0.25);
}

.desktop-send-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(42, 91, 140, 0.35);
}

.desktop-send-btn:active {
  transform: scale(0.95);
}

.desktop-send-btn:disabled {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  cursor: not-allowed;
  box-shadow: none;
}

/* ==========================================
   ✅ FIX #1: DESKTOP CONTROL BUTTONS HORIZONTAL
   VH Mode and Read About on the same line
   ========================================== */

.desktop-input-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* Align to left */
  gap: 8px; /* Space between buttons */
  padding: 0 4px;
}

/* === CONTROL BUTTONS === */
.control-btn {
  padding: 6px 14px;
  
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  
  cursor: pointer;
  transition: all 0.2s ease;
  
  display: flex;
  align-items: center;
  gap: 6px;
  
  white-space: nowrap; /* Prevent text wrapping */
}

.control-btn:hover {
  border-color: var(--primary);
  background: var(--bg-secondary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.control-btn:active {
  transform: translateY(0);
}

.control-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.control-btn i {
  font-size: 12px;
}

/* ==========================================
   ✅ FIX #2: HIDE REDUNDANT STATUS INDICATOR
   "Connected to Educational Services" already in footer
   ========================================== */

.status-indicator {
  display: none !important; /* Hide redundant status */
}

/* If you want to keep it but make it less prominent, use this instead:
.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  
  font-size: 11px;
  color: var(--text-tertiary);
  opacity: 0.6;
  
  margin-left: auto;
}
*/

.status-dot {
  width: 8px;
  height: 8px;
  
  background: var(--success);
  border-radius: 50%;
  
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ==========================================
   ✅ NEW: TYPING INDICATOR FOR AI RESPONSES
   Shows animated dots while AI is generating response
   ========================================== */

.typing-indicator {
  opacity: 0.85;
  animation: typing-fade-in 0.3s ease-out;
}

@keyframes typing-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 0.85;
    transform: translateY(0);
  }
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

.typing-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.4;
  animation: typing-blink 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(1) {
  animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-blink {
  0%, 60%, 100% {
    opacity: 0.25;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* Dark mode adjustments for typing indicator */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .typing-dots span {
    opacity: 0.5;
  }
  
  :root:not([data-theme="light"]) .typing-dots span {
    animation: typing-blink-dark 1.4s ease-in-out infinite;
  }
  
  @keyframes typing-blink-dark {
    0%, 60%, 100% {
      opacity: 0.3;
      transform: scale(0.8);
    }
    30% {
      opacity: 0.9;
      transform: scale(1.1);
    }
  }
}

/* ========================================
   MOBILE-SPECIFIC INPUT ADJUSTMENTS
   ======================================== */

@media (max-width: 1023px) {
  /* Ensure input doesn't zoom on iOS */
  .chat-input,
  .desktop-chat-input {
    font-size: 16px !important;
  }
  
  /* Larger touch targets on mobile */
  .input-add-btn,
  .input-voice-btn,
  .send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }
  
  /* More padding on mobile */
  .chat-input-wrapper {
    padding: 10px 14px;
  }
  
  /* Hide desktop controls on mobile */
  .desktop-input-controls {
    display: none !important;
  }
  
  /* Smaller typing dots on mobile */
  .typing-dots span {
    width: 5px;
    height: 5px;
  }
}

/* ========================================
   ACCESSIBILITY ENHANCEMENTS
   ======================================== */

/* Focus states for keyboard navigation */
.input-add-btn:focus-visible,
.input-voice-btn:focus-visible,
.send-btn:focus-visible,
.desktop-add-btn:focus-visible,
.desktop-attach-btn:focus-visible,
.desktop-voice-btn:focus-visible,
.desktop-send-btn:focus-visible,
.control-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  /* Keep typing indicator visible but static */
  .typing-dots span {
    animation: none !important;
    opacity: 0.6 !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .chat-input-wrapper,
  .desktop-input-wrapper {
    border-width: 2px;
  }
  
  .send-btn,
  .desktop-send-btn {
    border: 2px solid white;
  }
  
  .control-btn {
    border-width: 2px;
  }
  
  .typing-dots span {
    background: var(--text-primary);
    opacity: 1 !important;
  }
}

/* ========================================
   DARK MODE SUPPORT (IF ENABLED)
   ======================================== */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Adjust shadows for dark mode */
    .chat-input-wrapper,
    .desktop-input-wrapper {
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    
    .chat-input-wrapper:focus-within,
    .desktop-input-wrapper:focus-within {
      box-shadow: 
        0 0 0 3px rgba(74, 164, 185, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.4);
    }
    
    .send-btn,
    .desktop-send-btn {
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    }
  }
}

/* ========================================
   ENHANCEMENT NOTES
   ======================================== */

/**
 * v3.3 UPDATES:
 * 
 * ✅ NEW: Animated typing indicator
 *    - Three bouncing dots
 *    - Smooth fade-in animation
 *    - Respects reduced motion preferences
 *    - Dark mode compatible
 *    - Scales appropriately on mobile
 * 
 * v3.2 FIXES:
 * 
 * ✅ FIX #1: Control buttons now horizontal
 *    - VH Mode and Read About on same line
 *    - Better spacing (8px gap)
 *    - Aligned to left side
 * 
 * ✅ FIX #2: Removed redundant status
 *    - "Connected to Educational Services" hidden
 *    - Already present in footer
 *    - Reduces visual clutter
 * 
 * IMPROVEMENTS OVER CHATGPT:
 * 
 * ✅ Smoother hover transitions (cubic-bezier easing)
 * ✅ Better focus states (rings + lift effect)
 * ✅ Icon rotation on hover (add button spins)
 * ✅ Pulse animation for recording state
 * ✅ Character counter that appears on focus
 * ✅ iOS-specific fixes (no zoom, proper font size)
 * ✅ Reduced motion support for accessibility
 * ✅ High contrast mode support
 * ✅ Better shadows (layered for depth)
 * ✅ Micro-interactions (scale, rotate, lift)
 * ✅ Control buttons with active states
 * ✅ Animated typing indicator
 * 
 * POLISH DETAILS:
 * - Buttons scale on hover/press
 * - Send button disabled until text entered
 * - Voice button pulses when recording
 * - Add button rotates 90° on hover
 * - Input lifts slightly when focused
 * - Character counter fades in on focus
 * - Smooth transitions for all states
 * - Perfect spacing and alignment
 * - Control buttons horizontal (not stacked)
 * - Typing dots bounce while AI thinks
 */

/* ========================================
   AUTH MODAL COMPONENT
   Version: 1.0 - Phase 3.1
   ======================================== */

/* Modal Overlay */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  
  display: none;
  align-items: center;
  justify-content: center;
  
  opacity: 0;
  transition: opacity 0.3s ease;
}

.auth-modal.active {
  display: flex;
  opacity: 1;
}

/* Backdrop */
.auth-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay, rgba(0, 0, 0, 0.6));
  backdrop-filter: blur(4px);
  
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  
  overflow-y: auto;
}

/* Modal Content */
.auth-modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card, #ffffff);
  border-radius: var(--border-radius-lg, 12px);
  box-shadow: var(--shadow-xl, 0 20px 40px rgba(0, 0, 0, 0.15));
  
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Close Button */
.auth-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: transparent;
  border: none;
  border-radius: 50%;
  
  color: var(--text-secondary, #6C757D);
  font-size: 1.25rem;
  cursor: pointer;
  
  transition: all 0.2s ease;
  z-index: 10;
}

.auth-modal-close:hover {
  background: var(--bg-secondary, #F8F9FA);
  color: var(--text-primary, #2C2C2C);
  transform: rotate(90deg);
}

.auth-modal-close:focus {
  outline: 2px solid var(--interactive-primary, #2A5B8C);
  outline-offset: 2px;
}

/* Modal Header with Tabs */
.auth-modal-header {
  padding: 2rem 2rem 0;
  border-bottom: 1px solid var(--border-color, #E9ECEF);
}

.auth-modal-tabs {
  display: flex;
  gap: 0;
  margin-bottom: -1px;
}

.auth-modal-tab {
  flex: 1;
  padding: 0.875rem 1rem;
  
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  
  font-family: var(--font-primary, 'Montserrat', sans-serif);
  font-size: 1rem;
  font-weight: var(--weight-semibold, 600);
  color: var(--text-secondary, #6C757D);
  
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-modal-tab:hover {
  color: var(--interactive-primary, #2A5B8C);
  background: var(--bg-secondary, #F8F9FA);
}

.auth-modal-tab.active {
  color: var(--interactive-primary, #2A5B8C);
  border-bottom-color: var(--interactive-primary, #2A5B8C);
}

.auth-modal-tab:focus {
  outline: 2px solid var(--interactive-primary, #2A5B8C);
  outline-offset: -2px;
}

/* Modal Body */
.auth-modal-body {
  padding: 2rem;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

/* Tab Panels */
.auth-modal-panel {
  display: none;
}

.auth-modal-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal Title */
.auth-modal-title {
  margin: 0 0 0.5rem 0;
  font-family: var(--font-primary, 'Montserrat', sans-serif);
  font-size: 1.75rem;
  font-weight: var(--weight-bold, 700);
  color: var(--text-primary, #2C2C2C);
}

.auth-modal-subtitle {
  margin: 0 0 1.5rem 0;
  font-size: 0.95rem;
  color: var(--text-secondary, #6C757D);
}

/* Messages (Error/Success) */
.auth-modal-message {
  display: none;
  padding: 0.875rem 1rem;
  margin-bottom: 1.5rem;
  border-radius: var(--border-radius-md, 8px);
  font-size: 0.9rem;
  font-weight: var(--weight-medium, 500);
}

.auth-modal-message.error {
  background: #fee;
  border: 1px solid #fcc;
  color: #c00;
}

.auth-modal-message.success {
  background: #efe;
  border: 1px solid #cfc;
  color: #060;
}

/* Form Styles */
.auth-modal-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: var(--weight-medium, 500);
  color: var(--text-primary, #2C2C2C);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
  width: 100%;
  padding: 0.75rem 1rem;
  
  font-family: var(--font-secondary, 'Inter', sans-serif);
  font-size: 1rem;
  color: var(--text-primary, #2C2C2C);
  
  background: var(--bg-secondary, #F8F9FA);
  border: 1px solid var(--border-color, #E9ECEF);
  border-radius: var(--border-radius-md, 8px);
  
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: var(--interactive-primary, #2A5B8C);
  background: var(--bg-card, #ffffff);
  box-shadow: 0 0 0 3px rgba(42, 91, 140, 0.1);
}

.form-group input.error {
  border-color: var(--color-error, #DC3545);
}

.form-group input.error:focus {
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Password Wrapper */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-toggle {
  position: absolute;
  right: 0.75rem;
  
  background: transparent;
  border: none;
  color: var(--text-secondary, #6C757D);
  cursor: pointer;
  padding: 0.5rem;
  
  transition: color 0.2s ease;
}

.password-toggle:hover {
  color: var(--interactive-primary, #2A5B8C);
}

.password-toggle:focus {
  outline: 2px solid var(--interactive-primary, #2A5B8C);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Form Hint */
.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted, #8E9499);
  margin-top: -0.25rem;
}

/* Form Group Inline (for "Forgot password?" link) */
.form-group-inline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: -0.5rem;
}

/* Buttons */
.auth-modal-button {
  width: 100%;
  padding: 0.875rem 1.5rem;
  
  font-family: var(--font-primary, 'Montserrat', sans-serif);
  font-size: 1rem;
  font-weight: var(--weight-semibold, 600);
  
  border: none;
  border-radius: var(--border-radius-md, 8px);
  
  cursor: pointer;
  transition: all 0.2s ease;
  
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-modal-button.primary {
  background: var(--interactive-primary, #2A5B8C);
  color: var(--text-inverse, #ffffff);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
}

.auth-modal-button.primary:hover:not(:disabled) {
  background: var(--interactive-primary-hover, #1f4567);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
}

.auth-modal-button.primary:active:not(:disabled) {
  transform: translateY(0);
}

.auth-modal-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-modal-button:focus {
  outline: 2px solid var(--interactive-primary, #2A5B8C);
  outline-offset: 2px;
}

/* Links */
.auth-modal-link {
  background: none;
  border: none;
  padding: 0;
  
  color: var(--interactive-primary, #2A5B8C);
  font-weight: var(--weight-medium, 500);
  text-decoration: none;
  cursor: pointer;
  
  transition: color 0.2s ease;
}

.auth-modal-link:hover {
  color: var(--interactive-primary-hover, #1f4567);
  text-decoration: underline;
}

.auth-modal-link:focus {
  outline: 2px solid var(--interactive-primary, #2A5B8C);
  outline-offset: 2px;
  border-radius: 2px;
}

.auth-modal-link-small {
  font-size: 0.85rem;
  color: var(--interactive-primary, #2A5B8C);
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-modal-link-small:hover {
  color: var(--interactive-primary-hover, #1f4567);
  text-decoration: underline;
}

/* Footer Text */
.auth-modal-footer-text {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary, #6C757D);
}

/* Cookie Warning */
.auth-modal-warning {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  
  margin-top: 1rem;
  padding: 0.875rem 1rem;
  
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: var(--border-radius-md, 8px);
  
  font-size: 0.9rem;
  color: #856404;
}

.auth-modal-warning.hidden {
  display: none;
}

.auth-modal-warning i {
  font-size: 1.25rem;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
  .auth-modal-content {
    max-width: 100%;
    margin: 0;
    border-radius: var(--border-radius-lg, 12px) var(--border-radius-lg, 12px) 0 0;
  }
  
  .auth-modal-header,
  .auth-modal-body {
    padding: 1.5rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .auth-modal-title {
    font-size: 1.5rem;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .auth-modal,
  .auth-modal-content,
  .auth-modal-panel,
  .auth-modal-button,
  .auth-modal-tab,
  .auth-modal-close {
    animation: none;
    transition: none;
  }
}

/* ========================================
   SUPPORT BUTTONS - ACTIVE STATE
   Phase 3 - Priority 2
   ======================================== */

/* Active state for support buttons */
.support-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(42, 91, 140, 0.3);
}

.support-btn.active i {
  color: white;
}

/* Active state hover (different from regular hover) */
.support-btn.active:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
  box-shadow: 0 4px 12px rgba(42, 91, 140, 0.4);
}

/* Dark mode adjustments */
[data-theme="dark"] .support-btn.active {
  background: #2A5B8C;
  border-color: #2A5B8C;
}

[data-theme="dark"] .support-btn.active:hover {
  background: #1f4567;
  border-color: #1f4567;
}

/* Loading state for support buttons */
.support-btn.loading {
  position: relative;
  pointer-events: none;
}

.support-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  margin-left: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========================================
   STANDARDIZED BUTTON SYSTEM
   ========================================

   Hierarchy:
   - .btn           → Base button styles
   - .btn-primary   → Main CTA (solid primary color)
   - .btn-secondary → Secondary action (outline)
   - .btn-tertiary  → Minimal/text-like
   - .btn-danger    → Destructive actions
   - .btn-ghost     → Transparent background

   Sizes:
   - .btn-sm        → Small (32px height)
   - Default        → Medium (44px height)
   - .btn-lg        → Large (52px height)

   Modifiers:
   - .btn-full      → Full width
   - .btn-icon      → Icon-only (square)

   Usage:
   <button class="btn btn-primary">Primary Action</button>
   <button class="btn btn-secondary btn-sm">Small Secondary</button>
   <a href="#" class="btn btn-tertiary btn-full">Full Width Link</a>
   ======================================== */

/* Base Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  /* Size - Default (Medium) */
  min-height: 44px;
  padding: 10px 20px;

  /* Typography */
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;

  /* Shape */
  border-radius: 8px;
  border: 1px solid transparent;

  /* Behavior */
  cursor: pointer;
  transition: all 0.2s ease;

  /* Reset defaults */
  background: none;
  -webkit-appearance: none;
  appearance: none;
}

.btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button - Main CTA */
.btn-primary,
.btn.primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover,
.btn.primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary:active,
.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Secondary Button - Outline Style */
.btn-secondary,
.btn.secondary {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover,
.btn.secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--primary);
  color: var(--primary);
}

/* Tertiary Button - Minimal/Text Style */
.btn-tertiary,
.btn.tertiary {
  background-color: transparent;
  border-color: transparent;
  color: var(--primary);
  padding: 10px 12px;
}

.btn-tertiary:hover,
.btn.tertiary:hover {
  background-color: var(--bg-secondary);
  text-decoration: underline;
}

/* Ghost Button - Transparent */
.btn-ghost,
.btn.ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover,
.btn.ghost:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* Danger Button - Destructive Actions */
.btn-danger,
.btn.danger {
  background-color: var(--danger, #DC3545);
  border-color: var(--danger, #DC3545);
  color: #FFFFFF;
}

.btn-danger:hover,
.btn.danger:hover {
  background-color: #c82333;
  border-color: #c82333;
}

/* Outline Variant */
.btn-outline {
  background-color: transparent;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary);
  color: #FFFFFF;
}

/* ========== BUTTON SIZES ========== */

/* Small Button */
.btn-sm,
.btn.btn-sm {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

/* Large Button */
.btn-lg,
.btn.btn-lg {
  min-height: 52px;
  padding: 14px 28px;
  font-size: 16px;
  border-radius: 10px;
}

/* ========== BUTTON MODIFIERS ========== */

/* Full Width */
.btn-full,
.btn.btn-full,
.btn-block {
  width: 100%;
}

/* Icon Only Button */
.btn-icon,
.btn.btn-icon {
  padding: 10px;
  min-width: 44px;
  width: 44px;
}

.btn-icon.btn-sm {
  padding: 6px;
  min-width: 32px;
  width: 32px;
}

.btn-icon.btn-lg {
  padding: 14px;
  min-width: 52px;
  width: 52px;
}

/* Button with Icon + Text */
.btn i,
.btn .icon,
.btn svg {
  font-size: 1em;
  flex-shrink: 0;
}

/* ========== BUTTON GROUP ========== */

.btn-group {
  display: inline-flex;
  gap: 8px;
}

.btn-group.vertical {
  flex-direction: column;
}

/* ========== DARK THEME ADJUSTMENTS ========== */

[data-theme="dark"] .btn-secondary {
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .btn-secondary:hover {
  background-color: var(--bg-elevated);
  border-color: var(--primary);
}

[data-theme="dark"] .btn-ghost:hover {
  background-color: var(--bg-elevated);
}

[data-theme="dark"] .btn-tertiary:hover {
  background-color: var(--bg-elevated);
}

