/**
 * Account Overlay Styles
 *
 * Full-page overlay for account page
 * - Desktop: Centered card layout
 * - Mobile: Bottom sheet with swipe-to-dismiss
 */

/* ===========================
   OVERLAY CONTAINER
   =========================== */

.account-overlay-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10025;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.account-overlay-container.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===========================
   BACKDROP
   =========================== */

.account-overlay-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1;
  transition: opacity 0.3s ease;
}

.account-overlay-container:not(.active) .account-overlay-backdrop {
  opacity: 0;
}

/* ===========================
   CONTENT CONTAINER
   =========================== */

.account-overlay-content {
  position: relative;
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 20px;
}

.account-overlay-container.active .account-overlay-content {
  transform: scale(1);
}

/* ===========================
   CLOSE BUTTON
   =========================== */

.account-overlay-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.account-overlay-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: scale(1.05);
}

.account-overlay-close-btn:active {
  transform: scale(0.95);
}

.account-overlay-close-btn svg {
  width: 20px;
  height: 20px;
}

/* ===========================
   SWIPE INDICATOR (Mobile)
   =========================== */

.account-overlay-swipe-indicator {
  display: none;
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 12px auto 8px;
  flex-shrink: 0;
}

/* ===========================
   BODY CONTENT
   =========================== */

.account-overlay-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for overlay content */
.account-overlay-body::-webkit-scrollbar {
  width: 8px;
}

.account-overlay-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.account-overlay-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.account-overlay-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===========================
   LOADING STATE
   =========================== */

.account-overlay-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 40px;
  text-align: center;
}

.account-overlay-loading .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #4CAF50;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

.account-overlay-loading .loading-text {
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
}

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

/* ===========================
   ERROR STATE
   =========================== */

.account-overlay-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 40px;
  text-align: center;
}

.account-overlay-error svg {
  color: #ff6b6b;
  margin-bottom: 20px;
}

.account-overlay-error h3 {
  color: #fff;
  font-size: 24px;
  margin: 0 0 12px;
}

.account-overlay-error p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  margin: 0 0 24px;
  max-width: 400px;
}

.account-overlay-error .btn {
  min-width: 120px;
}

/* ===========================
   MOBILE STYLES
   =========================== */

@media (max-width: 768px) {
  /* Bottom sheet pattern */
  .account-overlay-container {
    align-items: flex-end;
    padding: 0;
  }

  .account-overlay-content {
    max-width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 20px 20px 0 0;
    margin: 0;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .account-overlay-container.active .account-overlay-content {
    transform: translateY(0);
  }

  /* Show swipe indicator on mobile */
  .account-overlay-swipe-indicator {
    display: block;
  }

  /* Hide close button on mobile (swipe down to close instead) */
  .account-overlay-close-btn {
    display: none;
  }

  /* Make body content full height */
  .account-overlay-body {
    flex: 1;
    height: 100%;
  }
}

/* ===========================
   TABLET STYLES
   =========================== */

@media (min-width: 769px) and (max-width: 1024px) {
  .account-overlay-content {
    max-width: 900px;
    margin: 40px;
  }
}

/* ===========================
   LARGE DESKTOP STYLES
   =========================== */

@media (min-width: 1440px) {
  .account-overlay-content {
    max-width: 1400px;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .account-overlay-container,
  .account-overlay-content,
  .account-overlay-backdrop,
  .account-overlay-close-btn {
    transition: none !important;
  }
}

/* Focus styles for keyboard navigation */
.account-overlay-close-btn:focus {
  outline: 2px solid #4CAF50;
  outline-offset: 2px;
}

/* ===========================
   NESTED CONTENT FIXES
   =========================== */

/* Ensure account page content fits properly */
.account-overlay-body account-page {
  min-height: auto !important;
}

.account-overlay-body .profile-page-container {
  min-height: auto;
  background: transparent;
}

/* Adjust z-index for account page modals to appear above overlay */
.account-overlay-body .password-modal,
.account-overlay-body #cancelMembershipModal,
.account-overlay-body #resetCustomizationsModal,
.account-overlay-body #changePasswordModal {
  z-index: 10030 !important;
}

/* Adjust loading overlay inside account page */
.account-overlay-body #loadingOverlay {
  z-index: 10028 !important;
}

/* Fix upgrade modal z-index */
.account-overlay-body .upgrade-modal-backdrop {
  z-index: 10029 !important;
}
