/* Compact header — not a traditional navbar */
.profile-header {
  background-color: #010409;
  border-bottom: 1px solid #30363d;
  padding: 0.6rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.profile-header a {
  color: #c9d1d9;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.profile-header a:hover {
  color: #58a6ff;
}

.page-wrap {
  max-width: 860px;
  margin: 2.5rem auto;
  padding: 0 1rem;
}

/* Hero card */
.user-hero {
  background-color: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.avatar-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #238636;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-info h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.user-info p {
  color: #8b949e;
  font-size: 0.875rem;
}

/* Tabs */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #30363d;
  margin-bottom: 1.5rem;
}
.tab-btn {
  background: none;
  border: none;
  color: #8b949e;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.tab-btn:hover {
  color: #c9d1d9;
}
.tab-btn.active {
  color: #c9d1d9;
  border-bottom-color: #f78166;
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* Tables */
.data-table-wrap {
  background-color: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th {
  background-color: #0d1117;
  padding: 0.6rem 1rem;
  color: #8b949e;
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid #30363d;
}
.data-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #21262d;
  vertical-align: middle;
}
.data-table tr:last-child td {
  border-bottom: none;
}
.data-table tr:hover td {
  background-color: #0d1117;
}
.empty-row td {
  color: #8b949e;
  text-align: center;
  padding: 2rem;
}

/* Section heading */
.section-heading {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #30363d;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Danger zone */
.danger-card {
  background-color: rgba(248, 81, 73, 0.05);
  border: 1px solid rgba(248, 81, 73, 0.4);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.danger-card p {
  font-size: 0.875rem;
  color: #8b949e;
  margin-top: 0.25rem;
}

.btn-danger {
  background-color: #da3633;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

/* Auth gate */
#authGate {
  text-align: center;
  padding: 4rem 1rem;
  color: #8b949e;
}
#authGate h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #c9d1d9;
  margin-bottom: 0.75rem;
}
#authGate p {
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* History count */
.history-meta {
  font-size: 0.8rem;
  color: #8b949e;
  margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
  .profile-header {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .page-wrap {
    margin: 1.25rem auto;
    padding: 0 0.75rem;
  }

  #authGate {
    padding: 3rem 1rem 1.5rem;
  }

  #authGate img {
    width: 72px !important;
    margin-bottom: 1.25rem !important;
  }

  #authGate h1 {
    font-size: 1.6rem !important;
  }

  #authGate > div[style*="display: flex"] {
    flex-direction: column;
    gap: 0.75rem;
  }

  #authGate .btn-primary,
  #authGate .btn-secondary {
    width: 100%;
  }

  .user-hero {
    padding: 1.25rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .avatar-circle {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }

  .user-info h1 {
    font-size: 1.2rem;
  }

  .user-hero > div:last-child {
    width: 100%;
    margin-left: 0 !important;
  }

  .user-hero #signOutBtn {
    width: 100%;
    justify-content: center;
  }

  .tab-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .tab-btn {
    flex: 1 1 10rem;
    justify-content: center;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
    border-bottom-color: #30363d;
  }

  .tab-btn.active {
    border-bottom-color: #f78166;
  }

  .data-table-wrap {
    overflow-x: auto;
  }

  .data-table {
    min-width: 520px;
  }

  .danger-card {
    padding: 1rem;
  }

  .danger-card > div:last-child,
  .danger-card .btn-danger {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .profile-header {
    padding: 0.65rem 0.75rem;
  }

  .page-wrap {
    padding: 0 0.5rem;
  }

  #authGate {
    padding-top: 2.5rem;
  }

  .user-hero {
    padding: 1rem;
  }

  .tab-btn {
    flex-basis: 100%;
  }
}

