/* ============================================
   VORTEX ACCOUNT PAGE - CLEAN MODERN REFRESH
   ============================================ */

/* The shared stylesheet adds a decorative gradient layer on body.
   Disable it on this page to keep the account UI clean and neutral. */
body::before {
  display: none !important;
}

.page {
  min-height: 100vh;
  background: var(--paper);
  overflow-x: clip;
}

.account-main {
  padding: 34px 24px 72px;
}

.account-container {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  grid-template-areas:
    "intro intro"
    "profile settings"
    "logout settings";
}

.account-intro,
.profile-card,
.settings-card,
.logout-section {
  background: var(--surface);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(20, 19, 32, 0.05);
}

[data-theme="dark"] .account-intro,
[data-theme="dark"] .profile-card,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .logout-section {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.account-intro,
.profile-card,
.settings-card,
.logout-section {
  animation: cardIn 0.32s ease both;
}

.account-intro {
  grid-area: intro;
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.account-intro-copy {
  max-width: 700px;
}

.account-eyebrow {
  margin: 0 0 8px;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.account-intro-copy h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.45rem, 1.1rem + 1.35vw, 2.05rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.account-intro-copy p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.56;
}

.account-intro-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(83, 198, 183, 0.3);
  background: rgba(83, 198, 183, 0.09);
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.16);
}

.profile-card {
  grid-area: profile;
  border-top: 3px solid rgba(83, 198, 183, 0.6);
  overflow: hidden;
}

.profile-card-body {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 22px 18px;
}

.avatar-wrapper {
  position: relative;
  width: 92px;
  height: 92px;
  flex-shrink: 0;
}

.avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(83, 198, 183, 0.35);
}

.account-avatar {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent-3);
  border: 3px solid rgba(255, 255, 255, 0.96);
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: 0 8px 20px rgba(20, 19, 32, 0.12);
}

[data-theme="dark"] .account-avatar {
  border-color: rgba(20, 19, 32, 0.86);
}

.account-avatar.has-photo {
  color: transparent;
}

.avatar-status {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: #22c55e;
}

.profile-identity {
  min-width: 0;
}

.profile-identity h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.42rem;
  letter-spacing: -0.01em;
}

.profile-email {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  word-break: break-word;
}

.profile-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-tags .plan-badge {
  position: static;
  top: auto;
  left: auto;
  transform: none;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(83, 198, 183, 0.28);
  background: rgba(83, 198, 183, 0.1);
  color: #2a7e73;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  font-weight: 700;
  text-transform: uppercase;
}

[data-theme="dark"] .profile-tags .plan-badge {
  color: #7ce3d5;
  border-color: rgba(83, 198, 183, 0.42);
  background: rgba(83, 198, 183, 0.16);
}

.profile-stats {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.pstat {
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .pstat {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
}

.pstat:not(.quota-stat) {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.pstat-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  background: var(--accent-3);
}

.pstat-icon svg {
  stroke-width: 2.2;
}

.pstat-data {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pstat-data strong {
  margin: 0;
  color: var(--ink);
  font-size: 1.16rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.pstat-data > span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.71rem;
  font-weight: 600;
}

.quota-stat {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.quota-ring-wrap {
  display: grid;
  place-items: center;
  gap: 4px;
}

.quota-ring-wrap > span {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 700;
}

.quota-ring {
  width: 74px;
  height: 74px;
  transform: rotate(-90deg);
}

.quota-ring-track,
.quota-ring-progress {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
}

.quota-ring-track {
  stroke: rgba(20, 19, 32, 0.1);
}

[data-theme="dark"] .quota-ring-track {
  stroke: rgba(255, 255, 255, 0.14);
}

.quota-ring-progress {
  stroke: var(--accent-3);
  transition: stroke-dashoffset 0.55s ease, stroke 0.2s ease;
}

.pstat-value-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.quota-bar {
  margin-top: 6px;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(20, 19, 32, 0.1);
}

[data-theme="dark"] .quota-bar {
  background: rgba(255, 255, 255, 0.14);
}

.quota-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent-3);
  transition: width 0.55s ease, background 0.2s ease;
}

.quota-warning {
  font-size: 0.68rem;
  font-weight: 700;
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}

.quota-warning:empty {
  display: none;
}

.settings-card {
  grid-area: settings;
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  background: rgba(20, 19, 32, 0.02);
}

[data-theme="dark"] .card-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.card-title-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.card-title-group svg {
  margin-top: 2px;
  color: var(--accent-3);
  stroke-width: 2;
}

.card-title-group h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.16rem;
  letter-spacing: -0.01em;
}

.card-title-group p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.settings-status {
  min-height: 26px;
  max-width: min(320px, 100%);
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 0.77rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: right;
  transition: opacity 0.2s ease;
}

.settings-status.success {
  color: #166534;
  border: 1px solid rgba(34, 197, 94, 0.24);
  background: rgba(34, 197, 94, 0.12);
}

.settings-status.error {
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.24);
  background: rgba(239, 68, 68, 0.12);
}

