/* Ported styles from Laravel Blade (Tailwind-like logic) */
.profile-shell {
    max-width: 100%;
    margin-inline: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    /* Fill available page height — removes empty white space below content */
    min-height: calc(100vh - 130px);
    flex: 1;
}

/* Strip the section-wrap card styling for the profile page */
.section-wrap.profile-shell {
    padding: clamp(0.5rem, 1vw, 0.75rem);
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Pass height down to profile-shell when inside sidebar or top-nav layouts */
.sd-content:has(.profile-shell),
.dash-main:has(.profile-shell) {
    display: flex;
    flex-direction: column;
}

.profile-head {
    margin-bottom: 0.5rem;
}

.profile-head h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 900;
    color: #2d2333;
}

.profile-head p {
    color: #8c7895;
    font-size: 0.95rem;
}

/* Profile Hero - Matching Laravel Component */
.profile-hero-wrap {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(to right, #fdf7fb, #ffffff);
    border: 1px solid #f2ebf4;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(73, 20, 52, 0.03);
    margin-bottom: 2rem;
}

.profile-avatar-box {
    position: relative;
}

.profile-avatar-main {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #ad246d;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 900;
    border: 4px solid #fff;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
    overflow: hidden;
}

.profile-avatar-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #ad246d;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.profile-info-main h2 {
    font-size: 1.8rem;
    font-weight: 900;
    color: #ad246d;
    margin-bottom: 0.25rem;
}

.role-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #fdf7fb;
    color: #ad246d;
    font-size: 0.75rem;
    font-weight: 900;
    border-radius: 999px;
    border: 1px solid #f2ebf4;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Layout Grid */
.profile-grid-main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.profile-details-card {
    background: #fff;
    border: 1px solid #f2ebf4;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f2ebf4;
}

.card-title-row i {
    font-size: 1.5rem;
    color: #ad246d;
}

.card-title-row h2 {
    font-size: 1.25rem;
    font-weight: 900;
    color: #1f2937;
    letter-spacing: -0.025em;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #ad246d;
    margin-bottom: 0.65rem;
    display: block;
}

.detail-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #374151;
}

.bio-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f2ebf4;
}

.bio-text {
    font-size: 0.875rem;
    color: #5d4d62;
    line-height: 1.625;
    font-style: italic;
}

/* Sidebar */
.profile-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.referral-card-new {
    background: #fff;
    border: 1px solid #f2ebf4;
    border-radius: 20px;
    padding: 1.5rem;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}

.referral-card-new .bg-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 3.75rem;
    color: #ad246d;
    opacity: 0.1;
}

.referral-code-box {
    background: #fdf7fb;
    border: 1px solid #ead7e8;
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
}

.referral-code-text {
    display: block;
    font-size: 1.5rem;
    font-weight: 900;
    color: #ad246d;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.referral-subtext {
    font-size: 10px;
    font-weight: 700;
    color: #8c7895;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stats-card {
    background: linear-gradient(to bottom right, #ad246d, #cf2f84);
    border-radius: 20px;
    padding: 1.5rem;
    color: #fff;
    box-shadow: 0 10px 15px -3px rgba(173, 36, 109, 0.1);
}

.stats-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stats-title-row h3 {
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-line {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 1rem;
}

.stat-line:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255,255,255,0.8);
}

.stat-value {
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 18, 36, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center; /* Center vertically */
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
    border: 1px solid #f2ebf4;
    overflow: hidden; /* Prevent content from spilling out */
    position: relative;
    max-height: 90vh; /* Keep it within the viewport */
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem 2rem 1rem 2rem;
    border-bottom: 1px solid #f2ebf4; /* Add border for separation */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    flex-shrink: 0;
    z-index: 10;
}

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1f2937; /* Clean dark text */
    margin: 0;
}

