/* =========================================================
   BASE
========================================================= */

* {
  box-sizing: border-box;
}

:root {
  --navy: #061a44;
  --navy-light: #0b2a62;
  --green: #35c759;
  --green-dark: #15993a;
  --page-bg: #f5f7fb;
  --card-bg: #ffffff;
  --text-muted: #647089;
  --border: #e1e7f0;
  --danger: #b3263c;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--navy);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

/* =========================================================
   DASHBOARD
========================================================= */

.settings-dashboard {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

/* =========================================================
   SIDEBAR — MATCHES PROFILE PAGE
========================================================= */

.dash-sidebar {
  min-height: 100vh;
  padding: 35px 24px;
  background: #061a44;
  color: #ffffff;
}

.dash-logo {
  width: 170px;
  display: block;
  margin-bottom: 45px;
}

.dash-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-sidebar nav a {
  padding: 15px;
  border-radius: 12px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
}

.dash-sidebar nav a:hover {
  transform: translateX(3px);
}

.dash-sidebar nav a.active,
.dash-sidebar nav a:hover {
  background: rgba(53, 199, 89, 0.18);
  color: #35c759;
}

.complete-card {
  margin-top: 55px;
  padding: 22px;
  border-radius: 18px;
  background: linear-gradient(
    135deg,
    #152e7a,
    #6938c9
  );
}

.complete-card h4 {
  margin: 0;
  color: #ffffff;
  font-size: 15px;
}

.complete-card p {
  margin: 12px 0;
  color: #d8e2f2;
  font-size: 14px;
  line-height: 1.4;
}

.complete-card strong {
  color: #ffffff;
}

.small-bar {
  height: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.25);
}

.small-bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: #35c759;
}

/* =========================================================
   MAIN CONTENT
========================================================= */

.settings-main {
  min-width: 0;
  padding: 40px;
}

.settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}

.page-label,
.card-label {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-header h1 {
  margin: 0;
  font-size: 38px;
  letter-spacing: -0.04em;
}

.settings-description {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.view-profile-button,
.primary-settings-button,
.secondary-settings-button,
.sign-out-button,
.danger-settings-button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
}

.view-profile-button,
.secondary-settings-button {
  border: 1px solid #d7deea;
  background: #ffffff;
  color: var(--navy);
}

.primary-settings-button {
  border: 0;
  background: var(--green);
  color: var(--navy);
}

.sign-out-button {
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #ffffff;
}

.danger-settings-button {
  border: 1px solid #efcbd1;
  background: #fff6f7;
  color: var(--danger);
}

/* =========================================================
   TABS
========================================================= */

.settings-tabs {
  display: flex;
  gap: 7px;
  margin-bottom: 24px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(6, 26, 68, 0.04);
}

.settings-tab {
  flex: 1;
  min-height: 43px;
  padding: 0 15px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #69758b;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.settings-tab:hover {
  background: #f3f6fa;
  color: var(--navy);
}

.settings-tab.active {
  background: var(--navy);
  color: #ffffff;
}

/* =========================================================
   MESSAGES
========================================================= */

.settings-message {
  display: none;
  margin-bottom: 18px;
  padding: 13px 16px;
  border: 1px solid #bfe4ca;
  border-radius: 11px;
  background: #edf9f1;
  color: #176c31;
  font-size: 13px;
  font-weight: 700;
}

.settings-message.visible {
  display: block;
}

.settings-message.error {
  border-color: #efcbd1;
  background: #fff6f7;
  color: var(--danger);
}

/* =========================================================
   PANELS AND CARDS
========================================================= */

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.settings-card {
  margin-bottom: 20px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: 0 10px 28px rgba(6, 26, 68, 0.05);
}

.settings-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 25px;
  margin-bottom: 23px;
}

.settings-card-heading h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.025em;
}

.settings-card-heading p:not(.card-label) {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

/* =========================================================
   FORMS
========================================================= */

.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-field.full-width {
  grid-column: 1 / -1;
}

.settings-field label {
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.settings-field input,
.settings-field select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #d9e0eb;
  border-radius: 10px;
  outline: none;
  background: #fbfcfe;
  color: var(--navy);
}

.settings-field input:focus,
.settings-field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(53, 199, 89, 0.12);
}

.settings-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}

/* =========================================================
   ACCOUNT ACTIONS
========================================================= */

.settings-action-list {
  display: grid;
}

.settings-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  padding: 19px 0;
  border-bottom: 1px solid #edf1f5;
}

.settings-action-list .settings-action-row:first-child {
  padding-top: 0;
}

.settings-action-list .settings-action-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.settings-action-row strong {
  color: var(--navy);
  font-size: 14px;
}

.settings-action-row p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.danger-row strong {
  color: var(--danger);
}

/* =========================================================
   TOGGLES
========================================================= */

.settings-option-list {
  display: grid;
}

.settings-toggle-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  padding: 20px 0;
  border-bottom: 1px solid #edf1f5;
  cursor: pointer;
}

.settings-toggle-row:first-child {
  padding-top: 0;
}

.settings-toggle-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.settings-toggle-row strong {
  color: var(--navy);
  font-size: 14px;
}

