/* ============================================================
   Atlas My Account — Stylesheet
   Theme: Atlas Blue #2563eb
   ============================================================ */

/* ── Elementor container reset ─────────────────────────────── */
.elementor-widget-ama-my-account .elementor-widget-container {
  overflow: visible !important;
  line-height: 1 !important;
}

/* ── Design tokens ─────────────────────────────────────────── */
.ama-launcher {
  --ama-accent:      #2563eb;
  --ama-accent-dark: #1d4ed8;
  --ama-border:      #e5e7eb;
  --ama-text:        #111827;
  --ama-muted:       #6b7280;
  --ama-bg:          #ffffff;
  --ama-hover-bg:    #f9fafb;

  display: inline-flex;
  position: relative;
}

/* ── Trigger button ────────────────────────────────────────── */
.ama-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #ffffff;
  color: #374151;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  cursor: pointer;
  font-size: .875rem;
  font-family: inherit;
  line-height: 1.4;
  transition: border-color .2s, background-color .2s, color .2s;
  position: relative;
  white-space: nowrap;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.ama-trigger:hover {
  border-color: #2563eb;
}

.ama-trigger:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.ama-trigger--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

.ama-trigger--avatar {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

/* ── Avatar ────────────────────────────────────────────────── */
.ama-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}

/* ── Cart badge ────────────────────────────────────────────── */
.ama-cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #2563eb;
  color: #ffffff;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0 5px;
  text-align: center;
  line-height: 18px;
  font-weight: 700;
  pointer-events: none;
}

/* ── Drawer root ───────────────────────────────────────────── */
.ama-drawer-root {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
}

.ama-drawer-root[aria-hidden="false"] {
  pointer-events: all;
}

/* ── Backdrop ──────────────────────────────────────────────── */
.ama-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  opacity: 0;
  transition: opacity .3s ease;
}

.ama-drawer-root[aria-hidden="false"] .ama-backdrop {
  opacity: 1;
}

/* ── Slide-out sheet ───────────────────────────────────────── */
.ama-sheet {
  position: fixed;
  right: 0;
  top: 0;
  height: 100%;
  max-width: 400px;
  width: 100%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s ease;
  box-shadow: -8px 0 40px rgba(0, 0, 0, .12);
  overflow: hidden;
}

.ama-drawer-root[aria-hidden="false"] .ama-sheet {
  transform: translateX(0);
}

/* ── Sheet header ──────────────────────────────────────────── */
.ama-sheet-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  background: #f9fafb;
  flex-shrink: 0;
}

.ama-sheet-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ama-sheet-header-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.ama-sheet-header-name {
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ama-sheet-header-email {
  font-size: .78rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ama-sheet-header-text {
  flex: 1;
}

.ama-sheet-header-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #111827;
}

.ama-sheet-header-sub {
  font-size: .82rem;
  color: #6b7280;
  margin-top: 2px;
}

/* ── Close button ──────────────────────────────────────────── */
.ama-sheet-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background-color .15s;
  flex-shrink: 0;
}

.ama-sheet-close:hover {
  color: #374151;
  background: #f3f4f6;
}

.ama-sheet-close:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ── Profile navigation ────────────────────────────────────── */
.ama-nav {
  display: flex;
  flex-direction: row;
  border-bottom: 2px solid #f3f4f6;
  padding: 0 16px;
  flex-shrink: 0;
}

.ama-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: .78rem;
  color: #9ca3af;
  font-family: inherit;
  transition: color .15s, border-bottom-color .15s;
}

.ama-nav-item.is-active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.ama-nav-item:hover:not(.is-active) {
  color: #374151;
}

.ama-nav-item svg {
  opacity: .6;
  transition: opacity .15s;
}

.ama-nav-item.is-active svg {
  opacity: 1;
}

.ama-nav-item:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

/* ── Profile container ─────────────────────────────────────── */
.ama-profile {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ama-panel {
  display: none;
  padding: 16px 20px;
}

.ama-panel.is-active {
  display: block;
}

/* ── Quick links ───────────────────────────────────────────── */
.ama-quick-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ama-quick-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #374151;
  transition: background .15s;
}

.ama-quick-link:hover {
  background: #f9fafb;
}

.ama-quick-link-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ama-quick-link-label {
  flex: 1;
  font-weight: 500;
  font-size: .875rem;
}

.ama-quick-link-arrow {
  color: #d1d5db;
}

.ama-logout-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  padding: 10px;
  color: #ef4444;
  font-size: .875rem;
  text-decoration: none;
  border: 1px solid #fee2e2;
  border-radius: 8px;
  transition: background .15s;
}

.ama-logout-link:hover {
  background: #fff5f5;
}

/* ── Orders list ───────────────────────────────────────────── */
.ama-orders-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.ama-order-item {
  border-bottom: 1px solid #f3f4f6;
}

.ama-order-link {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  padding: 10px 0;
  gap: 8px;
  text-decoration: none;
  align-items: center;
}

.ama-order-id {
  font-weight: 700;
  color: #111827;
  font-size: .875rem;
}

.ama-order-date {
  font-size: .78rem;
  color: #6b7280;
}

.ama-order-status {
  font-size: .72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  text-align: center;
}

.ama-order-status.status-completed {
  background: #dcfce7;
  color: #166534;
}

.ama-order-status.status-processing {
  background: #dbeafe;
  color: #1e40af;
}

.ama-order-status.status-on-hold {
  background: #fef9c3;
  color: #92400e;
}

.ama-order-status.status-pending {
  background: #f3f4f6;
  color: #374151;
}

.ama-order-total {
  font-weight: 700;
  text-align: right;
  color: #111827;
  font-size: .875rem;
}

