/* ============================================================
   ACCOUNT SETTINGS MODAL
   Matches website design: clean-modal-overlay pattern,
   Alexandria/Manrope fonts, #ee9f0d orange accent
   ============================================================ */

/* ── OVERLAY (matches .clean-modal-overlay exactly) ── */
#accountSettingsModal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  direction: ltr;
}

#accountSettingsModal.as-open {
  opacity: 1;
  visibility: visible;
}

/* ── MODAL BOX ── */
.as-modal-box {
  background: #ffffff;
  width: 95%;
  max-width: 720px; /* Increased for horizontal layout */
  border-radius: 28px;
  padding: 0; /* Handled by internal layout */
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: translateY(20px);
  opacity: 0;
  transition:
    transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.3s ease;
  overflow: hidden;
}

#accountSettingsModal.as-open .as-modal-box {
  transform: translateY(0);
  opacity: 1;
}

/* ── CLOSE BUTTON ── */
.as-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 32px;
  height: 32px;
  background: #f3f4f6;
  color: #6b7280;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  z-index: 100;
}

.as-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  transform: rotate(90deg);
}

/* ── LAYOUT WRAPPER ── */
.as-layout-wrapper {
  display: flex;
  height: 100%;
  min-height: 480px;
}

/* ── SIDEBAR NAVIGATION ── */
.as-sidebar {
  width: 260px;
  background: #f9fafb;
  border-right: 1px solid #f1f5f9;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
}

.as-modal-header {
  margin-bottom: 25px;
  text-align: left;
}

.as-modal-header h3 {
  font-family: "Alexandria", serif;
  color: #ee9f0d;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
}

.as-modal-header p {
  font-family: "Manrope", sans-serif;
  color: #9ca3af;
  font-size: 0.82rem;
  margin: 2px 0 0;
}

.as-nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.as-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.as-nav-item:hover {
  background: #f1f5f9;
}

.as-nav-item.as-active {
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transform: translateX(5px);
}

