/* ========================================================= */
/*                  SETTINGS PAGE – FULL STYLES               */
/* ========================================================= */

:root {
  --brand: #d3b777;
  --brand-ghost: rgba(211,183,119,.14);

  --fg: #10131f;
  --muted: #6b7280;
  --line: rgba(16,19,31,.10);
  --line-strong: rgba(16,19,31,.16);
  --bg-card: #fff;
  --bg-rail: #fafafa;

  --text-xs: .86rem;
  --text-sm: .95rem;
  --text-md: 1rem;
  --text-lg: 1.2rem;

  --radius: 14px;
  --shadow-1: 0 8px 32px rgba(16,19,31,.08);
  --shadow-premium: 0 4px 16px rgba(211,183,119,.2);
}

/* Layout */
.settings-shell {
  --rail-w: 280px;
  --panel-w: 820px;
  margin: 40px auto;
  padding: 0 20px;
  max-width: calc(var(--rail-w) + var(--panel-w) + 60px);
  display: grid;
  grid-template-columns: var(--rail-w) var(--panel-w);
  gap: 30px;
  position: relative;
  z-index: 1;
}
.settings-panels { width: var(--panel-w); }
.settings-shell > * { box-sizing: border-box; }

/* Rail */
.settings-rail { position: sticky; top: 84px; align-self: start; z-index: 5; }
.rail-card {
  background: var(--bg-rail);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: var(--shadow-premium);
}

/* Avatar – bottom-right camera (refined for perfect circle + no halo) */
.avatar-click {
  position: relative;
  width: 128px;
  aspect-ratio: 1 / 1;                  /* Ensures perfect circle geometry */
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto 12px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: #fff;                     /* isolates from rail-card bg */
  transition: transform .2s ease;
  box-shadow:
    0 0 0 2px #fff,                    /* outer white edge – removes dark halo */
    0 4px 10px rgba(0,0,0,.06);        /* soft lift shadow */
}

.avatar-click:hover {
  transform: scale(1.04);
}

.avatar {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid var(--brand);       /* clean gold border */
  background: #fff;                     /* prevents blending with grey bg */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #fff inset;     /* removes internal dark fringe */
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;                       /* ensure full fill, no baseline gap */
}

.avatar span {
  font-weight: 700;
  font-size: 2.4rem;
  color: var(--fg);
}

/* Camera icon overlay */
.avatar-camera {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,.94);
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--brand);
  font-size: .9rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.16);
  transition: transform .18s ease, background .18s ease;
}

.avatar-click:hover .avatar-camera {
  background: #fff;
  transform: scale(1.15);
}

/* User info */
.rail-info { display: flex; align-items: center; justify-content: center; gap: 8px; }
.rail-name { font-size: 1.05rem; font-weight: 600; }

/* Tier pill with icons */
.rail-tier {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  text-transform: capitalize;
  border: 2px solid transparent;
  transition: all .2s ease;
}
.rail-tier::before {
  margin-right: 6px;
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: .85rem;
}
.rail-tier.core::before { content: "\f023"; color: #6b7280; }   /* lock */
.rail-tier.plus::before { content: "\f005"; color: #166534; }   /* star */
.rail-tier.pro::before { content: "\f521"; color: #d3b777; }    /* crown */

.rail-tier.core { background: #e5e7eb; color: #4b5563; }
.rail-tier.plus { background: #e6f4ea; color: #166534; border-color: #166534; }
.rail-tier.pro { background: var(--brand-ghost); color: var(--brand); border-color: var(--brand); }
.rail-tier:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(211,183,119,.2); }

.rail-email { font-size: .9rem; color: var(--muted); margin-top: 4px; }

/* Rail nav */
.rail-nav { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.rail-nav .nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: .95rem;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.rail-nav .nav-item:hover { background: var(--brand-ghost); }
.rail-nav .nav-item.active { background: #fff; border: 1px solid var(--brand); }

.mobile-nav { display: none; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 20px; }

/* Panels */
.panel { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.panel:not(.show) { display: none; }
.panel-head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head h1 { font-size: 1.2rem; font-weight: 700; }
.panel-body { padding: 18px; }
.panel-divider { height: 1px; background: var(--brand-ghost); margin: 20px 0; border-radius: 999px; }

/* Fields */
.fields { display: grid; gap: 16px; }
.fields.two-col { grid-template-columns: 1fr 1fr; }
.field label { display: block; font-size: .92rem; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field input, .field select { width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; font-size: .95rem; }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(211,183,119,.24); }
.input-wrap { position: relative; }
.field-status { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; opacity: 0; pointer-events: none; }
.field.saved .field-status { opacity: 1; background: #11a372; mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="white" d="M6.2 12.3 2.9 9l-1.3 1.3 4.6 4.6 8.2-8.2-1.3-1.3z"/></svg>') center/contain no-repeat; }

.actions { display: flex; justify-content: space-between; margin-top: 20px; }
.btn { padding: 10px 18px; border-radius: 10px; background: var(--brand); color: #10131f; border: none; cursor: pointer; font-weight: 600; }
.btn[disabled] { background: #e9e2cf; opacity: 0.8; cursor: not-allowed; }
.btn.danger { background: #cf3c2b; color: #fff; }

.tier-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-top: 20px; }
.tier-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tier-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.tier-card .price { font-size: 1.5rem; font-weight: 700; color: var(--brand); margin-bottom: 12px; }
.tier-card ul { list-style: disc; padding-left: 20px; margin-bottom: 16px; }
.tier-card .btn-upgrade { width: 100%; }

.current-tier-banner { background: var(--brand-ghost); color: var(--brand); padding: 12px 16px; border-radius: 12px; font-size: .95rem; font-weight: 500; text-align: center; margin-bottom: 20px; border: 1px solid var(--brand); }
.current-tier-banner i { margin-right: 6px; }

.last-saved { font-size: .8rem; color: var(--muted); margin-top: 8px; text-align: right; }
.toast { font-size: var(--text-sm); color: var(--muted); }
.toast.error { color: #d84a3a; }

/* Responsive */
@media (max-width: 980px) {
  .settings-shell {
    grid-template-columns: 1fr;
    max-width: 100%;
    padding: 0 12px;
    margin: 20px auto;
  }
  .settings-rail { position: static; top: auto; }
  .panel, .settings-panels { width: 100%; max-width: none; }

  .fields.two-col { grid-template-columns: 1fr; }
  .rail-nav { display: none; }
  .mobile-nav { display: block; }

  .rail-card {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    padding: 16px;
  }
  .avatar-click {
    margin: 0;
    width: 80px;
    height: 80px;
  }
  .rail-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .rail-name { font-size: 1rem; }
  .rail-email { font-size: .85rem; }
}

/* === ACTIVE PANEL — MATCH "You're on Core" BOX === */
.nav-item.active,
.settings-nav .nav-item.active {
  background: #FFF9E6 !important;           /* Light yellow */
  border: 2px solid #FFD700 !important;     /* Gold border */
  border-radius: 12px !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
  padding: 8px 12px !important;
}

/* === KILL BLACK BORDERS FROM BROWSER === */
#rail-avatar img,
.rail-avatar-img,
.nav-item,
.nav-item * {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* === HOVER FOR INACTIVE PANELS === */
.nav-item:hover:not(.active) {
  background: #f5f5f5 !important;
  border-radius: 12px !important;
}
