/* ================================================================
   profile.css — Arfric User Profile & Account Settings
   Natural color palette with light/dark grays
   Layout: two-column grid on desktop (profile card + posts feed),
           single column on mobile/tablet.
   ================================================================ */

/* ── Design tokens (natural color palette) ─── */
:root {
  --bg-primary:     #f8f9fa;
  --bg-secondary:   #ffffff;
  --bg-tertiary:    #e9ecef;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f1f3f5;
  --bg-input:       #f8f9fa;

  --border-light:   #e9ecef;
  --border-medium:  #dee2e6;
  --border-dark:    #ced4da;

  --text-primary:   #212529;
  --text-secondary: #495057;
  --text-tertiary:  #6c757d;
  --text-muted:     #adb5bd;
  --text-light:     #dee2e6;

  --accent:         #4263eb;
  --accent-hover:   #364fc7;
  --accent-light:   #dbe4ff;

  --success:        #2b8a3e;
  --danger:         #e03131;
  --warning:        #e67700;

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);

  --radius-sm:      0.375rem;
  --radius-md:      0.5rem;
  --radius-lg:      0.75rem;
  --radius-xl:      1rem;

  --transition:     0.2s ease;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

::-webkit-scrollbar        { width: 6px; }
::-webkit-scrollbar-track  { background: var(--bg-primary); }
::-webkit-scrollbar-thumb  { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Generic utilities ── */
.hidden { display: none !important; }

/* Hidden file inputs (replaces inline style="display:none") */
.visually-hidden-file {
  display: none;
}

/* ================================================================
   SPLIT LAYOUT — #ProfileLayout (sidebar + posts feed)
   Mobile default: single column, stacked.
   Desktop (≥900px): two columns — profile card + posts feed.
   ================================================================ */


#ProfileLayout {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 0.5rem 4rem;
}

/* ── Desktop: two-column layout, near full width ── */
@media (min-width: 900px) {
  #ProfileLayout {
    /* Fill the viewport but leave a margin so it never touches
       the screen edge, and cap for readability on huge monitors. */
    width: 92%;
    max-width: 100%;
    margin: 0 auto;

    display: grid;
    /* Sidebar ~34% of the layout, feed takes the rest. */
    grid-template-columns: minmax(360px, 34%) 1fr;
    gap: 1.75rem;
    align-items: start;

    padding: 0 0 4rem;
  }

  /* Profile card becomes a sticky sidebar */
  #UserProfile {
    position: sticky;
    top: 1rem;
    background: #6a5;
    max-width: none;
    padding-bottom: 0;
  }

  /* Posts column fills the remaining grid track */
  #UserPosts {
    max-width: none;
    padding-bottom: 0;
  }
}

/* ── Very large screens: let it breathe even more ── */
@media (min-width: 1600px) {
  #ProfileLayout {
    width: 88%;
    max-width: 1800px;
    grid-template-columns: minmax(420px, 32%) 1fr;
    gap: 2rem;
  }
}

/* ── Ultrawide: stop growing, keep it centered ── */
@media (min-width: 2000px) {
  #ProfileLayout {
    max-width: 1900px;
  }
}
/* ================================================================
   PROFILE CARD  (banner, avatar, stats, tabs, menu)
   ================================================================ */

/* ── Background banner ── */
.profile-background {
  width: 100%;
  height: 240px;
  background: linear-gradient(135deg, #e9ecef, #dee2e6);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.profile-background.has-image {
  background-color: transparent;
  background-image: var(--profile-bg);
  background-size: cover;
  background-position: center;
}

.background-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.08) 0%, transparent 100%);
  pointer-events: none;
}

/* ── Camera buttons ── */
.camera-btn {
  position: absolute;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  z-index: 2;
}

.camera-btn:hover {
  background: #ffffff;
  box-shadow: var(--shadow-md);
  transform: scale(1.05);
}

.camera-btn--background {
  top: 16px;
  right: 16px;
  opacity: 0.85;
}

.camera-btn--avatar {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 34px;
  height: 34px;
  background: #ffffff;
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

/* ── Profile header card ── */
.profile-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 0 1.25rem 1.5rem;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.profile-avatar-wrap {
  position: relative;
  display: inline-block;
  margin-top: -65px;
  margin-bottom: 0.75rem;
}

.profile-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-card);
  background: var(--bg-tertiary);
  display: block;
  box-shadow: var(--shadow-sm);
}

