/* ============================================================
   AUTH UI STYLES
   Cloud sync banner, auth modal, sync status, user menu
   ============================================================ */

/* CSS Variables (fallbacks if not in landing.css) */
:root {
  --mood-anxious: #D67E7E;
  --cream-light: #FDFCF9;
  --green-dark: #5A7A60;
}

/* ============================================================
   MODAL BASE STYLES
   Full-screen overlay with centered content
   ============================================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(61, 52, 44, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-content {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 0;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow:
    0 20px 60px rgba(61, 52, 44, 0.4),
    0 8px 32px rgba(154, 107, 81, 0.25);
  border: 1px solid rgba(141, 135, 126, 0.2);
  position: relative;
  transform: scale(1);
  transition: transform 0.3s ease;
}

.modal.hidden .modal-content {
  transform: scale(0.95);
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  color: rgba(61, 52, 44, 0.5);
  cursor: pointer;
  padding: 0.25rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 10;
}

.close-btn:hover {
  background: rgba(61, 52, 44, 0.08);
  color: rgba(61, 52, 44, 0.8);
  transform: rotate(90deg);
}

/* ============================================================
   CLOUD SYNC BANNER
   ============================================================ */

.cloud-sync-banner {
  display: none !important; /* Temporarily hide legacy cloud banner */
  background: linear-gradient(135deg, rgba(107, 143, 113, 0.12) 0%, rgba(154, 107, 81, 0.12) 100%);
  border-bottom: 1px solid rgba(107, 143, 113, 0.15);
  padding: 0.65rem 1rem;
  position: sticky;
  top: 60px; /* Below nav */
  z-index: 99;
  backdrop-filter: blur(8px);
}

.cloud-sync-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cloud-sync-banner-icon {
  color: var(--nuuko-green);
  display: flex;
  align-items: center;
}

.cloud-sync-banner-text {
  color: var(--nuuko-espresso);
  font-size: 0.9rem;
  font-weight: 500;
}

.cloud-sync-banner .btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
}

.cloud-sync-banner-dismiss {
  background: none;
  border: none;
  color: var(--nuuko-stone);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  margin-left: 0.5rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.cloud-sync-banner-dismiss:hover {
  opacity: 1;
}

/* ============================================================
   AUTH MODAL
   ============================================================ */

.auth-modal-content {
  max-width: 400px;
  padding: 2rem;
  position: relative;
}

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

.auth-modal-logo {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
}

.auth-modal-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  color: var(--nuuko-espresso);
}

.auth-modal-header .text-muted {
  font-size: 0.9rem;
}

/* Form Styles */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--nuuko-espresso);
}

.form-group input {
  padding: 0.75rem 1rem;
  border: 1.5px solid rgba(141, 135, 126, 0.3);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font-sans);
  background: var(--cream-light);
  color: var(--nuuko-espresso);
  transition: all 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--nuuko-green);
  box-shadow: 0 0 0 3px rgba(107, 143, 113, 0.15);
}

.form-group input::placeholder {
  color: var(--nuuko-stone);
  opacity: 0.7;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--nuuko-stone);
  margin: 0;
}

.auth-error {
  background: rgba(214, 126, 126, 0.15);
  border: 1px solid rgba(214, 126, 126, 0.3);
  color: var(--mood-anxious);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.auth-submit {
  margin-top: 0.5rem;
  width: 100%;
}

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

/* Footer */
.auth-modal-footer {
  margin-top: 1.5rem;
  text-align: center;
}

.auth-modal-footer p {
  font-size: 0.85rem;
  color: var(--nuuko-stone);
  margin: 0.5rem 0;
}

.btn-link {
  background: none;
  border: none;
  color: var(--nuuko-green);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-link:hover {
  color: var(--green-dark);
}

.auth-privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.75rem !important;
  opacity: 0.8;
  margin-top: 1rem !important;
}

/* ============================================================
   SYNC STATUS INDICATOR
   ============================================================ */

.sync-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  background: rgba(107, 143, 113, 0.1);
  font-size: 0.75rem;
  color: var(--nuuko-green);
}

.sync-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nuuko-green);
  transition: all 0.3s ease;
}

.sync-status-dot.syncing {
  animation: pulse 1.5s infinite;
  background: var(--nuuko-clay);
}

