/* ========================================================================== 
   SETTINGS -> ACCOUNT: SIMPLE PHONE / DUO LAYOUT

   THIS FILE IS INTENTIONALLY BORING.

   To move something:
   - top: moves it down from the top
   - left: moves it right from the left
   - right: moves it left from the right
   - bottom: moves it up from the bottom
   - width / height: changes its size

   There are no inset shortcuts, responsive equations, or nested positioning
   tricks in this file. Every important Account element has its own block.
   ========================================================================== */

/* Upgrade and legal links are now independent Account items. These two tiny
   rules preserve category switching on every screen size. */
.subscription-purchase-button[data-category="account"]:not(.visible),
.account-legal-links[data-category="account"]:not(.visible) {
  display: none !important;
}

@media (max-width: 768px) {

  /* ========================= THE SETTINGS PANEL ========================= */
  .day-cycle-settings-panel {
    overflow: hidden !important;
  }

  .day-cycle-settings-panel .day-cycle-settings-panel__content {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    overflow: visible !important;
  }


  /* ================= HEADER — both stay above the line ================= */
  .day-cycle-settings-panel__title {
    position: absolute !important;
    top: 8px !important;
    left: 16px !important;
    margin: 0 !important;
    line-height: 34px !important;
    white-space: nowrap;
  }

  .settings-category-selector {
    position: absolute !important;
    top: 10px !important;
    left: 34% !important;
    width: 63% !important;
    margin: 0 !important;
    z-index: 30 !important;
  }

  .settings-category-trigger {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 30px !important;
  }

  .settings-category-dropdown {
    top: 34px !important;
    left: 0 !important;
    width: 100% !important;
  }

  .day-cycle-settings-panel__line {
    position: absolute !important;
    top: 52px !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 20 !important;
  }


  /* ============================ DEVICE ROW ============================= */
  .device-last-seen-dropdown {
    top: 10% !important;
    left: 7% !important;
    right: auto !important;
    width: 86% !important;
  }

  .device-last-seen-trigger {
    flex-wrap: nowrap !important;
    gap: 2% !important;
    padding-left: 2% !important;
    padding-right: 2% !important;
  }

  .device-name,
  .device-last-seen,
  .device-location {
    min-width: 0 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 2.8vw !important;
  }

  .device-name {
    max-width: 34% !important;
  }

  .device-last-seen {
    max-width: 25% !important;
  }

  .device-location {
    max-width: 18% !important;
  }


  /* ========== AGE — left side of the row above First Name ============= */
  .account-age-display {
    top: 22% !important;
    left: 16% !important;
    right: auto !important;
    white-space: nowrap;
  }

  /* ============================ FIRST NAME ============================= */
  .account-name-container.visible {
    position: absolute !important;
    top: 25% !important;
    left: 12% !important;
    right: auto !important;
    width: 76% !important;
  }

  .account-name-input {
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: 48px !important;
    box-sizing: border-box;
  }


  /* ====== ACCOUNT TIMELINE — right side above First Name =============== */
  .member-since-display {
    position: absolute !important;
    top: -24px !important;
    right: 2% !important;
    left: auto !important;
    margin: 0 !important;
    white-space: nowrap;
  }


  /* ============================= LAST NAME ============================= */
  .account-lastname-container.visible {
    position: absolute !important;
    top: 37% !important;
    left: 12% !important;
    right: auto !important;
    width: 76% !important;
  }

  .account-lastname-input {
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: 48px !important;
    box-sizing: border-box;
  }


  /* =========================== UPGRADE BUTTON ========================== */
  .subscription-purchase-button[data-category="account"] {
    display: none !important;
  }

  .subscription-purchase-button[data-category="account"].visible {
    display: flex !important;
    position: absolute !important;
    top: 51% !important;
    left: 14% !important;
    width: 72% !important;
    height: 62px !important;
    min-height: 0 !important;
    margin: 0 !important;
  }


  /* ====================== POSTHOG ANALYTICS BUTTON ===================== */
  #ph-allow-btn-settings.visible {
    position: absolute !important;
    top: 66% !important;
    left: 25% !important;
    right: auto !important;
    width: 50% !important;
    max-width: none !important;
    margin: 0 !important;
    white-space: nowrap;
  }


  /* =========== PRIVACY / TERMS / DELETE — above Currency ============== */
  .account-legal-links[data-category="account"] {
    display: none !important;
  }

  .account-legal-links[data-category="account"].visible {
    display: block !important;
    position: absolute !important;
    top: auto !important;
    bottom: 10% !important;
    left: 4% !important;
    right: auto !important;
    width: 92% !important;
    margin: 0 !important;
    white-space: nowrap;
    font-size: 2.5vw !important;
  }


  /* ======================= CURRENCY — bottom-left ====================== */
  .account-currency-container.visible {
    position: absolute !important;
    left: 4% !important;
    right: auto !important;
    bottom: 3% !important;
    width: 55% !important;
  }

  .account-currency-label {
    display: none !important;
  }

  .account-currency-dropdown {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
  }

  .account-currency-button {
    width: 100% !important;
  }


  /* ==================== WEBSITE SYNC — bottom-right ==================== */
  .account-website-container.visible {
    position: absolute !important;
    top: auto !important;
    bottom: 13% !important;
    left: 4% !important;
    right: auto !important;
    width: 58% !important;
    gap: 4px !important;
    align-items: flex-start;
    text-align: left;
  }

  .account-website-label {
    display: none !important;
  }

  .account-website-btn,
  .account-website-hint {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 3.1vw !important;
  }


  /* ==================== LOG OUT — bottom-right edge ==================== */
  .device-logout-btn {
    top: auto !important;
    right: 1% !important;
    bottom: 0 !important;
  }


  /* ========== LOGIN SCREEN — header remains visible above it =========== */
  .account-login-overlay.visible {
    top: 54px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 0 0 26px 26px;
  }
}


/* ========================================================================== 
   SHORT PHONES

   This ONLY makes the panel taller. The positions above stay exactly the
   same, so there is no second mystery layout to maintain.
   ========================================================================== */
@media (max-width: 768px) and (max-height: 700px) {
  .day-cycle-settings-panel,
  .day-cycle-settings-panel.is-open {
    top: 4svh !important;
    height: 92svh !important;
  }
}