.settings-status.info {
  color: #0f766e;
  border: 1px solid rgba(83, 198, 183, 0.26);
  background: rgba(83, 198, 183, 0.12);
}

.profile-form {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--ink);
}

.field-group label svg {
  color: var(--accent-3);
  stroke-width: 2.2;
}

.field-group input[type="text"],
.field-group input[type="email"] {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border-radius: 12px;
  border: 1px solid var(--border-default);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.93rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

[data-theme="dark"] .field-group input[type="text"],
[data-theme="dark"] .field-group input[type="email"] {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.16);
}

.field-group input[type="text"]:hover,
.field-group input[type="email"]:hover {
  border-color: rgba(20, 19, 32, 0.2);
}

[data-theme="dark"] .field-group input[type="text"]:hover,
[data-theme="dark"] .field-group input[type="email"]:hover {
  border-color: rgba(255, 255, 255, 0.24);
}

.field-group input[type="text"]:focus,
.field-group input[type="email"]:focus {
  outline: none;
  border-color: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(83, 198, 183, 0.22);
}

.field-group input:disabled {
  opacity: 0.68;
  cursor: not-allowed;
}

.input-with-icon {
  position: relative;
}

.input-with-icon input {
  padding-right: 38px;
}

.field-lock {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  opacity: 0.62;
  pointer-events: none;
}

.avatar-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed rgba(83, 198, 183, 0.42);
  background: rgba(83, 198, 183, 0.08);
}

[data-theme="dark"] .avatar-upload-row {
  border-color: rgba(83, 198, 183, 0.52);
  background: rgba(83, 198, 183, 0.16);
}

.avatar-upload-row input[type="file"] {
  display: none;
}

.upload-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 15px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 600;
  color: #fff;
  font-family: inherit;
  background: #359f92;
  transition: background 0.18s ease, transform 0.18s ease;
}

.upload-btn:hover {
  background: #2f8f84;
  transform: translateY(-1px);
}

.upload-btn:active {
  transform: translateY(0);
}

.upload-hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.75rem;
}

.upload-progress {
  display: none;
  margin-top: 6px;
  padding: 12px;
  border-radius: 11px;
  border: 1px solid rgba(83, 198, 183, 0.2);
  background: rgba(83, 198, 183, 0.08);
}

.upload-progress.visible {
  display: block;
  animation: fadeSlide 0.2s ease;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(20, 19, 32, 0.1);
}

[data-theme="dark"] .progress-track {
  background: rgba(255, 255, 255, 0.14);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #359f92;
  transition: width 0.28s ease;
}

.progress-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 600;
}

.save-btn {
  margin-top: 4px;
  width: 100%;
  min-height: 46px;
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: #359f92;
  transition: background 0.18s ease, transform 0.18s ease, opacity 0.2s ease;
}

.save-btn:hover:not(:disabled) {
  background: #2f8f84;
  transform: translateY(-1px);
}

.save-btn:active:not(:disabled) {
  transform: translateY(0);
}

.save-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.logout-section {
  grid-area: logout;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.logout-copy h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink);
}