.sync-status-dot.error {
  background: var(--mood-anxious);
}

.sync-status-dot.offline {
  background: var(--nuuko-stone);
}

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

.sync-status-text {
  font-weight: 500;
}

/* ============================================================
   USER MENU
   ============================================================ */

.user-menu-container {
  position: relative;
  margin-left: auto;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  background: rgba(107, 143, 113, 0.1);
  border: 1px solid rgba(107, 143, 113, 0.2);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--nuuko-espresso);
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.user-menu-btn:hover {
  background: rgba(107, 143, 113, 0.15);
}

.user-menu-email {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 160px;
  background: var(--cream-light);
  border: 1px solid rgba(141, 135, 126, 0.2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-medium);
  overflow: hidden;
  z-index: 1000;
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  text-align: left;
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--nuuko-espresso);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.2s;
}

.user-menu-item:hover {
  background: rgba(107, 143, 113, 0.08);
}

.user-menu-info {
  border-bottom: 1px solid rgba(141, 135, 126, 0.15);
  cursor: default;
  color: var(--nuuko-green);
  font-weight: 500;
}

.user-menu-info:hover {
  background: none;
}

.user-menu-logout {
  color: var(--mood-anxious);
}

/* ============================================================
   NAV PROFILE BUTTON & DROPDOWN
   ============================================================ */

.nav-profile-container {
  position: relative;
  margin-left: 0.5rem;
}

.nav-profile-container.hidden {
  display: none;
}

.nav-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  background: rgba(107, 143, 113, 0.12);
  border: 1px solid rgba(107, 143, 113, 0.2);
  border-radius: 50px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.nav-profile-btn:hover {
  background: rgba(107, 143, 113, 0.2);
  border-color: rgba(107, 143, 113, 0.35);
}

.nav-profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--nuuko-green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-profile-chevron {
  color: var(--nuuko-stone);
  transition: transform 0.2s ease;
}

.nav-profile-container.open .nav-profile-chevron {
  transform: rotate(180deg);
}

.nav-profile-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 220px;
  background: white;
  border: 1px solid rgba(141, 135, 126, 0.15);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(61, 52, 44, 0.15), 0 4px 12px rgba(61, 52, 44, 0.08);
  overflow: hidden;
  z-index: 1000;
  animation: dropdownFade 0.15s ease;
}

.nav-profile-dropdown.hidden {
  display: none;
}

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

.nav-profile-info {
  padding: 0.85rem 1rem;
  background: rgba(107, 143, 113, 0.06);
}

.nav-profile-email {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--nuuko-espresso);
  margin-bottom: 0.25rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-profile-sync {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--nuuko-green);
  font-weight: 500;
}

.nav-profile-sync::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nuuko-green);
}

.nav-profile-divider {
  height: 1px;
  background: rgba(141, 135, 126, 0.12);
}

.nav-profile-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.7rem 1rem;
  background: none;
  border: none;
  font-size: 0.9rem;
  color: var(--nuuko-espresso);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
}

.nav-profile-item:hover {
  background: rgba(107, 143, 113, 0.08);
}

.nav-profile-logout {
  color: var(--mood-anxious);
  border-top: 1px solid rgba(141, 135, 126, 0.1);
}

.nav-profile-logout:hover {
  background: rgba(214, 126, 126, 0.08);
}

/* Hide sign-in when logged in */
.nav-auth-buttons.hidden,
#navSignInBtn.hidden {
  display: none;
}

/* ============================================================
   AUTH TOAST
   ============================================================ */

.auth-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(61, 52, 44, 0.95);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  z-index: 3000;
  box-shadow: var(--shadow-medium);
  opacity: 0;
  transition: all 0.3s ease;
}

.auth-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
  .cloud-sync-banner-content {
    padding: 0 0.5rem;
    gap: 0.5rem;
  }
  
  .cloud-sync-banner-text {
    font-size: 0.8rem;
  }
  
  .auth-modal-content {
    padding: 1.5rem;
    margin: 1rem;
  }
  
  .user-menu-email {
    max-width: 80px;
  }
  
  .sync-status {
    padding: 0.25rem 0.5rem;
  }
  
  .sync-status-text {
    display: none;
  }
}
