/* Auth Modal Styles */
#authModal {
  display:none;position:fixed;z-index:1000;left:0;top:0;width:100vw;height:100vh;background:rgba(0,0,0,0.75);align-items:center;justify-content:center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#authModal.show {
  display: flex;
}

/* Terms and Privacy Modal Styles */
.terms-modal {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.75);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.terms-modal.show {
  display: flex;
}

/* Notification Modal Styles */
.notification-modal {
  display: none;
  position: fixed;
  z-index: 1002;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.75);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.notification-modal.show {
  display: flex;
}

.auth-glass {
  background: linear-gradient(135deg, rgba(15,23,42,0.95) 0%, rgba(30,41,59,0.95) 100%);
  border-radius: 24px;
  max-width: 420px;
  width: 92vw;
  padding: 0;
  box-shadow: 
    0 25px 50px -12px rgba(0,0,0,0.5),
    0 0 0 1px rgba(255,255,255,0.1),
    inset 0 1px 0 rgba(255,255,255,0.15);
  position:relative;
  animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.15);
  overflow: visible;
}

@keyframes modalSlideIn {
  from { 
    opacity: 0; 
    transform: translateY(30px) scale(0.95); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

#authModal button.close-btn {
  position:absolute;top:20px;right:20px;background:rgba(255,255,255,0.1);border:1px solid rgba(255,255,255,0.2);border-radius:50%;width:36px;height:36px;font-size:1.2rem;color:#94a3b8;cursor:pointer;transition: all 0.3s ease;display:flex;align-items:center;justify-content:center;z-index:10;
}

#authModal button.close-btn:hover {
  background: rgba(239,68,68,0.2);
  border-color: #ef4444;
  color: #ef4444;
  transform: scale(1.1);
}

/* Auth Header */
.auth-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  padding: 32px 32px 24px 32px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.auth-logo img {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 8px rgba(56,189,248,0.3));
}

.auth-logo span {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #38bdf8 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-subtitle {
  font-size: 0.95rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

/* Auth Tabs */
#authTabs {
  display:flex;gap:0;margin:0;background:rgba(15,23,42,0.5);padding:4px;margin:24px 24px 0 24px;border-radius:12px;border:1px solid rgba(255,255,255,0.1);
}

#authTabs button {
  flex:1;font-weight:600;padding:12px 16px;border:none;background:transparent;color:#64748b;border-radius:8px;cursor:pointer;transition: all 0.3s ease;font-size:0.95rem;display:flex;align-items:center;justify-content:center;gap:8px;position:relative;
}

#authTabs button.active {
  background:linear-gradient(135deg,#38bdf8 0%,#7c3aed 100%);color:#fff;box-shadow:0 4px 16px rgba(56,189,248,0.3);transform:translateY(-1px);
}

#authTabs button:not(.active):hover {
  color: #cbd5e1;
  background: rgba(255,255,255,0.05);
}

/* Form Container */
#loginForm, #registerForm {
  margin: 24px 24px 0 24px;
  padding-bottom: 24px;
}

/* Form Groups */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  font-size:0.9rem;color:#e2e8f0;font-weight:600;margin-bottom:8px;display:block;display:flex;align-items:center;gap:8px;
}

.form-label i {
  color: #38bdf8;
  font-size: 0.9rem;
}

/* Input Wrapper */
.input-wrapper {
  position: relative;
  background: rgba(15,23,42,0.6);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.3s ease;
  overflow: hidden;
}

.input-wrapper:focus-within {
  border-color: #38bdf8;
  background: rgba(15,23,42,0.8);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.1);
}

.input-wrapper input {
  background:transparent;border:none;outline:none;color:#f1f5f9;font-size:1rem;padding:16px 16px;width:100%;border-radius:12px;transition: all 0.3s ease;
}

.input-wrapper input::placeholder {
  color: #64748b;
}

.input-border {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #38bdf8, #7c3aed);
  transition: width 0.3s ease;
}

.input-wrapper:focus-within .input-border {
  width: 100%;
}

/* Form Options */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
  flex-wrap: wrap;
  gap: 12px;
}

