/* Auth Pages - Dragon's Breath Theme */

/* Dragon background on auth pages */
body.auth-body {
  background: #0a0a0a url('../assets/images/HeroImage.png?v=2') no-repeat center center;
  background-size: cover;
  background-attachment: fixed;
  position: relative;
}

/* Less vignette overlay - easier to see the dragon */
body.auth-body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, rgba(10, 10, 10, 0.75) 0%, rgba(10, 10, 10, 0.85) 50%, rgba(10, 10, 10, 0.92) 100%);
  z-index: 0;
  pointer-events: none;
}

/* Orange gradient overlay for Dragon's Breath effect */
body.auth-body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 69, 0, 0.12) 0%, rgba(220, 20, 60, 0.08) 100%);
  z-index: 0;
  pointer-events: none;
  animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* Ensure header and main are above background */
body.auth-body header,
body.auth-body main {
  position: relative;
  z-index: 1;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 2rem 4rem;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.auth-container {
  max-width: 500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
  border: 1px solid rgba(255, 69, 0, 0.15);
  border-radius: 20px;
  padding: 3rem;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 69, 0, 0.1),
    0 0 60px rgba(255, 69, 0, 0.08);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.auth-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.form-group label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
  padding: 0.875rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-orange);
  box-shadow: 
    0 0 0 3px rgba(255, 69, 0, 0.1),
    0 0 20px rgba(255, 69, 0, 0.15);
}

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

.form-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: -0.25rem;
}

.checkbox-group {
  margin-top: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 0.25rem;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-orange);
}

.checkbox-label a {
  color: var(--accent-orange);
  text-decoration: none;
  transition: color 0.3s ease;
}

.checkbox-label a:hover {
  color: var(--accent-crimson);
  text-decoration: underline;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: -0.5rem;
}

.forgot-password {
  color: var(--accent-orange);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.forgot-password:hover {
  color: var(--accent-crimson);
  text-decoration: underline;
}

.auth-submit-btn {
  padding: 1rem 2rem;
  background: var(--gradient-primary);
  color: var(--text-primary);
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(255, 69, 0, 0.3);
  position: relative;
  overflow: hidden;
  margin-top: 0.5rem;
}

.auth-submit-btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: translateX(-100%) translateY(-100%) rotate(45deg);
  transition: transform 0.6s ease;
}

.auth-submit-btn:hover::before {
  transform: translateX(100%) translateY(100%) rotate(45deg);
}

.auth-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255, 69, 0, 0.4);
  background: var(--gradient-secondary);
}

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

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-loader {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.auth-alternate {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.auth-alternate a {
  color: var(--accent-orange);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.auth-alternate a:hover {
  color: var(--accent-crimson);
  text-decoration: underline;
}

.error-message,
.success-message {
  padding: 1rem 1.25rem;
  border-radius: 10px;
  margin-top: 1.5rem;
  font-size: 0.95rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.error-message {
  background: linear-gradient(135deg, rgba(220, 20, 60, 0.15), rgba(139, 0, 0, 0.15));
  border: 1px solid rgba(220, 20, 60, 0.3);
  color: #ff6b6b;
}

.success-message {
  background: linear-gradient(135deg, rgba(255, 69, 0, 0.15), rgba(220, 20, 60, 0.15));
  border: 1px solid rgba(255, 69, 0, 0.3);
  color: #ffa07a;
}



/* Responsive Design */
@media (max-width: 768px) {
  .auth-page {
    padding: 80px 1rem 2rem;
  }

  .auth-card {
    padding: 2rem 1.5rem;
  }

  .auth-header h1 {
    font-size: 1.75rem;
  }

  .auth-container {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 1.5rem 1rem;
  }

  .auth-header h1 {
    font-size: 1.5rem;
  }

  .form-group input {
    padding: 0.75rem 1rem;
  }

  .auth-submit-btn {
    padding: 0.875rem 1.5rem;
  }
}

/* Account Management Page */
.account-content {
  width: 100%;
}

.account-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(255, 69, 0, 0.05);
  border: 1px solid rgba(255, 69, 0, 0.1);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.account-section:hover {
  background: rgba(255, 69, 0, 0.08);
  border-color: rgba(255, 69, 0, 0.2);
}

.account-section h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 69, 0, 0.1);
}

.account-section p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0.5rem 0;
  line-height: 1.6;
}

.account-section strong {
  color: var(--text-primary);
  font-weight: 600;
}

.account-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.account-actions .auth-btn {
  flex: 1;
}

@media (max-width: 480px) {
  .account-section {
    padding: 1rem;
  }

  .account-section h3 {
    font-size: 1rem;
  }

  .account-section p {
    font-size: 0.9rem;
  }

  .account-actions {
    flex-direction: column;
  }

  .account-actions .auth-btn {
    width: 100%;
  }
}

/* ============================================
   STEP 1.5: CSS FOR DYNAMIC STATES
   Enhanced dropdown, avatar, and auth UI
   ============================================ */

/* Avatar Circle - Base Style */
.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF4500 0%, #FF8C00 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(255, 69, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Avatar Button */
.avatar-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
  z-index: 10;
  border-radius: 50%;
  line-height: 1;
}