/* ===== CUSTOM PROFILE MODALS ===== */
.profile-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 4, 9, 0.85);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.profile-modal {
  background: linear-gradient(145deg, #161b22, #0d1117);
  border: 1px solid #30363d;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
  animation: modalSlideIn 0.18s ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 1px solid #21262d;
}

.profile-modal-header h2,
.profile-modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #c9d1d9;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.profile-modal-close {
  background: none;
  border: none;
  color: #8b949e;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}

.profile-modal-close:hover {
  color: #c9d1d9;
  background: rgba(255,255,255,0.06);
}

.profile-modal-body {
  padding: 1.25rem;
}

.profile-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.9rem 1.25rem 1.1rem;
  border-top: 1px solid #21262d;
}

.profile-modal-footer .btn-primary,
.profile-modal-footer .btn-secondary,
.profile-modal-footer .btn-danger {
  padding: 0.5rem 1.1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.profile-modal-footer .btn-primary {
  background: #238636;
  color: #fff;
  border-color: rgba(240,246,252,0.1);
}
.profile-modal-footer .btn-primary:hover { background: #2ea043; }
.profile-modal-footer .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.profile-modal-footer .btn-secondary {
  background: #21262d;
  color: #c9d1d9;
  border-color: #30363d;
}
.profile-modal-footer .btn-secondary:hover { background: #30363d; }

.profile-modal-footer .btn-danger {
  background: #da3633;
  color: #fff;
}
.profile-modal-footer .btn-danger:hover { background: #b91c1c; }

/* Input inside profile modals */
.profile-input-group {
  margin-bottom: 1rem;
}

.profile-input-group:last-child {
  margin-bottom: 0;
}

.profile-input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #8b949e;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}

.profile-input:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88,166,255,0.2);
}

.profile-input::placeholder {
  color: #484f58;
}

.profile-modal-error {
  color: #f85149;
  font-size: 0.825rem;
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Toast notification */
.profile-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: #c9d1d9;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 3000;
  white-space: nowrap;
  animation: toastIn 0.25s ease;
}

.profile-toast.toast-success { border-color: rgba(63,185,80,0.4); }
.profile-toast.toast-success i { color: #3fb950; }
.profile-toast.toast-error   { border-color: rgba(248,81,73,0.4); }
.profile-toast.toast-error i  { color: #f85149; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== UTILITY CLASSES ===== */
.text-fg { color: #c9d1d9; }
.bg-subtle { background-color: #161b22; }
.bg-canvas { background-color: #0d1117; }
.border-subtle { border: 1px solid #30363d; }


/* Admin Panel Custom Styles */
.admin-form-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.admin-form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.admin-input-group {
  flex: 1;
}

.admin-input-group label,
.admin-expiration-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.admin-text-input {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  border-radius: 6px;
  padding: 0.5rem;
  font-size: 0.875rem;
  box-sizing: border-box;
  height: 38px;
  outline: none;
}

.admin-text-input:focus {
  border-color: #58a6ff;
}

.admin-expiration-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.admin-expiration-capsule {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.25rem 0.75rem;
  box-sizing: border-box;
  height: 38px;
}

.admin-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #c9d1d9;
  font-size: 0.875rem;
  cursor: pointer;
  font-weight: 500;
}

.admin-checkbox {
  accent-color: #238636;
  cursor: pointer;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
}

.admin-capsule-divider {
  width: 1px;
  height: 1.25rem;
  background: #30363d;
}

.admin-select-label {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  color: #c9d1d9;
  font-size: 0.875rem;
}

.admin-capsule-select {
  background: transparent;
  border: none;
  color: #c9d1d9;
  outline: none;
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  width: 1.2rem;
}

.admin-submit-btn-circle {
  background: #238636;
  border-color: #2ea043;
  height: 25px;
  width: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 100%;
  border: none;
}

.admin-submit-btn-circle:hover {
  background: #2ea043;
}

.admin-permanent-btn {
  background: transparent;
  border: none;
  color: #8b949e;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 0.25rem;
  transition: color 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  outline: none;
}

.admin-permanent-btn:hover {
  color: #c9d1d9;
}

.admin-permanent-btn.active {
  color: #3fb950;
  transform: scale(1.2);
}
