/* =========================================================
   ULTRA-MODERN AUTH MODAL — PREMIUM APPLE-STYLE AESTHETIC
   ========================================================= */

/* Design System Variables */
:root {
  --safe-pad: 20px;
  --card-max-w: 420px;
  --card-padding: 40px;
  
  /* Premium Color Palette */
  --primary-black: #000000;
  --primary-white: #ffffff;
  --glass-white: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-tertiary: rgba(255, 255, 255, 0.5);
  
  /* Premium Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.22);
  --shadow-xl: 0 40px 80px rgba(0, 0, 0, 0.25);
  
  /* Animation Curves */
  --ease-premium: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ---------------- Premium Overlay ---------------- */
.auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.40);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: var(--safe-pad);
  animation: overlayFadeIn 0.6s var(--ease-premium);
}

@keyframes overlayFadeIn {
  from { 
    opacity: 0; 
    backdrop-filter: blur(0px);
  }
  to { 
    opacity: 1; 
    backdrop-filter: saturate(180%) blur(20px);
  }
}

/* ---------------- Premium Card ---------------- */
.auth-modal-content {
  background: rgba(18, 18, 18, 0.95);
  -webkit-backdrop-filter: saturate(180%) blur(40px);
  backdrop-filter: saturate(180%) blur(40px);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  box-shadow: 
    var(--shadow-xl),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
  width: min(90vw, var(--card-max-w));
  max-height: calc(100dvh - (var(--safe-pad) * 2));
  display: grid;
  grid-template-rows: auto 1fr;
  
  /* Start visible by default - animation class will handle entrance */
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Animation class - applied on open, removed on close */
.auth-modal-content.animate-in {
  animation: cardEntrance 0.8s var(--ease-premium) forwards;
  opacity: 0;
  transform: scale(0.94) translateY(20px);
}

@keyframes cardEntrance {
  0% {
    opacity: 0;
    transform: scale(0.94) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Premium gradient accent line */
.auth-modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  opacity: 0.8;
}

/* ---------------- Minimal Close Button ---------------- */
.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s var(--ease-premium);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-close i { 
  font-size: 14px; 
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.auth-close:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.auth-close:hover i {
  color: var(--text-primary);
}

/* ---------------- Content Container ---------------- */
.auth-container {
  overflow: auto;
  padding: var(--card-padding);
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.auth-container::-webkit-scrollbar {
  width: 6px;
}

.auth-container::-webkit-scrollbar-track {
  background: transparent;
}

.auth-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

/* ---------------- Premium Header ---------------- */
.auth-header {
  text-align: center;
  margin-bottom: 36px;
  position: relative;
}

.auth-header h2 {
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.2px;
}

/* ---------------- Premium Buttons & Forms ---------------- */
.auth-form { 
  display: block; 
}

.auth-buttons { 
  display: flex; 
  flex-direction: column; 
  gap: 12px; 
}

/* Base button style */
.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-premium);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Premium hover effect */
.auth-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.auth-btn:hover::after {
  width: 300px;
  height: 300px;
}

/* Google button - clean white */
.google-btn {
  background: rgba(255, 255, 255, 1);
  color: #1a1a1a;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.google-btn:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.google-icon { 
  width: 18px; 
  height: 18px; 
  flex-shrink: 0; 
}

/* Apple button - deep black */
.apple-btn {
  background: #000000;
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.apple-btn:hover {
  background: #1a1a1a;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.apple-icon { 
  width: 18px; 
  height: 18px; 
  flex-shrink: 0; 
  color: #fff; 
}

/* Email button - subtle gradient */
.email-btn, .primary-btn {
  background: linear-gradient(135deg, #00000 0%, #3A414926 100%);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.email-btn:hover, .primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  filter: brightness(1.1);
}

/* Secondary button - transparent with border */
.secondary-btn {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Divider - minimal style */
.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  position: relative;
}

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

.divider span {
  padding: 0 16px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Back button */
.back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 24px;
  padding: 8px 0;
  transition: all 0.3s var(--ease-premium);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.back-btn:hover {
  color: var(--text-primary);
  transform: translateX(-2px);
}

/* Form inputs - minimal and elegant */
.email-form-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.email-form-content input {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 400;
  transition: all 0.3s var(--ease-premium);
  -webkit-font-smoothing: antialiased;
}

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

.email-form-content input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

/* Loading State - minimal spinner */
.auth-loading {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-primary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.auth-loading p {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Error Messages - subtle style */
.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ff6b6b;
  padding: 12px 16px;
  border-radius: 10px;
  margin-top: 16px;
  font-size: 14px;
  text-align: center;
  font-weight: 500;
}

/* ---------------- User Profile Sections ---------------- */
/* Profile Avatar Button (Top Right) */
.user-profile-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.user-avatar-compact {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  object-fit: cover;
  transition: all 0.3s var(--ease-premium);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.user-avatar-compact:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Profile Dropdown - Premium Style */
#profile-dropdown-menu {
  background: rgba(18, 18, 18, 0.98);
  -webkit-backdrop-filter: saturate(180%) blur(40px);
  backdrop-filter: saturate(180%) blur(40px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  padding: 8px;
}

.profile-dropdown-item {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease-premium);
  display: flex;
  align-items: center;
  gap: 12px;
}

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

/* User info in dropdown */
.dropdown-user-info {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 8px;
}

.dropdown-user-name {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.dropdown-user-email {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
}

/* ---------------- Responsive Design ---------------- */

/* Tablet (1024px and below) */
@media (max-width: 1024px) {
  :root {
    --card-padding: 32px;
  }
  
  .auth-header h2 {
    font-size: 26px;
  }
  
  .auth-btn {
    padding: 13px 18px;
    font-size: 14px;
  }
  
  .email-form-content input {
    padding: 13px 14px;
    font-size: 14px;
  }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
  :root {
    --card-padding: 28px;
    --card-max-w: 100%;
  }
  
  .auth-modal-content {
    margin: 20px;
    border-radius: 20px;
  }
  
  .auth-header h2 {
    font-size: 24px;
  }
  
  .auth-header p {
    font-size: 13px;
  }
  
  .auth-btn {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: 10px;
  }
  
  .auth-buttons {
    gap: 10px;
  }
  
  /* Profile avatar adjustments */
  .user-avatar-compact {
    width: 36px;
    height: 36px;
  }
  
  #profile-dropdown-menu {
    right: 0;
    left: auto;
    min-width: 220px;
  }
}

/* Small Mobile (520px and below) */
@media (max-width: 520px) {
  :root {
    --card-padding: 24px;
    --safe-pad: 16px;
  }
  
  .auth-modal-content {
    margin: 12px;
    border-radius: 18px;
  }
  
  .auth-close {
    width: 28px;
    height: 28px;
    top: 12px;
    right: 12px;
  }
  
  .auth-close i {
    font-size: 12px;
  }
  
  .auth-header h2 {
    font-size: 22px;
  }
  
  .auth-header p {
    font-size: 12px;
  }
  
  .auth-btn {
    padding: 11px 14px;
    font-size: 13px;
  }
  
  .divider span {
    font-size: 11px;
    padding: 0 12px;
  }
  
  .email-form-content input {
    padding: 11px 12px;
    font-size: 13px;
  }
}

/* Extra Small Mobile (380px and below) */
@media (max-width: 380px) {
  :root {
    --card-padding: 20px;
  }
  
  .auth-header h2 {
    font-size: 20px;
  }
  
  .auth-btn {
    padding: 10px 12px;
    font-size: 12px;
    gap: 8px;
  }
  
  .google-icon,
  .apple-icon {
    width: 16px;
    height: 16px;
  }
}

/* Short Viewport Optimization */
@media (max-height: 700px) {
  .auth-header {
    margin-bottom: 24px;
  }
  
  .auth-buttons {
    gap: 10px;
  }
  
  .auth-btn {
    padding: 10px 16px;
  }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   PROFILE SETTINGS SECTION STYLES
   ========================================================= */

.profile-settings-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

.profile-section-title {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}

.profile-section-title i {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
}

.profile-form-group {
  margin-bottom: 16px;
}

.profile-label {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.profile-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 400;
  transition: all 0.3s var(--ease-premium);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

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

.profile-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(58, 65, 73, 0.06);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.3);
}

.profile-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
  cursor: pointer;
}

.profile-select option {
  background: #1a1a1a;
  color: var(--text-primary);
  padding: 10px;
}

.profile-save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  margin-top: 20px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-premium);
  background: linear-gradient(135deg, #1a1a1a 0%, #3A414926 100%);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
  letter-spacing: 0.3px;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow: hidden;
}

.profile-save-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.profile-save-btn:hover::after {
  width: 300px;
  height: 300px;
}

.profile-save-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  filter: brightness(1.1);
}

.profile-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.profile-save-btn:disabled:hover {
  filter: none;
  box-shadow: var(--shadow-sm);
}

.profile-save-btn.saving {
  pointer-events: none;
}

.profile-save-btn.saving i {
  animation: spin 0.8s linear infinite;
}

.profile-save-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.profile-save-status.success {
  background: rgba(58, 65, 73, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.profile-save-status.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.profile-save-status.loading {
  background: rgba(58, 65, 73, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #000000;
}

/* Profile input number spinner hide */
.profile-input[type="number"]::-webkit-inner-spin-button,
.profile-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

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

/* Mobile responsive adjustments for profile section */
@media (max-width: 768px) {
  .profile-settings-section {
    margin-top: 20px;
    padding-top: 20px;
  }
  
  .profile-section-title {
    font-size: 16px;
  }
  
  .profile-input {
    padding: 11px 12px;
    font-size: 13px;
  }
  
  .profile-save-btn {
    padding: 12px 16px;
    font-size: 14px;
  }
}

@media (max-width: 520px) {
  .profile-section-title {
    font-size: 15px;
    gap: 8px;
  }
  
  .profile-section-title i {
    font-size: 14px;
  }
  
  .profile-label {
    font-size: 12px;
  }
  
  .profile-input {
    padding: 10px 11px;
    font-size: 12px;
  }
  
  .profile-save-btn {
    padding: 11px 14px;
    font-size: 13px;
  }
}