/* Checkbox */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.checkbox-wrapper input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  background: rgba(15,23,42,0.6);
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.checkbox-wrapper:hover .checkmark {
  border-color: rgba(56,189,248,0.5);
  background: rgba(15,23,42,0.8);
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark {
  background: linear-gradient(135deg, #38bdf8 0%, #7c3aed 100%);
  border-color: transparent;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.forgot-password {
  color: #38bdf8;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.forgot-password:hover {
  color: #7c3aed;
}

/* Submit Button */
.submit-btn {
  width:100%;margin-top:24px;font-size:1rem;padding:16px 0;border-radius:12px;border:none;font-weight:600;cursor:pointer;transition:all 0.3s ease;display:flex;align-items:center;justify-content:center;gap:12px;position:relative;overflow:hidden;
}

.login-btn {
  background: linear-gradient(135deg, #38bdf8 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(56,189,248,0.3);
}

.register-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(16,185,129,0.3);
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(56,189,248,0.4);
}

.submit-btn:active {
  transform: translateY(0);
}

/* Divider */
.divider {
  text-align: center;
  margin: 24px 0;
  position: relative;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.2);
}

.divider span {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  padding: 0 16px;
  color: #94a3b8;
  font-size: 0.9rem;
  position: relative;
  z-index: 1;
}

/* Social Button */
.social-btn {
  width: 100%;
  padding: 14px 0;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: #e2e8f0;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.social-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

.google-btn i {
  color: #ea4335;
}

/* Captcha */
.captcha-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.captcha-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15,23,42,0.6);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
}

#captcha-code {
  background: linear-gradient(135deg, #38bdf8 0%, #7c3aed 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
  min-width: 80px;
  text-align: center;
}

.refresh-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #94a3b8;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover {
  background: rgba(56,189,248,0.2);
  color: #38bdf8;
  border-color: #38bdf8;
}

/* Terms Link */
.terms-link {
  color: #38bdf8;
  text-decoration: none;
  transition: color 0.3s ease;
}

.terms-link:hover {
  color: #7c3aed;
}

/* Terms Group */
.terms-group {
  margin-bottom: 24px;
}