.avatar-btn:hover {
  transform: scale(1.05);
}

.avatar-btn:hover .avatar-circle {
  box-shadow: 0 4px 16px rgba(255, 69, 0, 0.5);
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.2);
}

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

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

/* Profile Dropdown Menu */
.profile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  min-width: 280px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1001;
  backdrop-filter: blur(10px);
}

.profile-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Dropdown Header */
.dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(255, 69, 0, 0.05);
  border-radius: 11px 11px 0 0;
}

.dropdown-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF4500 0%, #FF8C00 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(255, 69, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.dropdown-user-info {
  flex: 1;
  min-width: 0;
}

.dropdown-email {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

/* Dropdown Divider */
.dropdown-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  margin: 0.5rem 0;
}

/* Dropdown Menu Items */
.dropdown-menu {
  padding: 0.5rem 0.5rem;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: inherit;
  text-align: left;
  position: relative;
}

.dropdown-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-orange);
  border-radius: 3px;
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.2s ease;
}

.dropdown-item:hover {
  background: rgba(255, 69, 0, 0.1);
  color: var(--text-primary);
  transform: translateX(4px);
}

.dropdown-item:hover::before {
  transform: scaleY(1);
}

.dropdown-item:active {
  background: rgba(255, 69, 0, 0.15);
  transform: translateX(2px);
}

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

.dropdown-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.dropdown-item:hover .dropdown-icon {
  transform: scale(1.1);
}

.dropdown-item.logout-item {
  color: #ff6b6b;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 0.25rem;
  padding-top: 0.75rem;
}

.dropdown-item.logout-item:hover {
  background: rgba(255, 107, 107, 0.1);
  color: #ff8787;
}

/* Logout Button Loading State */
.dropdown-item.logout-item:disabled {
  opacity: 0.7;
  color: #ffb3b3;
}

.dropdown-item.logout-item:disabled .dropdown-icon {
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* Auth Section Container */
.auth-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInAuth 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transition: all 0.3s ease;
}