.profile-username {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.profile-bio {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  max-width: 300px;
  margin: 0 auto 0.75rem;
  line-height: 1.45;
}

/* ── Stats row ── */
.profile-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 0.75rem;
}

.stat-item { text-align: center; }

.stat-number {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.1rem;
}

/* ── Activity section ── */
.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin: 0.75rem 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 0.85rem 1rem 0.4rem;
}

/* ── Activity tabs ── */
.activity-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  padding: 0 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.activity-tabs::-webkit-scrollbar { display: none; }

.activity-tab {
  flex: 0 0 auto;
  padding: 0.65rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.activity-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.activity-tab:hover { color: var(--text-secondary); }

/* ── Tab panes ── */
.tab-pane { display: none; padding: 1rem; }
.tab-pane.active { display: block; }

/* ── Channels grid ── */
.items-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.channel-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 0.35rem 0.85rem 0.35rem 0.4rem;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all var(--transition);
}

.channel-chip:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--text-primary);
}

.channel-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-tertiary);
}

/* ── Flicks grid ── */
.flicks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin: -1rem;
}

.flick-cell {
  position: relative;
  aspect-ratio: 9/16;
  background: var(--bg-tertiary);
  overflow: hidden;
  cursor: pointer;
}

.flick-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition);
}

.flick-cell:hover .flick-thumb { transform: scale(1.04); }

.flick-thumb.is-broken {
  background: #1e1b4b;
}

.flick-duration {
  position: absolute;
  bottom: 0.35rem;
  right: 0.4rem;
  background: rgba(0,0,0,0.75);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
}

/* ── Empty / loading states ── */
.grid-empty {
  width: 100%;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.grid-empty a { color: var(--accent); text-decoration: none; }
.grid-empty a:hover { text-decoration: underline; }

/* Shared empty-state helpers */
.empty-icon {
  opacity: 0.35;
  display: block;
  margin: 0 auto 12px;
  color: var(--text-tertiary);
}

.empty-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-secondary);
}

.empty-subtitle {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* Flicks empty state */
#flicks-empty .empty-icon   { opacity: 0.35; display: block; margin: 0 auto 12px; color: var(--text-tertiary); }
#flicks-empty .empty-title  { font-weight: 600; margin-bottom: 0.25rem; color: var(--text-secondary); }
#flicks-empty .empty-subtitle { font-size: 0.8rem; color: var(--text-tertiary); }

/* Spinners */
.spinner-wrap { text-align: center; padding: 2rem; }

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner--lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Friends list ── */
.friends-list { display: flex; flex-direction: column; gap: 0.5rem; }

.friend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  cursor: pointer;
}

.friend-item:hover { background: var(--bg-primary); }

.friend-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.friend-info { flex: 1; min-width: 0; }

.friend-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.friend-status {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: 0.1rem;
}

/* ── Profile menu sections ── */
#profile-menu { padding: 0; }

.menu-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin: 0.75rem 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.menu-section--spaced { margin-top: 0.5rem; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--bg-card-hover); }

.menu-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
}