.as-nav-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.as-nav-icon.email-icon { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.as-nav-icon.password-icon { background: rgba(238, 159, 13, 0.12); color: #ee9f0d; }

.as-nav-text h4 {
  font-family: "Manrope", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #4b5563;
  margin: 0;
}

.as-nav-text p {
  font-family: "Manrope", sans-serif;
  font-size: 0.72rem;
  color: #9ca3af;
  margin: 0;
}

.as-nav-item.as-active .as-nav-text h4 { color: #1f2937; }

/* ── MAIN CONTENT AREA ── */
.as-main-content {
  flex: 1;
  padding: 35px 40px;
  position: relative;
  background: #ffffff;
}

.as-content-panel {
  display: none;
  animation: asPanelFadeIn 0.4s ease forwards;
}

.as-content-panel.as-active {
  display: block;
}

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

.as-panel-header {
  margin-bottom: 25px;
}

.as-panel-header h3 {
  font-family: "Alexandria", serif;
  color: #1f2937;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.as-panel-header p {
  font-family: "Manrope", sans-serif;
  color: #6b7280;
  font-size: 0.85rem;
  margin: 5px 0 0;
}

.as-form-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── FLOATING LABEL INPUT (matching .input-box from login.css) ── */
.as-field {
  position: relative;
  margin-bottom: 1.25rem;
}

.as-field input {
  width: 100%;
  padding: 1rem 2.8rem 1rem 1rem;
  font-size: 0.95rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  color: #333333;
  font-family: "Rubik", sans-serif;
  line-height: 1.5;
  box-sizing: border-box;
  direction: ltr;
  text-align: left;
}

.as-field input:focus {
  border-color: #ee9f0d;
  box-shadow: 0 0 0 4px rgba(238, 159, 13, 0.1);
}

.as-field input[readonly] {
  background-color: #f9fafb;
  color: #6b7280;
  border-color: #e5e7eb;
  cursor: not-allowed;
}

.as-field input[readonly]:focus {
  border-color: #e5e7eb;
  box-shadow: none;
}

.as-field label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: #ffffff;
  padding: 0 0.4rem;
  color: #666666;
  font-size: 0.88rem;
  font-family: "Rubik", sans-serif;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 1;
  direction: ltr;
}

/* Floating label active state */
.as-field input:focus + label,
.as-field input:not(:placeholder-shown) + label {
  top: 1px;
  transform: translateY(-50%) scale(0.85);
  color: #ee9f0d;
  font-weight: 600;
}

/* ── PASSWORD TOGGLE (matching login.css .password-toggle) ── */
.as-pw-toggle {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #666666;
  padding: 0.4rem;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.as-pw-toggle:hover {
  background: rgba(238, 159, 13, 0.1);
  color: #ee9f0d;
}

.as-pw-toggle svg {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

.as-pw-toggle:active svg {
  transform: scale(0.9);
}

/* ── SUBMIT BUTTON (matches .submit.btn-ripple) ── */
.as-submit-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  letter-spacing: 0.3px;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
  background: linear-gradient(135deg, #ee9f0d 0%, #ff6a00 50%, #f8a203 100%);
  box-shadow:
    0 8px 25px rgba(238, 159, 13, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.3);
  margin-top: 4px;
}

.as-submit-btn:hover:not(:disabled) {
  box-shadow:
    0 12px 35px rgba(238, 159, 13, 0.4),
    0 0 20px rgba(238, 159, 13, 0.3);
  filter: brightness(1.06) saturate(1.1);
}

.as-submit-btn:active:not(:disabled) {
  opacity: 0.9;
  transition: all 0.08s ease;
}

.as-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: linear-gradient(135deg, #ccc 0%, #aaa 100%);
}

/* Ripple */
.as-submit-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%);
  transition:
    width 0.6s,
    height 0.6s;
}
.as-submit-btn:active:not(:disabled)::after {
  width: 300px;
  height: 300px;
}

/* Button spinner */
.as-btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: as-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes as-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── TOAST SYSTEM ── */
#asToastContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.as-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 16px;
  min-width: 290px;
  max-width: 360px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid #f1f5f9;
  pointer-events: all;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.as-toast.as-toast-show {
  transform: translateX(0);
}
.as-toast.as-toast-hide {
  transform: translateX(120%);
  transition: transform 0.3s ease-in;
}

.as-toast-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.as-toast.as-toast-success {
  border-left: 3px solid #10b981;
}
.as-toast.as-toast-success .as-toast-icon {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.as-toast.as-toast-error {
  border-left: 3px solid #ef4444;
}
.as-toast.as-toast-error .as-toast-icon {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.as-toast.as-toast-info {
  border-left: 3px solid #3b82f6;
}
.as-toast.as-toast-info .as-toast-icon {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.as-toast-body {
  flex: 1;
}
.as-toast-title {
  font-family: "Manrope", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 2px;
}
.as-toast-msg {
  font-family: "Manrope", sans-serif;
  font-size: 0.78rem;
  color: #6b7280;
  font-weight: 500;
  margin: 0;
  line-height: 1.4;
}
.as-toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 0.8rem;
  padding: 2px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}
.as-toast-close:hover {
  color: #1f2937;
}

/* ── INLINE NAME EDIT (pencil icon in dropdown) ── */
.dropdown-name-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.edit-name-pencil-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 0.68rem;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  transition:
    color 0.2s ease,
    background 0.2s ease;
  flex-shrink: 0;
}

.edit-name-pencil-btn:hover {
  color: #ee9f0d;
  background: rgba(238, 159, 13, 0.1);
}

.edit-name-input-wrapper {
  display: none;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.edit-name-input-wrapper.show {
  display: flex;
}

.edit-name-inline-input {
  flex: 1;
  font-family: "Manrope", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #1f2937;
  border: 1.5px solid #ee9f0d;
  border-radius: 7px;
  padding: 3px 8px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(238, 159, 13, 0.1);
  background: #fffbf0;
  min-width: 0;
  width: 100%;
}

.edit-name-save-btn,
.edit-name-cancel-btn {
  border: none;
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.edit-name-save-btn {
  background: rgba(16, 185, 129, 0.14);
  color: #10b981;
}
.edit-name-save-btn:hover {
  background: rgba(16, 185, 129, 0.22);
  color: #10b981;
}
.edit-name-save-btn:active {
  background: rgba(16, 185, 129, 0.32);
  color: #059669;
}

.edit-name-cancel-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.edit-name-cancel-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
}
.edit-name-cancel-btn:active {
  background: rgba(239, 68, 68, 0.28);
  color: #dc2626;
}

/* ── FORGOT PASSWORD LINK (Premium Sync) ── */
.as-forgot-password-link {
  color: #64748b;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.3s ease;
  display: inline-block;
  position: relative;
  padding: 6px 12px;
  border-radius: 10px;
  background: transparent;
  z-index: 1;
}

.as-forgot-password-link::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ee9f0d;
  opacity: 0;
  border-radius: 10px;
  z-index: -1;
  transition: all 0.3s ease;
  transform: scale(0.92);
}

.as-forgot-password-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: #ee9f0d;
  border-radius: 4px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.as-forgot-password-link:hover {
  color: #d48c0c;
}

.as-forgot-password-link:hover::before {
  opacity: 0.08;
  transform: scale(1);
}

.as-forgot-password-link:hover::after {
  width: 20px;
}

.as-forgot-password-link:active {
  transform: translateY(1px);
}

/* ── COPY EMAIL BUTTON ── */
.copy-email-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 0.65rem;
  padding: 3px 4px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    color 0.2s ease,
    background 0.2s ease;
  flex-shrink: 0;
  vertical-align: middle;
  position: relative;
}
.copy-email-btn:hover {
  color: #ee9f0d;
  background: rgba(238, 159, 13, 0.1);
}
.copy-email-btn.copied {
  color: #10b981;
}

.copy-email-tooltip {
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  font-size: 0.65rem;
  font-family: "Manrope", sans-serif;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 100;
}
.copy-email-btn.copied .copy-email-tooltip {
  opacity: 1;
}

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

.as-name-spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  border-top-color: #10b981;
  border-radius: 50%;
  animation: as-spin 0.8s linear infinite;
}

/* ── MOBILE RESPONSIVENESS ── */
@media (max-width: 768px) {
  .as-modal-box {
    max-width: 500px;
  }
  
  .as-layout-wrapper {
    flex-direction: column;
    min-height: auto;
  }
  
  .as-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #f1f5f9;
    padding: 25px 20px;
  }
  
  .as-nav-list {
    flex-direction: row;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
  }
  
  .as-nav-item {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
  }
  
  .as-nav-item.as-active {
    transform: none;
  }
  
  .as-main-content {
    padding: 25px 20px;
  }
}

@media (max-width: 600px) {
  #accountSettingsModal {
    align-items: flex-end;
    padding: 0;
  }

  .as-modal-box {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 24px 24px 0 0 !important;
    transform: translateY(100%);
    opacity: 1;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
  }

  .as-layout-wrapper {
    flex: 1;
    overflow-y: auto;
  }

  #accountSettingsModal.as-open .as-modal-box {
    transform: translateY(0);
    opacity: 1;
  }

  .as-close-btn {
    top: 15px;
    right: 15px;
  }
}

@media (max-width: 380px) {
  .as-modal-header h3 {
    font-size: 1.15rem;
  }
  .as-card-text h4 {
    font-size: 0.88rem;
  }
}

/* ── INLINE FEEDBACK ── */
.as-feedback {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
  animation: asFeedbackIn 0.3s ease forwards;
  line-height: 1.5;
  text-align: center;
}
.as-feedback i {
  margin-right: 6px;
}
.as-feedback.success {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
  border: 1px solid #28a745;
}
.as-feedback.error {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  border: 1px solid #dc3545;
}
