/* Initial sheet styling drafted by DeepSeek; reviewed and adapted by Codex below. */
/* frontend/src/profile.css — proposed CSS only (class contract as given) */

.profile-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 390px;
  height: auto;
  max-height: calc(100dvh - 35px);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: #334155;
  transform: translate(-50%, 100%);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transition: transform 250ms ease-out;
  z-index: 1000;
  box-sizing: border-box;
}

.profile-sheet[open],
.profile-sheet.is-open {
  transform: translate(-50%, 0);
}

.profile-sheet-content {
  position: relative;
  width: 100%;
  height: 809px;
  min-height: 100%;
  background: #ffffff;
  box-sizing: border-box;
}

/* handle 175,10 40x5 */
.profile-handle {
  position: absolute;
  left: 175px;
  top: 10px;
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: #cbd5e1;
}

/* title 21,30 font28 */
.profile-sheet-title {
  position: absolute;
  left: 21px;
  top: 30px;
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
  color: #1e293b;
}

/* avatar 161,81 64x64 pale blue */
.profile-sheet-avatar {
  position: absolute;
  left: 161px;
  top: 81px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #dbeafe;
  object-fit: cover;
}

/* note 152,155 */
.profile-avatar-note {
  position: absolute;
  left: 152px;
  top: 155px;
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
  color: #64748b;
}

/* nickname label 21,178 */
.profile-nickname-label {
  position: absolute;
  left: 21px;
  top: 178px;
  font-size: 13px;
  line-height: 1.2;
  color: #475569;
}

/* nickname input 21,207 350x45 */
.profile-nickname-input {
  position: absolute;
  left: 21px;
  top: 207px;
  width: 350px;
  height: 45px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 15px;
  outline: none;
}

/* ID label 21,275 */
.profile-id-label {
  position: absolute;
  left: 21px;
  top: 275px;
  font-size: 13px;
  line-height: 1.2;
  color: #475569;
}

/* ID input 21,304 350x45 */
.profile-id-input {
  position: absolute;
  left: 21px;
  top: 304px;
  width: 350px;
  height: 45px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 15px;
  outline: none;
}

/* readonly hint 319,334 */
.profile-readonly-note {
  position: absolute;
  left: 21px;
  top: 334px;
  width: 350px;
  margin: 0;
  font-size: 11px;
  line-height: 1.3;
  color: #94a3b8;
  text-align: right;
}

/* cancel 11,667 165x44 */
.profile-cancel {
  position: absolute;
  left: 11px;
  top: 667px;
  width: 165px;
  height: 44px;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
  font-size: 16px;
  cursor: pointer;
}

/* save 206,667 165x44 muted teal */
.profile-save {
  position: absolute;
  left: 206px;
  top: 667px;
  width: 165px;
  height: 44px;
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #5f9ea0;
  color: #ffffff;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.profile-save:disabled {
  background: #a8c9ca;
  cursor: not-allowed;
}

/* error — placed below ID field area, above bottom buttons */
.profile-error {
  position: absolute;
  left: 21px;
  top: 358px;
  width: 350px;
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  color: #dc2626;
}