/* Menu icon color variants */
.menu-icon--blue   { background: #3b82f6; }
.menu-icon--amber  { background: #f59e0b; }
.menu-icon--violet { background: #8b5cf6; }
.menu-icon--pink   { background: #ec4899; }
.menu-icon--green  { background: #22c55e; }
.menu-icon--cyan   { background: #06b6d4; }
.menu-icon--orange { background: #f97316; }
.menu-icon--slate  { background: #64748b; }

.menu-text { flex: 1; min-width: 0; }
.menu-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.menu-desc { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 0.1rem; }

.menu-chevron {
  font-size: 1.25rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* JS adds this class to clickable menu items (instead of inline cursor). */
.menu-item.is-clickable { cursor: pointer; }

/* ================================================================
   USER POSTS COLUMN  (#UserPosts)
   ================================================================ */

/* ── Header bar (title + compose button) ── */
.posts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  box-shadow: var(--shadow-sm);
}

.posts-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.posts-compose-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.posts-compose-btn:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.posts-compose-btn:active { transform: scale(0.97); }

/* ── Feed container ── */
.posts-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Individual post card ── */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem 0.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.post-card:hover { box-shadow: var(--shadow-md); }

.post-card__header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.6rem;
}

.post-card__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.post-card__meta { flex: 1; min-width: 0; }

.post-card__author {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.post-card__time {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 0.05rem;
}

.post-card__body {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.post-card__media {
  margin-top: 0.6rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-tertiary);
}

.post-card__media img,
.post-card__media video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
}

.post-card__footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-light);
}

.post-card__action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.post-card__action:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.post-card__action.is-liked {
  color: var(--accent);
}

.post-card__action.is-liked svg {
  fill: var(--accent);
}

/* Posts empty state */
#posts-empty .empty-icon     { opacity: 0.35; display: block; margin: 0 auto 12px; color: var(--text-tertiary); }
#posts-empty .empty-title    { font-weight: 600; margin-bottom: 0.25rem; color: var(--text-secondary); }
#posts-empty .empty-subtitle { font-size: 0.8rem; color: var(--text-tertiary); }

/* ================================================================
   ACCOUNT SETTINGS PAGE
   ================================================================ */

#AccountSettings {
  max-width: 600px;
  margin: 0 auto;
  padding-bottom: 4rem;
}

.settings-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
}

.back-btn:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.settings-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.settings-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-light);
}

.settings-username {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-email {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 0.15rem;
}

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin: 0.75rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.settings-section-header {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 0.75rem 1rem 0.35rem;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
  border-top: 1px solid var(--border-light);
  transition: background var(--transition);
}

.settings-item:first-of-type { border-top: none; }
.settings-item:hover { background: var(--bg-card-hover); }

.settings-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
}

.settings-text { flex: 1; min-width: 0; }
.settings-item-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.settings-item-desc { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 0.1rem; }
.settings-chevron { font-size: 1.25rem; color: var(--text-tertiary); flex-shrink: 0; }

/* ── Toggle switch ── */
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-dark);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Danger zone ── */
.settings-danger-zone { border-color: var(--danger); }
.settings-danger-zone .settings-section-header { color: var(--danger); }

.btn-logout {
  background: none;
  border: 1.5px solid var(--danger);
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 2.5rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-logout:hover {
  background: var(--danger);
  color: #ffffff;
}

/* ================================================================
   BUTTONS & FORMS (Shared)
   ================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }

.btn-ghost {
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}
.btn-ghost:hover { background: var(--bg-tertiary); }

.btn-danger { background: var(--danger); color: #ffffff; }
.btn-danger:hover { background: #c92a2a; box-shadow: var(--shadow-md); }

.btn-sm { padding: 0.4rem 0.95rem; font-size: 0.8rem; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }

.modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}

.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 1.25rem; }

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ── Form elements ── */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(66, 99, 235, 0.1);
}

.form-control::placeholder { color: var(--text-tertiary); }

.form-hint {
  font-size: 0.73rem;
  color: var(--text-tertiary);
  margin-top: 0.3rem;
}

/* ── Upload overlay ──
   Default: hidden. JS toggles `.active` to show it. */
#upload-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 500;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}

#upload-overlay.active {
  display: flex;
}

#upload-status-text {
  color: #ffffff;
  font-size: 0.9rem;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

/* ── Desktop: two-column layout ── */
@media (min-width: 900px) {
  #ProfileLayout {
    max-width: 1100px;
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 1.5rem;
    align-items: start;
    padding: 0 1rem 4rem;
  }

  /* Profile card becomes a sticky sidebar */
  #UserProfile {
    position: sticky;
    top: 1rem;
    max-width: none;
    padding-bottom: 0;
  }

  /* Posts column fills remaining space */
  #UserPosts {
    max-width: none;
    padding-bottom: 0;
  }
}

/* ── Tablet: stacked but roomier ── */
@media (min-width: 601px) and (max-width: 899px) {
  #ProfileLayout {
    max-width: 680px;
    padding: 0 0.75rem 4rem;
  }

  .profile-background { height: 220px; }
}

/* ── Small phones ── */
@media (max-width: 600px) {
  .profile-background { height: 180px; }
  .profile-avatar { width: 100px; height: 100px; }
  .profile-avatar-wrap { margin-top: -50px; }
  .profile-stats { gap: 1.5rem; }
  .settings-topbar { padding: 0.7rem; }
  .flicks-grid { gap: 2px; }

  .posts-header { padding: 0.65rem 0.8rem; }
  .posts-title { font-size: 0.95rem; }
  .posts-compose-btn span { display: none; }  /* icon-only on tiny screens */
  .posts-compose-btn { padding: 0.55rem; }

  .post-card { padding: 0.8rem 0.85rem 0.65rem; }
  .post-card__avatar { width: 34px; height: 34px; }
}

/* ── Very wide screens: cap total width ── */
@media (min-width: 1400px) {
  #ProfileLayout { max-width: 1200px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}