/* iPhone-inspired profile modal sheet */
html {
  scrollbar-gutter: stable;
}

body.modal-open {
  overflow: hidden;
}

@supports (-webkit-touch-callout: none) {
  body.modal-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.24);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease, background 0.28s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-content {
  width: 100%;
  max-width: 100%;
}

.bottom-sheet-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.16);
  max-height: 90vh;
  z-index: 1101;
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease;
  pointer-events: none;
  will-change: transform;
  touch-action: pan-y;
  padding-bottom: calc(env(safe-area-inset-bottom, 16px) + 8px);
}

.bottom-sheet-modal.show {
  pointer-events: auto;
  transform: translateY(0);
  box-shadow: 0 -20px 64px rgba(0, 0, 0, 0.18);
}

@media (min-width: 992px) {
  .modal-overlay {
    align-items: center;
    justify-content: center;
  }

  .bottom-sheet-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: 480px;
    max-width: 92vw;
    max-height: 85vh;
    height: auto;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(102, 126, 234, 0.1);
    overflow: hidden;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease, box-shadow 0.28s ease;
  }

  .bottom-sheet-modal.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
  }

  .modal-overlay.show {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .sheet-handle {
    display: none;
  }
}

.sheet-handle {
  width: 46px;
  height: 5px;
  background: rgba(140, 146, 172, 0.35);
  border-radius: 999px;
  margin: 12px auto 6px;
  transition: background 0.2s ease;
}

.sheet-handle:hover {
  background: rgba(140, 146, 172, 0.55);
}

.sheet-header {
  padding: 18px 20px 16px;
  background: rgba(248, 249, 252, 0.95);
  border-bottom: 1px solid rgba(232, 234, 241, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.sheet-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

.sheet-close-btn {
  background: rgba(255, 255, 255, 0.86);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.sheet-close-btn:hover {
  background: rgba(243, 244, 246, 0.95);
  transform: scale(1.04);
}

.sheet-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 14px 10px;
  background: transparent;
  border-bottom: 1px solid rgba(229, 231, 235, 0.95);
  overflow-x: auto;
}

.sheet-tab-btn {
  flex: 1;
  min-width: 96px;
  padding: 11px 14px;
  border-radius: 999px;
  border: none;
  background: rgba(243, 244, 246, 0.95);
  color: #4b5563;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.sheet-tab-btn.active {
  background: #eff6ff;
  color: #1d4ed8;
}

.sheet-tab-btn:hover {
  background: rgba(226, 232, 240, 0.95);
}

.sheet-content {
  padding: 12px 0 8px;
}

.sheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  color: #111827;
  text-decoration: none;
  background: transparent;
  border: none;
  border-radius: 18px;
  font-size: 0.96rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.sheet-item + .sheet-item {
  margin-top: 8px;
}

.sheet-item:hover {
  background: rgba(226, 232, 240, 0.9);
  transform: translateX(1px);
}

.sheet-item i {
  margin-right: 14px;
  width: 20px;
  min-width: 20px;
  text-align: center;
  color: #2563eb;
}

.sheet-item.text-danger {
  color: #111827;
}

.sheet-item.text-danger:hover {
  background: rgba(254, 226, 226, 0.9);
  color: #b91c1c;
}

.sheet-item.text-danger i {
  color: #b91c1c;
}

.sheet-empty {
  padding: 16px 20px;
  color: #6b7280;
}

@media (min-width: 992px) {
  .sheet-header {
    padding: 20px 24px 18px;
  }

  .sheet-tabs {
    padding: 12px 16px 12px;
  }

  .sheet-item {
    padding: 18px 22px;
  }
}

@media (max-width: 991px) {
  .sheet-header {
    padding: 16px 18px 14px;
  }

  .sheet-close-btn {
    width: 34px;
    height: 34px;
  }

  .sheet-tabs {
    padding: 10px 14px;
  }

  .sheet-tab-btn {
    padding: 10px 12px;
    font-size: 0.86rem;
  }

  .bottom-sheet-modal {
    max-height: 92vh;
  }
}
