/* /public/css/profile.css */
:root {
  --profile-bg: var(--gs-page-bg);
  --profile-card: var(--gs-card-bg);
  --profile-border: var(--gs-border);
  --profile-border-soft: rgba(28, 35, 41, 0.08);

  --profile-text: var(--gs-text);
  --profile-muted: var(--gs-muted);
  --profile-muted-dark: rgba(28, 35, 41, 0.78);

  --profile-primary: var(--gs-primary);
  --profile-primary-dark: var(--gs-primary-hover);
  --profile-primary-soft: rgba(30, 48, 68, 0.08);

  --profile-accent: var(--gs-accent);
  --profile-accent-soft: rgba(255, 102, 66, 0.12);

  --profile-green: var(--gs-workflow-green);
  --profile-green-soft: rgba(70, 194, 116, 0.14);

  --profile-warning: #b7791f;
  --profile-warning-soft: #fff7e6;

  --profile-danger: #b42318;
  --profile-danger-soft: #fff1f0;

  --profile-shadow: var(--gs-shadow);
  --profile-radius: 18px;
}

body {
  background: var(--profile-bg);
  margin: 0;
  padding: 0;
  color: var(--profile-text);
  font-family: Dubai, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.profile-page {
  width: min(1320px, calc(100% - 32px));
  margin: 34px auto 60px;
}

.profile-hero-card {
  background:
    linear-gradient(135deg, rgba(31, 79, 216, 0.12), rgba(255, 255, 255, 0.96)),
    var(--profile-card);
  border: 1px solid var(--profile-border);
  border-radius: 24px;
  box-shadow: var(--profile-shadow);
  padding: 26px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 22px;
}

.profile-hero-left {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.profile-avatar-wrap {
  width: 128px;
  min-width: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
}

.profile-avatar-wrap img {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  background: #ffffff;
}

.profile-avatar-wrap input[type="file"] {
  display: none;
}

.avatar-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--profile-primary);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(31, 79, 216, 0.22);
}

.avatar-upload-btn:hover {
  background: var(--profile-primary-dark);
}

.profile-identity {
  min-width: 0;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--profile-primary);
  font-size: 0.74rem;
  font-weight: 800;
  margin: 0 0 7px;
}

.profile-identity h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  line-height: 1.08;
  color: var(--profile-text);
}

.profile-muted,
.profile-identity p {
  color: var(--profile-muted);
}

.profile-hero-email {
  margin: 8px 0 0;
}

.profile-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--profile-primary);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
}

.profile-pill.soft {
  background: var(--profile-green-soft);
  color: var(--profile-green);
  border: 1px solid rgba(22, 138, 74, 0.18);
}

.profile-hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 14px;
}

.mini-stat-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--profile-border-soft);
  border-radius: 18px;
  padding: 18px;
  min-height: 86px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.mini-stat-label {
  display: block;
  color: var(--profile-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 7px;
}

.mini-stat-card strong {
  display: block;
  font-size: 1.12rem;
  color: var(--profile-text);
  line-height: 1.25;
}

.settings-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.settings-sidebar {
  background: var(--profile-card);
  border: 1px solid var(--profile-border);
  border-radius: var(--profile-radius);
  box-shadow: var(--profile-shadow);
  padding: 12px;
  position: sticky;
  top: 92px;
}

.settings-tab {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 13px;
  cursor: pointer;
  color: var(--profile-text);
  transition: 0.18s ease;
}

.settings-tab:hover {
  background: #f8faff;
  border-color: var(--profile-border-soft);
}

.settings-tab.active {
  background: var(--profile-primary-soft);
  border-color: rgba(31, 79, 216, 0.22);
  box-shadow: inset 4px 0 0 var(--profile-primary);
}

.settings-tab .tab-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #f2f5fb;
  font-size: 1.05rem;
}

.settings-tab.active .tab-icon {
  background: #ffffff;
}

.settings-tab strong,
.settings-tab small {
  display: block;
}

.settings-tab strong {
  font-size: 0.94rem;
  margin-bottom: 2px;
}

.settings-tab small {
  color: var(--profile-muted);
  font-size: 0.77rem;
  line-height: 1.25;
}

.settings-content {
  min-width: 0;
}

.profile-message {
  display: none;
  margin-bottom: 14px;
  border-radius: 14px;
  padding: 13px 15px;
  font-weight: 700;
  border: 1px solid transparent;
}

.profile-message.show {
  display: block;
}

.profile-message.success {
  background: var(--profile-green-soft);
  color: var(--profile-green);
  border-color: rgba(22, 138, 74, 0.22);
}

.profile-message.error {
  background: var(--profile-danger-soft);
  color: var(--profile-danger);
  border-color: rgba(180, 35, 24, 0.2);
}

.profile-message.info {
  background: var(--profile-primary-soft);
  color: var(--profile-primary);
  border-color: rgba(31, 79, 216, 0.18);
}

.settings-panel {
  display: none;
  animation: profileFadeIn 0.18s ease;
}

.settings-panel.active {
  display: block;
}

@keyframes profileFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-header {
  background: var(--profile-card);
  border: 1px solid var(--profile-border);
  border-radius: var(--profile-radius);
  box-shadow: var(--profile-shadow);
  padding: 24px;
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.55rem;
}

.panel-header p:last-child {
  margin: 8px 0 0;
  color: var(--profile-muted);
}

.settings-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.settings-card {
  background: var(--profile-card);
  border: 1px solid var(--profile-border);
  border-radius: var(--profile-radius);
  box-shadow: var(--profile-shadow);
  padding: 22px;
}