.settings-toggle-row p {
  max-width: 620px;
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.settings-toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-switch {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 27px;
  border-radius: 999px;
  background: #cbd3df;
  transition: background 0.22s ease;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(6, 26, 68, 0.2);
  transition: transform 0.22s ease;
}

.settings-toggle-row input:checked + .toggle-switch {
  background: var(--green);
}

.settings-toggle-row input:checked + .toggle-switch::after {
  transform: translateX(21px);
}

/* =========================================================
   PREFERENCE CHIPS
========================================================= */

.preference-section {
  margin-top: 26px;
}

.preference-section h3 {
  margin: 0;
  font-size: 16px;
}

.preference-section > p {
  margin: 7px 0 15px;
  color: var(--text-muted);
  font-size: 12px;
}

.preference-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preference-chip input {
  position: absolute;
  opacity: 0;
}

.preference-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 39px;
  padding: 0 14px;
  border: 1px solid #d9e0eb;
  border-radius: 999px;
  background: #ffffff;
  color: #5c6880;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.preference-chip input:checked + span {
  border-color: var(--green);
  background: #eaf9ee;
  color: var(--green-dark);
}

/* =========================================================
   BILLING
========================================================= */

.billing-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 20px;
}

.current-plan-card {
  background:
    radial-gradient(
      circle at 90% 10%,
      rgba(95, 126, 234, 0.22),
      transparent 34%
    ),
    linear-gradient(135deg, var(--navy), var(--navy-light));
  color: #ffffff;
}

.current-plan-card .card-label {
  color: #72e392;
}

.current-plan-card p {
  color: #cad5e7;
}

.current-plan-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 25px;
}

.plan-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.plan-title-row h2 {
  margin: 0;
  color: #ffffff;
  font-size: 30px;
}

.active-plan-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(53, 199, 89, 0.18);
  color: #7beb99;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plan-price {
  text-align: right;
}

.plan-price strong,
.plan-price span {
  display: block;
}

.plan-price strong {
  color: #ffffff;
  font-size: 26px;
}

.plan-price span {
  margin-top: 5px;
  color: #aebdd4;
  font-size: 11px;
}

.plan-feature-list {
  display: grid;
  gap: 11px;
  margin-top: 25px;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.plan-feature-list div {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #e3eaf5;
  font-size: 12px;
}

.plan-feature-list span {
  color: #70e68e;
  font-weight: 900;
}

.plan-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.current-plan-card .secondary-settings-button {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.empty-billing-state {
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.empty-billing-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: 14px;
  background: #eef3fa;
  font-size: 20px;
}

.empty-billing-state strong {
  font-size: 14px;
}

.empty-billing-state p {
  margin: 7px 0 17px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.text-settings-link {
  color: var(--green-dark);
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
}

.settings-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.settings-plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fbfcfe;
}

.settings-plan-card.featured {
  border-color: #b9a1ff;
  background:
    radial-gradient(
      circle at 90% 5%,
      rgba(151, 111, 255, 0.16),
      transparent 30%
    ),
    #fbfaff;
}

.recommended-plan-label {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eee7ff;
  color: #6b42ca;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.plan-type {
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.settings-plan-card h3 {
  margin: 11px 0;
  font-size: 25px;
}

.settings-plan-card h3 small {
  color: var(--text-muted);
  font-size: 10px;
}

.settings-plan-card > p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.settings-plan-card ul {
  display: grid;
  gap: 8px;
  margin: 18px 0 22px;
  padding-left: 19px;
  color: #4f5d75;
  font-size: 11px;
  line-height: 1.5;
}

.plan-selection-button {
  min-height: 41px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 0 13px;
  border: 1px solid #d7deea;
  border-radius: 9px;
  background: #ffffff;
  color: var(--navy);
  cursor: pointer;
  text-decoration: none;
  font-size: 11px;
  font-weight: 900;
}

.plan-selection-button.primary {
  border-color: var(--green);
  background: var(--green);
}

.plan-selection-button.current {
  border-color: #bfe4ca;
  background: #eaf9ee;
  color: var(--green-dark);
}

.billing-history-empty {
  padding: 35px;
  border: 1px dashed #ced7e5;
  border-radius: 14px;
  background: #fafbfd;
  text-align: center;
}

.billing-history-empty > div {
  font-size: 25px;
}

.billing-history-empty h3 {
  margin: 12px 0 0;
  font-size: 16px;
}

.billing-history-empty p {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1100px) {
  .settings-dashboard {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .billing-layout {
    grid-template-columns: 1fr;
  }

  .settings-plan-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .settings-dashboard {
    display: block;
  }

  .dash-sidebar {
    min-height: auto;
  }


  .dash-sidebar nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .settings-main {
    padding: 28px 20px;
  }

  .settings-header {
    flex-direction: column;
  }

  .settings-tabs {
    overflow-x: auto;
  }

  .settings-tab {
    flex: 0 0 auto;
  }
}

@media (max-width: 560px) {
  .dash-sidebar nav {
    grid-template-columns: 1fr;
  }

  .settings-header h1 {
    font-size: 32px;
  }

  .settings-form-grid {
    grid-template-columns: 1fr;
  }

  .settings-field.full-width {
    grid-column: auto;
  }

  .settings-action-row,
  .settings-toggle-row,
  .current-plan-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-action-row > a,
  .settings-action-row > button {
    width: 100%;
  }

  .plan-price {
    text-align: left;
  }

  .plan-card-actions {
    flex-direction: column;
  }

  .plan-card-actions a,
  .plan-card-actions button {
    width: 100%;
  }
}

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