.logout-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.logout-btn {
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  min-height: 40px;
  padding: 9px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.13);
  border-color: rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.footer {
  padding: 26px 20px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

/* ============================================
   CROP MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 19, 32, 0.58);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.crop-modal {
  width: min(440px, calc(100vw - 34px));
  padding: 24px;
  border-radius: 18px;
  border: 1px solid var(--border-default);
  background: var(--surface);
  box-shadow: 0 20px 42px rgba(20, 19, 32, 0.24);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.24s ease;
}

.modal-overlay.show .crop-modal {
  transform: scale(1) translateY(0);
}

[data-theme="dark"] .crop-modal {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.36);
}

.modal-header {
  text-align: center;
  margin-bottom: 16px;
}

.modal-header strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 1.16rem;
}

.modal-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.avatar-cropper {
  position: relative;
  margin-bottom: 16px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-default);
  background: rgba(20, 19, 32, 0.04);
  cursor: move;
  touch-action: none;
}

[data-theme="dark"] .avatar-cropper {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

#avatarCropCanvas {
  display: block;
  width: 100%;
  height: auto;
}

.cropper-guide {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
}

.guide-circle {
  width: 206px;
  height: 206px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.58);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
}

.crop-controls {
  margin-bottom: 16px;
}

.crop-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crop-zoom svg {
  color: var(--accent-3);
  flex-shrink: 0;
}

.crop-zoom input[type="range"] {
  flex: 1;
  appearance: none;
  height: 5px;
  border-radius: 999px;
  background: rgba(20, 19, 32, 0.12);
  outline: none;
}

[data-theme="dark"] .crop-zoom input[type="range"] {
  background: rgba(255, 255, 255, 0.16);
}

.crop-zoom input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: #359f92;
  cursor: pointer;
}

.crop-zoom input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: #359f92;
  cursor: pointer;
}

.crop-zoom span:last-child {
  width: 46px;
  text-align: right;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.btn-cancel,
.btn-confirm {
  flex: 1;
  min-height: 42px;
  border-radius: 11px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.btn-cancel {
  background: rgba(20, 19, 32, 0.08);
  color: var(--ink-2);
}

.btn-cancel:hover {
  background: rgba(20, 19, 32, 0.14);
}

[data-theme="dark"] .btn-cancel {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .btn-cancel:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn-confirm {
  color: #fff;
  background: #359f92;
}

.btn-confirm:hover {
  background: #2f8f84;
  transform: translateY(-1px);
}

/* ============================================
   INTERACTION
   ============================================ */
input:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(83, 198, 183, 0.26);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1020px) {
  .account-main {
    padding: 28px 18px 64px;
  }

  .account-container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "profile"
      "settings"
      "logout";
  }

  .account-intro {
    flex-direction: column;
    align-items: flex-start;
  }

  .account-intro-chip {
    white-space: normal;
  }

  .logout-section {
    flex-direction: column;
    align-items: flex-start;
  }

  .logout-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .account-main {
    padding: 20px 14px 56px;
  }

  .account-intro,
  .profile-card,
  .settings-card,
  .logout-section {
    border-radius: 16px;
  }

  .account-intro {
    padding: 18px;
  }

  .account-intro-copy h1 {
    font-size: 1.4rem;
  }

  .profile-card-body {
    flex-direction: column;
    text-align: center;
    padding: 20px 18px 16px;
  }

  .profile-email {
    margin-bottom: 10px;
  }

  .profile-tags {
    justify-content: center;
  }

  .profile-stats {
    padding: 0 14px 14px;
  }

  .quota-stat {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .pstat-data {
    width: 100%;
    align-items: center;
  }

  .pstat-value-row {
    justify-content: center;
  }

  .card-header {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-status {
    text-align: left;
  }

  .profile-form {
    padding: 16px;
    gap: 15px;
  }

  .avatar-upload-row {
    align-items: flex-start;
  }

  .upload-hint {
    margin-left: 0;
  }

  .crop-modal {
    padding: 18px;
  }

  .guide-circle {
    width: 182px;
    height: 182px;
  }

  .modal-actions {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