.settings-card.wide {
  grid-column: 1 / -1;
}

.settings-card h3 {
  margin: 0 0 16px;
  font-size: 1.08rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: block;
  font-size: 0.86rem;
  color: var(--profile-muted-dark);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 7px;
  border: 1px solid var(--profile-border);
  background: #ffffff;
  border-radius: 12px;
  color: var(--profile-text);
  font: inherit;
  font-size: 0.95rem;
  padding: 12px 13px;
  outline: none;
  transition: 0.18s ease;
}

textarea {
  resize: vertical;
  min-height: 135px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(31, 79, 216, 0.65);
  box-shadow: 0 0 0 4px rgba(31, 79, 216, 0.1);
}

input:disabled {
  color: #7c8595;
  background: #f4f6fa;
  cursor: not-allowed;
}

.helper-text {
  color: var(--profile-muted);
  line-height: 1.55;
  font-size: 0.92rem;
  margin: 8px 0 0;
}

.status-list {
  display: grid;
  gap: 12px;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--profile-border-soft);
}

.status-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.status-list span {
  color: var(--profile-muted);
  font-weight: 700;
}

.status-list strong {
  text-align: right;
}

.status-good {
  color: var(--profile-green);
}

.status-warning {
  color: var(--profile-warning);
}

.toggle-list {
  display: grid;
  gap: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--profile-border-soft);
  border-radius: 15px;
  padding: 14px 15px;
  background: #fbfcff;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row strong {
  color: var(--profile-text);
  font-size: 0.95rem;
}

.toggle-row small {
  color: var(--profile-muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 3px;
}

.toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 0;
  accent-color: var(--profile-primary);
}

.secondary-btn,
.primary-save-btn {
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  min-height: 42px;
  padding: 0 16px;
}

.secondary-btn {
  background: var(--profile-primary-soft);
  color: var(--profile-primary);
  margin-top: 14px;
}

.secondary-btn:hover {
  background: rgba(31, 79, 216, 0.16);
}

.primary-save-btn {
  background: var(--profile-primary);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(31, 79, 216, 0.22);
}

.primary-save-btn:hover {
  background: var(--profile-primary-dark);
}

.activity-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.activity-toolbar h3 {
  margin: 0;
}

.activity-toolbar input {
  max-width: 310px;
  margin-top: 0;
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 430px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.activity-list li {
  border: 1px solid var(--profile-border-soft);
  background: #fbfcff;
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--profile-muted-dark);
  line-height: 1.4;
}

.activity-list strong {
  display: block;
  color: var(--profile-text);
  margin-bottom: 3px;
}

.sticky-save-bar {
  position: sticky;
  bottom: 18px;
  z-index: 5;
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--profile-border);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(12px);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.sticky-save-bar p {
  margin: 0;
  color: var(--profile-muted);
  font-weight: 700;
}

@media (max-width: 1050px) {
  .settings-shell {
    grid-template-columns: 1fr;
  }

  .settings-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-hero-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-hero-stats {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .profile-page {
    width: min(100% - 20px, 1320px);
    margin-top: 18px;
  }

  .profile-hero-left {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-avatar-wrap {
    width: 100%;
    min-width: 0;
    align-items: flex-start;
  }

  .profile-hero-stats,
  .settings-card-grid,
  .form-grid,
  .settings-sidebar {
    grid-template-columns: 1fr;
  }

  .settings-tab {
    padding: 12px;
  }

  .activity-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .activity-toolbar input {
    max-width: none;
  }

  .sticky-save-bar {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .primary-save-btn {
    width: 100%;
  }
}

.hidden {
  display: none !important;
}

.profile-email-connection-card {
  position: relative;
}

.profile-email-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.profile-email-card-header h3 {
  margin-bottom: 6px;
}

.profile-email-provider-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--profile-warning-soft);
  color: var(--profile-warning);
  border: 1px solid rgba(183, 121, 31, 0.2);
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}

.profile-email-provider-badge.connected {
  background: var(--profile-green-soft);
  color: var(--profile-green);
  border-color: rgba(22, 138, 74, 0.22);
}

.profile-email-status-box {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--profile-border-soft);
  border-radius: 16px;
  padding: 16px;
  background: #fbfcff;
  margin-bottom: 14px;
}

.profile-email-status-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 16px;
  background: var(--profile-primary-soft);
  color: var(--profile-primary);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
}

.profile-email-status-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.profile-email-status-main strong {
  color: var(--profile-text);
  font-size: 1rem;
}

.profile-email-status-main span {
  color: var(--profile-muted);
  overflow-wrap: anywhere;
}

.profile-email-actions,
.profile-email-future-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-email-future-row {
  margin-top: 4px;
}

.secondary-btn.danger-soft {
  background: var(--profile-danger-soft);
  color: var(--profile-danger);
}

.secondary-btn.danger-soft:hover {
  background: #ffe3e0;
}

.secondary-btn.subtle {
  background: #f6f8fb;
  color: var(--profile-muted-dark);
}

.secondary-btn.subtle:hover {
  background: #eef2f7;
}

.secondary-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 720px) {
  .profile-email-card-header {
    flex-direction: column;
  }

  .profile-email-provider-badge {
    align-self: flex-start;
  }

  .profile-email-status-box {
    align-items: flex-start;
  }

  .profile-email-actions,
  .profile-email-future-row {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-email-actions .secondary-btn,
  .profile-email-future-row .secondary-btn {
    width: 100%;
  }
}

.settings-panel[hidden] {
  display: none !important;
}

.settings-panel.active {
  display: block !important;
}