.ama-view-all-link {
  display: block;
  text-align: center;
  color: #2563eb;
  margin-top: 12px;
  font-size: .875rem;
  text-decoration: none;
  padding: 6px;
}

.ama-view-all-link:hover {
  text-decoration: underline;
}

/* ── Settings list ─────────────────────────────────────────── */
.ama-settings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.ama-settings-list a {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
  text-decoration: none;
  font-weight: 500;
  font-size: .875rem;
  transition: color .15s;
}

.ama-settings-list a:hover {
  color: #2563eb;
}

/* ── Empty state ───────────────────────────────────────────── */
.ama-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  gap: 12px;
  text-align: center;
  color: #9ca3af;
}

.ama-empty-state p {
  margin: 0;
  font-size: .875rem;
}

.ama-cta-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  background: #2563eb;
  color: #ffffff;
  border-radius: 999px;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 600;
  transition: background .2s;
}

.ama-cta-btn:hover {
  background: #1d4ed8;
}

/* ── Auth wrapper ──────────────────────────────────────────── */
.ama-auth {
  padding: 0 20px 20px;
  overflow-y: auto;
  flex: 1;
}

/* ── Auth tabs ─────────────────────────────────────────────── */
.ama-tabs {
  display: flex;
  flex-direction: row;
  position: relative;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 20px;
}

.ama-tab {
  flex: 1;
  padding: 12px 8px;
  background: none;
  border: none;
  font-weight: 600;
  color: #9ca3af;
  cursor: pointer;
  font-size: .875rem;
  font-family: inherit;
  transition: color .15s;
  position: relative;
}

.ama-tab.is-active {
  color: #2563eb;
}

.ama-tab:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.ama-tab-indicator {
  position: absolute;
  bottom: -2px;
  height: 2px;
  background: #2563eb;
  width: 50%;
  left: 0;
  transition: left .25s ease;
}

.ama-tabs:has(.ama-tab[data-tab="signup"].is-active) .ama-tab-indicator {
  left: 50%;
}

/* ── Forms ─────────────────────────────────────────────────── */
.ama-form {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.ama-form.is-active {
  display: flex;
}

.ama-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.ama-field input {
  padding: 10px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: .9rem;
  color: #111827;
  background: #ffffff;
  outline: none;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
  box-sizing: border-box;
}

.ama-field input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.ama-field--pass {
  position: relative;
}

.ama-field--pass input {
  padding-right: 40px;
}

.ama-toggle-pass {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color .15s;
}

.ama-toggle-pass:hover {
  color: #374151;
}

.ama-field-row {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.ama-field-row--cols {
  align-items: stretch;
}

.ama-field-row--cols .ama-field {
  flex: 1;
}

.ama-checkbox-label {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  font-size: .82rem;
  color: #374151;
  cursor: pointer;
  line-height: 1.4;
}

.ama-checkbox-label input[type="checkbox"] {
  width: auto;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: #2563eb;
}

.ama-checkbox-label a {
  color: #2563eb;
  text-decoration: none;
}

.ama-checkbox-label a:hover {
  text-decoration: underline;
}

.ama-forgot-link {
  font-size: .78rem;
  color: #2563eb;
  text-decoration: none;
  white-space: nowrap;
  margin-left: auto;
  line-height: 1.4;
}

.ama-forgot-link:hover {
  text-decoration: underline;
}

/* ── Password strength ─────────────────────────────────────── */
.ama-strength {
  height: 4px;
  border-radius: 2px;
  background: #e5e7eb;
  margin-top: -8px;
  transition: background .3s;
}

.ama-strength[data-level="1"] {
  background: linear-gradient(to right, #ef4444 25%, #e5e7eb 25%);
}

.ama-strength[data-level="2"] {
  background: linear-gradient(to right, #f97316 50%, #e5e7eb 50%);
}

.ama-strength[data-level="3"] {
  background: linear-gradient(to right, #eab308 75%, #e5e7eb 75%);
}

.ama-strength[data-level="4"] {
  background: #22c55e;
}

/* ── Submit button ─────────────────────────────────────────── */
.ama-btn {
  width: 100%;
  padding: 12px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: .9rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .2s, opacity .2s;
  position: relative;
}

.ama-btn:hover:not(:disabled) {
  background: #1d4ed8;
}

.ama-btn:disabled {
  opacity: .7;
  cursor: not-allowed;
}

.ama-btn-text {
  transition: opacity .15s;
}

.ama-btn.is-loading .ama-btn-text {
  opacity: 0;
}

.ama-btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: ama-spin .7s linear infinite;
  position: absolute;
}

.ama-btn.is-loading .ama-btn-spinner {
  display: block;
}

/* ── Messages ──────────────────────────────────────────────── */
.ama-msg {
  font-size: .82rem;
  padding: 10px 12px;
  border-radius: 8px;
  display: none;
  line-height: 1.4;
}

.ama-msg.is-error {
  display: block;
  background: #fee2e2;
  color: #991b1b;
}

.ama-msg.is-success {
  display: block;
  background: #dcfce7;
  color: #166534;
}

/* ── Mobile bottom-sheet ───────────────────────────────────── */
@media (max-width: 768px) {
  .ama-sheet {
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: 90dvh;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .ama-drawer-root[aria-hidden="false"] .ama-sheet {
    transform: translateY(0);
  }
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes ama-spin {
  to { transform: rotate(360deg); }
}

@keyframes ama-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ama-backdrop,
  .ama-sheet,
  .ama-trigger,
  .ama-tab-indicator,
  .ama-strength,
  .ama-btn {
    transition: none;
  }

  .ama-btn-spinner {
    animation: none;
    border-top-color: #ffffff;
  }

  @keyframes ama-spin {
    to { transform: none; }
  }
}