.terms-wrapper {
  background: rgba(15,23,42,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.terms-wrapper:hover {
  background: rgba(15,23,42,0.6);
  border-color: rgba(56,189,248,0.3);
  transform: translateY(-1px);
}

.terms-checkbox {
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.terms-text {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
  line-height: 1.4;
  color: #cbd5e1;
  font-size: 0.9rem;
  align-items: center;
}

.terms-text span {
  color: #e2e8f0;
}

.terms-link {
  color: #38bdf8;
  text-decoration: none;
  transition: color 0.3s ease;
  font-weight: 500;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.terms-link:hover {
  color: #7c3aed;
  background: rgba(56,189,248,0.1);
  text-decoration: underline;
}

/* Terms Label */
.terms-label {
  color: #e2e8f0 !important;
  font-size: 0.875rem;
  line-height: 1.4;
}

/* Password Requirements */
.password-requirements {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: 8px;
}

.password-requirements small {
  color: #94a3b8;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Terms Modal */
.terms-modal {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.8);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.terms-content {
  background: linear-gradient(135deg, rgba(15,23,42,0.98) 0%, rgba(30,41,59,0.98) 100%);
  border-radius: 20px;
  max-width: 500px;
  width: 90vw;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 
    0 25px 50px -12px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  animation: modalSlideIn 0.3s ease;
}

.terms-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.terms-header h3 {
  margin: 0;
  color: #f8fafc;
  font-size: 1.3rem;
  font-weight: 700;
}

.close-terms {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-terms:hover {
  background: rgba(239,68,68,0.2);
  border-color: #ef4444;
  color: #ef4444;
}

.terms-body {
  padding: 24px;
  max-height: 50vh;
  overflow-y: auto;
}

.terms-section {
  margin-bottom: 20px;
}

.terms-section h4 {
  color: #38bdf8;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.terms-section p {
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

.terms-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: rgba(15,23,42,0.3);
  text-align: center;
}

.btn-accept-terms {
  background: linear-gradient(135deg, #38bdf8 0%, #7c3aed 100%);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-accept-terms:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(56,189,248,0.4);
}

/* Error and Success Messages */
.error-message {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: none;
}

.success-message {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  color: #86efac;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: none;
}

/* Enhanced Mobile Optimization */
@media (max-width: 768px) {
  .auth-glass {
    max-width: 95vw;
    margin: 16px;
    border-radius: 20px;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .auth-header {
    padding: 24px 20px 20px 20px;
  }
  
  .auth-logo span {
    font-size: 1.3rem;
  }
  
  #authTabs {
    margin: 20px 20px 0 20px;
    padding: 3px;
  }
  
  #authTabs button {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  
  #loginForm, #registerForm {
    margin: 20px 20px 0 20px;
    padding-bottom: 20px;
  }
  
  .form-group {
    margin-bottom: 18px;
  }
  
  .input-wrapper input {
    padding: 14px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .form-label {
    font-size: 0.85rem;
    margin-bottom: 6px;
  }
  
  .submit-btn {
    padding: 14px 0;
    font-size: 0.95rem;
  }
  
  .social-btn {
    padding: 12px 0;
    font-size: 0.9rem;
  }
  
  .terms-content {
    max-width: 95vw;
    max-height: 85vh;
    margin: 16px;
  }
  
  .terms-header {
    padding: 16px 20px;
  }
  
  .terms-header h3 {
    font-size: 1.2rem;
  }
  
  .terms-body {
    padding: 20px;
    max-height: 45vh;
  }
  
  .terms-footer {
    padding: 16px 20px;
  }
  
  .btn-accept-terms {
    padding: 10px 24px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .auth-glass {
    margin: 8px;
    border-radius: 16px;
  }
  
  .auth-header {
    padding: 20px 16px 16px 16px;
  }
  
  .auth-logo {
    margin-bottom: 16px;
  }
  
  .auth-logo img {
    width: 28px;
    height: 28px;
  }
  
  .auth-logo span {
    font-size: 1.2rem;
  }
  
  .auth-subtitle {
    font-size: 0.85rem;
  }
  
  #authTabs {
    margin: 16px 16px 0 16px;
  }
  
  #authTabs button {
    padding: 8px 10px;
    font-size: 0.85rem;
  }
  
  #loginForm, #registerForm {
    margin: 16px 16px 0 16px;
    padding-bottom: 16px;
  }
  
  .form-group {
    margin-bottom: 16px;
  }
  
  .input-wrapper input {
    padding: 12px 12px;
    font-size: 16px;
  }
  
  .form-label {
    font-size: 0.8rem;
    margin-bottom: 5px;
  }
  
  .submit-btn {
    padding: 12px 0;
    font-size: 0.9rem;
  }
  
  .social-btn {
    padding: 10px 0;
    font-size: 0.85rem;
  }
  
  .terms-wrapper {
    padding: 12px;
  }
  
  .terms-text {
    font-size: 0.75rem;
  }
  
  .password-requirements {
    padding: 6px 10px;
  }
  
  .password-requirements small {
    font-size: 0.7rem;
  }
  
  /* Checkbox mobile optimization */
  .checkmark {
    width: 24px;
    height: 24px;
  }
  
  .checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
    font-size: 14px;
  }
  
  .checkbox-wrapper {
    gap: 14px;
    font-size: 0.8rem;
  }
}

@media (max-width: 360px) {
  .auth-glass {
    margin: 4px;
    border-radius: 12px;
  }
  
  .auth-header {
    padding: 16px 12px 12px 12px;
  }
  
  .auth-logo {
    margin-bottom: 12px;
  }
  
  .auth-logo img {
    width: 24px;
    height: 24px;
  }
  
  .auth-logo span {
    font-size: 1.1rem;
  }
  
  .auth-subtitle {
    font-size: 0.8rem;
  }
  
  #authTabs {
    margin: 12px 12px 0 12px;
  }
  
  #authTabs button {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  
  #loginForm, #registerForm {
    margin: 12px 12px 0 12px;
    padding-bottom: 12px;
  }
  
  .form-group {
    margin-bottom: 14px;
  }
  
  .input-wrapper input {
    padding: 10px 10px;
    font-size: 16px;
  }
  
  .form-label {
    font-size: 0.75rem;
    margin-bottom: 4px;
  }
  
  .submit-btn {
    padding: 10px 0;
    font-size: 0.85rem;
  }
  
  .social-btn {
    padding: 8px 0;
    font-size: 0.8rem;
  }
  
  .terms-wrapper {
    padding: 10px;
  }
  
  .terms-text {
    font-size: 0.75rem;
  }
  
  .password-requirements {
    padding: 5px 8px;
  }
  
  .password-requirements small {
    font-size: 0.7rem;
  }
  
  /* Checkbox mobile optimization */
  .checkmark {
    width: 24px;
    height: 24px;
  }
  
  .checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
    font-size: 14px;
  }
  
  .checkbox-wrapper {
    gap: 14px;
    font-size: 0.8rem;
  }
}

/* Touch-friendly improvements for mobile */
@media (hover: none) and (pointer: coarse) {
  .submit-btn:hover,
  .social-btn:hover,
  .refresh-btn:hover {
    transform: none;
  }
  
  .submit-btn:active,
  .social-btn:active,
  .refresh-btn:active {
    transform: scale(0.98);
  }
  
  .input-wrapper:focus-within {
    transform: scale(1.02);
  }
}
