/**
 * TripPortier Authentication Styles
 * Modal, buttons, and navbar authentication elements
 */

/* ============================================
   Authentication Modal
   ============================================ */

.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-modal.show {
  opacity: 1;
  visibility: visible;
}

.auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.auth-modal-content {
  position: relative;
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  width: 90%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s ease;
}

.auth-modal.show .auth-modal-content {
  transform: translateY(0) scale(1);
}

.auth-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: #64748b;
  transition: color 0.2s ease;
  border-radius: 8px;
}

.auth-modal-close:hover {
  color: #1e293b;
  background: #f1f5f9;
}

.auth-modal-close svg {
  display: block;
}

/* ============================================
   Sign In / Sign Up Tabs
   ============================================ */

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: #f1f5f9;
  padding: 0.375rem;
  border-radius: 12px;
}

.auth-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  border-radius: 9px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.auth-tab:hover:not(.active) {
  color: #374151;
}

.auth-tab.active {
  background: white;
  color: #6366f1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ============================================
   Modal Header
   ============================================ */

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

.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.5rem 0;
}

.auth-header p {
  color: #64748b;
  font-size: 0.9375rem;
  margin: 0;
}

/* ============================================
   Social Login Buttons
   ============================================ */

.auth-social-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  width: 100%;
  font-family: inherit;
}

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

.auth-btn-apple {
  background: #000;
  color: white;
}

.auth-btn-apple:hover:not(:disabled) {
  background: #1a1a1a;
  transform: translateY(-1px);
}

.auth-btn-google {
  background: white;
  color: #1e293b;
  border: 2px solid #e2e8f0;
}

.auth-btn-google:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: #f8fafc;
  transform: translateY(-1px);
}

.auth-btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
}

.auth-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.auth-btn svg {
  flex-shrink: 0;
}

/* ============================================
   Divider
   ============================================ */

.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.auth-divider span {
  padding: 0 1rem;
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
}

/* ============================================
   Form Fields
   ============================================ */

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

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.auth-field input {
  padding: 0.875rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: white;
}

.auth-field input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.auth-field input::placeholder {
  color: #94a3b8;
}

/* ============================================
   Error & Success Messages
   ============================================ */

.auth-error {
  background: #fef2f2;
  color: #dc2626;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  text-align: center;
  border: 1px solid #fecaca;
}

.auth-success {
  background: #f0fdf4;
  color: #16a34a;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  text-align: center;
  border: 1px solid #bbf7d0;
}

/* ============================================
   Footer & Links
   ============================================ */

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.auth-footer p {
  color: #64748b;
  font-size: 0.9375rem;
  margin: 0;
}

.auth-footer a {
  color: #6366f1;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-forgot-password {
  text-align: right;
  margin-top: -0.5rem;
}

.auth-forgot-password a {
  color: #6366f1;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
}

.auth-forgot-password a:hover {
  text-decoration: underline;
}

/* ============================================
   Loading State
   ============================================ */

.auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

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

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

/* ============================================
   Navbar Authentication Elements
   ============================================ */

.nav-signin-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.25rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white !important;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.nav-signin-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.25);
  color: white !important;
  text-decoration: none;
}

/* User Dropdown */
.nav-user-dropdown {
  position: relative;
}

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.375rem 0.5rem;
  border-radius: 50px;
  transition: background 0.2s ease;
}

.nav-user-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.nav-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.nav-user-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
}

.nav-user-btn span {
  font-weight: 500;
  color: inherit;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user-chevron {
  transition: transform 0.2s ease;
}

.nav-user-dropdown.open .nav-user-chevron {
  transform: rotate(180deg);
}

/* Transparent navbar state - white text for user button */
.navbar:not(.scrolled) .nav-user-btn {
  color: rgba(255, 255, 255, 0.9);
}

.navbar:not(.scrolled) .nav-user-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.navbar:not(.scrolled) .nav-user-chevron {
  color: rgba(255, 255, 255, 0.9);
}

/* Scrolled navbar state - white text for user button */
.navbar.scrolled .nav-user-btn {
  color: rgba(255, 255, 255, 0.9);
}

.navbar.scrolled .nav-user-chevron {
  color: rgba(255, 255, 255, 0.9);
}

.nav-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.nav-user-dropdown.open .nav-user-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-user-menu-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.5rem;
}

.nav-user-menu-name {
  font-weight: 600;
  color: #1e293b;
  font-size: 0.9375rem;
}

.nav-user-menu-email {
  color: #64748b;
  font-size: 0.8125rem;
  margin-top: 0.125rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-user-menu a,
.nav-user-menu button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  color: #374151 !important;
  text-decoration: none !important;
  border-radius: 8px;
  transition: background 0.2s ease;
  font-size: 0.9375rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.nav-user-menu a:hover,
.nav-user-menu button:hover {
  background: #f3f4f6;
}

.nav-user-menu-icon {
  width: 20px;
  height: 20px;
  color: #64748b;
}

.nav-user-menu-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0.5rem 0;
}

.nav-user-menu button.signout {
  color: #dc2626;
}

.nav-user-menu button.signout:hover {
  background: #fef2f2;
}

/* ============================================
   Responsive Styles
   ============================================ */

@media (max-width: 768px) {
  .auth-modal-content {
    padding: 1.5rem;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    transform: translateY(100%);
  }

  .auth-modal.show .auth-modal-content {
    transform: translateY(0);
  }

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

  .nav-user-btn span {
    display: none;
  }

  .nav-user-menu {
    right: -1rem;
  }
}

/* ============================================
   Mobile Menu Auth
   ============================================ */

.mobile-auth-section {
  padding: 1rem 0;
  border-top: 1px solid #e2e8f0;
  margin-top: 1rem;
}

.mobile-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.mobile-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.mobile-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.mobile-user-details {
  flex: 1;
}

.mobile-user-name {
  font-weight: 600;
  color: #1e293b;
}

.mobile-user-email {
  font-size: 0.8125rem;
  color: #64748b;
}

.mobile-signout-btn {
  display: block;
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.75rem;
  background: #fef2f2;
  color: #dc2626;
  border: none;
  border-radius: 10px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}