/* narrowed viewport: keep proportions with percentage-based width for inputs/buttons */
@media (max-width: 389px) {
  .profile-sheet-content {
    height: auto;
    min-height: 809px;
  }
  .profile-nickname-input,
  .profile-id-input {
    left: 21px;
    width: calc(100% - 42px);
  }
  .profile-readonly-note {
    left: 21px;
    width: calc(100% - 42px);
  }
  .profile-error {
    left: 21px;
    width: calc(100% - 42px);
  }
  .profile-sheet-avatar {
    left: 50%;
    transform: translateX(-50%);
  }
  .profile-avatar-note {
    left: 0;
    width: 100%;
    text-align: center;
  }
  .profile-handle {
    left: 50%;
    transform: translateX(-50%);
  }
  .profile-cancel {
    left: 8px;
    width: calc(50% - 14px);
  }
  .profile-save {
    left: auto;
    right: 8px;
    width: calc(50% - 14px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-sheet {
    transition: none;
  }
}

/* Integration corrections: native dialog starts at display:none, so an enter
   animation is needed; a transform transition alone would not animate showModal. */
.profile-sheet {
  inset: auto auto 0 50%;
  width: min(390px, 100vw);
  max-width: 390px;
  height: 809px;
  max-height: calc(100dvh - 35px);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -12px 48px #18382d20;
  transform: translate(-50%, 0);
}
.profile-sheet[open] { animation: profile-enter 250ms ease-out both; }
.profile-sheet::backdrop { background: #182e294d; backdrop-filter: none; }
@keyframes profile-enter {
  from { transform: translate(-50%, 100%); }
  to { transform: translate(-50%, 0); }
}
.profile-sheet .profile-nickname-label,
.profile-sheet .profile-id-label { font-size: 18px; line-height: 21px; font-weight: 400; }
.profile-sheet .profile-nickname-input,
.profile-sheet .profile-id-input { font-size: 20px; margin: 0; }
.profile-sheet .profile-id-input { padding-right: 78px; }
.profile-sheet .profile-readonly-note { top: 334px; right: 19px; left: auto; width: 70px; font-size: 12px; pointer-events: none; }
.profile-nickname-help { position: absolute; top: 258px; left: 21px; font-size: 10px; color: #758579; }
.profile-sheet .profile-avatar-note { left: 0; width: 100%; text-align: center; font-size: 12px; }
.profile-sheet .profile-cancel,
.profile-sheet .profile-save { font-size: 20px; }
.profile-save { background: #317968; }
.profile-save:hover:not(:disabled) { background: #256454; }
.profile-cancel:hover:not(:disabled) { background: #e6eeea; }
.profile-sheet input:focus-visible,
.profile-sheet button:focus-visible { outline: 3px solid #82baa7; outline-offset: 3px; }
.profile-sheet .profile-id-input:focus-visible { outline: 2px solid #b9c7c1; }
.profile-sheet input:disabled { opacity: .7; }
.profile-sheet button:disabled { cursor: wait; opacity: .7; }
.profile-error { min-height: 20px; padding-right: 12px; }
.profile-phone { width: min(390px, 100%); min-height: min(844px, 100dvh); position: relative; margin: 0 auto; background: #fff; color: #283c36; }
.profile-avatar-button { position: absolute; left: calc(50% - 30px); top: 35px; width: 60px; height: 60px; padding: 0; border: 0; border-radius: 50%; background: #e8eef5; }
.profile-avatar-button img { display: block; width: 60px; height: 60px; }
.profile-avatar-button:hover { box-shadow: 0 0 0 5px #ecf5f0; }
.profile-details { position: absolute; left: 21px; top: 123px; width: calc(100% - 42px); height: 84px; padding: 0; text-align: left; border: 0; border-radius: 10px; background: transparent; color: inherit; }
.profile-details:hover { background: #f5f9f6; }
.profile-nickname-row, .profile-id-row { position: absolute; left: 17px; max-width: calc(100% - 34px); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-nickname-row { top: 14px; font-size: 16px; line-height: 21px; }
.profile-nickname-row b { font-weight: 500; }
.profile-id-row { top: 46px; font-size: 14px; line-height: 19px; color: #60736b; }
.profile-edit-hint { position: absolute; top: 223px; left: 38px; margin: 0; font-size: 12px; color: #7a8b83; }
.profile-demo-note { position: absolute; top: 254px; left: 38px; font-size: 12px; color: #936b39; }
.profile-account-actions { position: absolute; top: 340px; left: 38px; right: 38px; display: flex; justify-content: space-between; font-size: 13px; }
.profile-account-actions button { border: 0; padding: 0; background: none; color: #71877c; }
.profile-view .content { padding: 0; }
.profile-view .topbar, .profile-view .page-heading, .profile-view .page-footer, .profile-view .demo-strip { display: none; }
@media (max-width:760px) {
  /* The prototype's profile canvas starts at y=0; move existing navigation to
     the bottom only for this view instead of offsetting its measured geometry. */
  .profile-view .sidebar { position: fixed; inset: auto auto 0 50%; transform: translateX(-50%); width: min(390px,100%); padding: 0 12px env(safe-area-inset-bottom); border-top: 1px solid #e8eee9; z-index: 10; }
  .profile-view .sidebar .brand { display: none; }
  .profile-view .sidebar nav { margin: 0; gap: 8px; justify-content: space-around; }
  .profile-view .sidebar nav a, .profile-view .sidebar nav button { font-size: 11px; padding: 17px 0; }
  .sidebar nav { flex-wrap: wrap; }
  .profile-view .workspace { margin: 0; }
  .profile-view .content { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .profile-sheet[open] { animation: none; }
}