@keyframes slideInAuth {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade out animation for state transitions */
.auth-section.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* User Profile Container */
.user-profile {
  position: relative;
  display: flex;
  align-items: center;
}

/* ============================================
   Mobile Responsive Styles for Dropdown
   ============================================ */

@media (max-width: 768px) {
  .profile-dropdown {
    min-width: 260px;
    right: -10px;
    max-width: calc(100vw - 20px);
  }

  .dropdown-header {
    padding: 0.875rem;
  }

  .dropdown-avatar {
    width: 38px;
    height: 38px;
    font-size: 0.95rem;
  }

  .dropdown-email {
    font-size: 0.8rem;
  }

  .dropdown-menu {
    padding: 0.4rem 0.4rem;
  }

  .dropdown-item {
    padding: 0.65rem 0.9rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {
  /* Adjust dropdown position on smaller screens */
  .profile-dropdown {
    min-width: 250px;
    right: -5px;
    
    /* Ensure it doesn't overflow on small screens */
    position: fixed;
    top: auto;
    right: auto;
    left: 50%;
    transform: translateX(-50%) translateY(-10px) scale(0.95);
    bottom: auto;
    margin-top: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .profile-dropdown.show {
    transform: translateX(-50%) translateY(0) scale(1);
  }

  /* Prevent overflow on very small screens */
  @media (max-width: 500px) {
    .profile-dropdown {
      min-width: calc(100vw - 20px);
      max-width: 280px;
    }
  }
}

@media (max-width: 480px) {
  .avatar-circle {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
  }

  .profile-dropdown {
    min-width: calc(100vw - 30px);
    max-width: 300px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px) scale(0.95);
  }

  .profile-dropdown.show {
    transform: translateX(-50%) translateY(0) scale(1);
  }

  .dropdown-header {
    padding: 0.75rem;
  }

  .dropdown-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .dropdown-email {
    font-size: 0.75rem;
  }

  .dropdown-menu {
    padding: 0.35rem 0.35rem;
  }

  .dropdown-item {
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
  }

  .avatar-btn:hover {
    transform: scale(1.03);
  }

  .avatar-btn:hover .avatar-circle {
    transform: scale(1.05);
  }

  .avatar-btn:active {
    transform: scale(0.97);
  }

  .avatar-btn:active .avatar-circle {
    transform: scale(0.97);
  }
}

@media (max-width: 360px) {
  .avatar-circle {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  .profile-dropdown {
    min-width: calc(100vw - 20px);
    max-width: 280px;
  }

  .dropdown-item {
    padding: 0.55rem 0.7rem;
    font-size: 0.75rem;
  }

  .dropdown-icon {
    font-size: 0.9rem;
  }
}

/* ============================================
   Touch Device Specific Styles
   ============================================ */

@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices, use active instead */
  .avatar-btn:hover {
    transform: none;
  }

  .avatar-btn:hover .avatar-circle {
    box-shadow: 0 2px 8px rgba(255, 69, 0, 0.3);
    transform: none;
    border-color: rgba(255, 255, 255, 0.1);
  }

  .dropdown-item:hover {
    background: rgba(255, 69, 0, 0.08);
    color: var(--text-secondary);
    transform: none;
  }

  .dropdown-item:hover::before {
    transform: scaleY(0);
  }

  .dropdown-item:active {
    background: rgba(255, 69, 0, 0.15);
    transform: none;
  }

  .dropdown-item:active::before {
    transform: scaleY(1);
  }

  .dropdown-item:active .dropdown-icon {
    transform: scale(1);
  }
}

/* ============================================
   Keyboard Navigation Styles
   ============================================ */

.avatar-btn:focus-visible {
  outline: 2px solid rgba(255, 69, 0, 0.6);
  outline-offset: 2px;
}

.dropdown-item:focus-visible {
  background: rgba(255, 69, 0, 0.12);
  outline: 1px solid rgba(255, 69, 0, 0.4);
  outline-offset: -2px;
}

/* ============================================
   Dark Mode Support (if needed in future)
   ============================================ */

@media (prefers-color-scheme: dark) {
  .profile-dropdown {
    background: #0f0f0f;
    border-color: rgba(255, 255, 255, 0.08);
  }

  .dropdown-header {
    background: rgba(255, 69, 0, 0.04);
  }

  .dropdown-item:hover {
    background: rgba(255, 69, 0, 0.08);
  }
}

/* ============================================
   High Contrast Mode Support
   ============================================ */

@media (prefers-contrast: more) {
  .avatar-circle {
    border-color: rgba(255, 255, 255, 0.3);
  }

  .profile-dropdown {
    border-color: rgba(255, 255, 255, 0.2);
  }

  .dropdown-divider {
    background: rgba(255, 255, 255, 0.2);
  }

  .dropdown-item {
    border-radius: 6px;
  }

  .dropdown-item:focus-visible {
    outline-width: 2px;
  }
}

/* ============================================
   Reduced Motion Support
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .avatar-circle,
  .avatar-btn,
  .profile-dropdown,
  .dropdown-item,
  .dropdown-avatar,
  .dropdown-email {
    transition: none !important;
    animation: none !important;
  }

  .avatar-btn:hover .avatar-circle {
    transform: none;
  }

  .dropdown-item:hover {
    transform: none;
  }

  .profile-dropdown.show {
    transform: translateY(0) scale(1);
  }

  @media (max-width: 600px) {
    .profile-dropdown.show {
      transform: translateX(-50%) translateY(0) scale(1);
    }
  }
}