.modal-close-btn {
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    color: #4b5563;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

.details-grid-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-input-premium {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0.7rem 0.95rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1f2937;
    font-family: inherit;
    transition: all 0.15s ease;
    background-color: #fff;
}

.form-input-premium:focus {
    border-color: #ad246d;
    outline: none;
    box-shadow: 0 0 0 1px #ad246d;
}

.form-input-premium:disabled,
.form-input-premium[readonly] {
    background-color: #f9fafb;
    color: #6b7280;
    border-color: #e5e7eb;
    cursor: not-allowed;
}

.upload-zone-premium {
    position: relative;
    width: 100%;
}

.upload-input-hidden {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.upload-content-premium {
    padding: 0.85rem 1.25rem;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #fafafa;
    transition: all 0.2s ease;
}

.upload-zone-premium:hover .upload-content-premium {
    border-color: #ad246d;
    background: #fdf7fb;
}

.upload-content-premium i {
    font-size: 1.25rem;
    color: #ad246d;
}

.upload-content-premium span {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
}

.modal-body-scroll {
    overflow-y: auto; /* Enable inner scrolling */
    padding: 1.5rem 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* Increase gap slightly for better readability */
}

/* Custom Scrollbar for Premium Feel */
.modal-body-scroll::-webkit-scrollbar {
    width: 6px;
}

.modal-body-scroll::-webkit-scrollbar-track {
    background: #fafafa;
}

.modal-body-scroll::-webkit-scrollbar-thumb {
    background: #ead7e8;
    border-radius: 10px;
}

.modal-body-scroll::-webkit-scrollbar-thumb:hover {
    background: #ad246d;
}

.modal-actions-premium {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.25rem 2rem;
    border-top: 1px solid #f2ebf4; /* Add a top border */
    background: #fff;
    flex-shrink: 0;
    z-index: 10;
}

.save-btn-premium {
    padding: 0.7rem 1.75rem;
    background: #ad246d;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(173, 36, 109, 0.15);
}

.save-btn-premium:hover {
    background: #cf2f84;
    box-shadow: 0 6px 16px rgba(173, 36, 109, 0.25);
}

.save-btn-premium:disabled {
    background: #e5dae8;
    color: #bfaec4;
    cursor: not-allowed;
    box-shadow: none;
}

.modal-body-scroll .form-group {
    margin-bottom: 0rem; /* Handled by gap on .modal-body-scroll */
}

.modal-body-scroll .detail-label {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: #4b5563;
    margin-bottom: 0.4rem;
    display: block;
}

.modal-body-scroll input:not(:disabled):not([readonly]):focus,
.modal-body-scroll textarea:focus {
    outline: none;
    border-color: #ad246d !important;
    box-shadow: 0 0 0 1px #ad246d;
}

@media (max-width: 900px) {
    .profile-grid-main {
        grid-template-columns: 1fr;
    }
    .profile-shell {
        min-height: calc(100vh - 100px);
    }
}

@media (max-width: 520px) {
    .profile-shell {
        min-height: calc(100vh - 80px);
    }
}

/* ═══════════════════════════════════════════════════════
   EDIT PROFILE MODAL — Reference-style redesign
   Classes prefixed with ep- to avoid conflicts
═══════════════════════════════════════════════════════ */

/* Overlay */
.ep-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Modal card */
.ep-modal {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}

/* Top bar */
.ep-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.6rem 2rem 1.2rem;
  flex-shrink: 0;
}

.ep-title {
  font-family: 'DM Serif Display', 'Georgia', serif;
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
  letter-spacing: -0.02em;
}

.ep-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.ep-close:hover {
  background: #f3f4f6;
  color: #111827;
}

/* Body — two columns */
.ep-body {
  display: flex;
  gap: 2rem;
  padding: 0 2rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  align-items: flex-start;
}

.ep-body::-webkit-scrollbar { width: 4px; }
.ep-body::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

/* Photo column */
.ep-photo-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  width: 150px;
  padding-top: 0.25rem;
}

.ep-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #ad246d 0%, #cf2f84 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.ep-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ep-avatar-initials {
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.ep-edit-photo-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.ep-edit-photo-btn:hover {
  border-color: #ad246d;
  color: #ad246d;
  background: #fdf7fb;
}

.ep-photo-name {
  font-size: 0.68rem;
  color: #9ca3af;
  text-align: center;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Form column */
.ep-form-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.ep-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ep-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  letter-spacing: 0.01em;
}

.ep-name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.ep-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 0.9rem;
  color: #111827;
  background: #fff;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  box-sizing: border-box;
}

.ep-input:focus {
  border-color: #ad246d;
  box-shadow: 0 0 0 3px rgba(173, 36, 109, 0.1);
}

.ep-input-readonly {
  background: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
  border-color: #e5e7eb;
}

.ep-input-readonly:focus {
  border-color: #e5e7eb;
  box-shadow: none;
}

.ep-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2rem;
  cursor: pointer;
}

.ep-textarea {
  resize: none;
  line-height: 1.55;
}

.ep-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

/* Footer */
.ep-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 2rem 1.4rem;
  border-top: 1px solid #f3f4f6;
  flex-shrink: 0;
}

.ep-btn-close {
  padding: 0.6rem 1.4rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #374151;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s ease;
}

.ep-btn-close:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.ep-btn-save {
  padding: 0.6rem 1.6rem;
  border: none;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ep-btn-save:hover:not(:disabled) {
  background: #ad246d;
  box-shadow: 0 4px 14px rgba(173, 36, 109, 0.3);
  transform: translateY(-1px);
}

.ep-btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Responsive */
@media (max-width: 600px) {
  .ep-modal {
    max-width: 100%;
    border-radius: 16px;
    max-height: calc(100vh - 1rem);
  }

  .ep-topbar {
    padding: 1.2rem 1.25rem 0.9rem;
  }

  .ep-title { font-size: 1.5rem; }

  .ep-body {
    flex-direction: column;
    align-items: center;
    padding: 0 1.25rem 1rem;
    gap: 1.25rem;
  }

  .ep-photo-col {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  .ep-avatar { width: 80px; height: 80px; }
  .ep-avatar-initials { font-size: 1.6rem; }

  .ep-name-row,
  .ep-two-col {
    grid-template-columns: 1fr;
  }

  .ep-footer {
    padding: 0.9rem 1.25rem 1.1rem;
  }
}
