/* =====================================================================
   FalanBook — Glass Theme
   A Facebook-style, fully responsive UI with glassmorphism design.
   This file is intentionally loaded LAST (see includes/footer.php and
   login.php) so its rules win the cascade over the legacy inline
   <style> blocks still present in a few pages, without needing to
   touch dozens of PHP files.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Design tokens
   --------------------------------------------------------------------- */
:root {
  --fb-blue: #1877f2;
  --fb-blue-dark: #145dbf;
  --fb-green: #42b72a;
  --fb-green-dark: #36a420;
  --ink: var(--text, #050505);
  --ink-soft: #444950;
  --muted: var(--text-secondary, #65676b);

  /* --glass-bg, --glass-bg-strong, --glass-border, --text, --shadow are
     defined in includes/header.php (with a [data-theme="dark"] override
     for dark mode) — intentionally NOT redeclared here so dark mode
     keeps working across every component that uses them below. */
  --glass-bg-soft: rgba(255, 255, 255, 0.38);
  --glass-shadow: 0 8px 32px rgba(31, 41, 82, 0.14);
  --glass-shadow-hover: 0 12px 40px rgba(31, 41, 82, 0.2);
  --glass-blur: blur(18px) saturate(180%);
  --glass-blur-strong: blur(28px) saturate(200%);

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --topnav-h: 60px;
  --bottomnav-h: 60px;

  --transition: 180ms cubic-bezier(.2,.8,.2,1);
}

/* ---------------------------------------------------------------------
   2. Reset & background
   --------------------------------------------------------------------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-top: var(--topnav-h);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  /* color/background intentionally inherited from includes/header.php's
     theme-aware var(--text) / var(--bg-gradient) so dark mode still works;
     the floating blobs below are layered on top as a decorative accent. */
  min-height: 100vh;
  overflow-x: hidden;
}

/* animated glass background — soft floating gradient blobs, fixed so
   every page (feed, profile, messages, login…) gets the same glass
   backdrop to show the frosted panels off against */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  /* translucent accent blobs layered over header.php's theme-aware
     var(--bg-gradient) body background — no opaque base color here so
     dark mode's background still shows through correctly. */
  background:
    radial-gradient(38vw 38vw at 8% 12%, rgba(24, 119, 242, 0.22), transparent 60%),
    radial-gradient(42vw 42vw at 92% 18%, rgba(66, 183, 42, 0.18), transparent 60%),
    radial-gradient(46vw 46vw at 18% 92%, rgba(255, 90, 150, 0.14), transparent 60%),
    radial-gradient(40vw 40vw at 88% 88%, rgba(120, 90, 255, 0.16), transparent 60%);
  animation: floatBg 22s ease-in-out infinite alternate;
}
@keyframes floatBg {
  0%   { transform: scale(1) translate(0, 0); filter: hue-rotate(0deg); }
  100% { transform: scale(1.08) translate(-1%, 1%); filter: hue-rotate(12deg); }
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

::selection { background: rgba(24,119,242,0.25); }

/* thin, glassy scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(24,119,242,0.35) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(24,119,242,0.3); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(24,119,242,0.5); }

.avatar {
  border-radius: 50%;
  color: white;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ---------------------------------------------------------------------
   3. Glass utility (shared "panel" look used everywhere)
   --------------------------------------------------------------------- */
.card,
.composer,
.auth-card,
.login-card,
.profile-card,
.friend-card,
.messages-wrap,
.search-result-card,
.modal,
.dropdown-menu,
.thread-list,
.chat-panel {
  background: var(--glass-bg, rgba(255,255,255,0.55));
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.45));
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
}

.card { margin-bottom: 16px; transition: box-shadow var(--transition), transform var(--transition); overflow: hidden; }
.card:hover { box-shadow: var(--glass-shadow-hover); }

/* ---------------------------------------------------------------------
   4. Top navigation (glass bar, fixed)
   --------------------------------------------------------------------- */
.topnav {
  height: var(--topnav-h) !important;
  background: var(--glass-bg-strong, rgba(255,255,255,0.72)) !important;
  -webkit-backdrop-filter: var(--glass-blur-strong);
  backdrop-filter: var(--glass-blur-strong);
  border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.45)) !important;
  box-shadow: 0 4px 24px rgba(20, 30, 60, 0.08) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: fixed !important;
  top: 0; left: 0; right: 0;
  z-index: 999 !important;
  gap: 8px;
}
.topnav-left { display: flex; align-items: center; gap: 10px; width: 280px; min-width: 0; }
.logo-circle {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--fb-blue), #4fa8ff);
  color: white; font-weight: 800; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(24,119,242,0.45);
}
.search-box {
  background: rgba(255,255,255,0.55) !important;
  border: 1px solid var(--glass-border, rgba(255,255,255,0.45));
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  flex: 1;
  min-width: 0;
  transition: background var(--transition), box-shadow var(--transition);
}
.search-box:focus-within { background: rgba(255,255,255,0.85) !important; box-shadow: 0 0 0 3px rgba(24,119,242,0.15); }
.search-box input {
  border: none !important; background: transparent !important; outline: none;
  font-size: 14px; width: 100%; color: var(--ink);
}
.search-box input::placeholder { color: var(--muted); }

.topnav-center { display: flex; gap: 4px; }
.nav-icon {
  width: 92px; height: 48px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; border-bottom: 3px solid transparent; color: var(--muted);
  border-radius: var(--radius-sm); transition: background var(--transition), color var(--transition), transform var(--transition);
}
.nav-icon:hover { background: rgba(24,119,242,0.08); color: var(--fb-blue); transform: translateY(-1px); border-radius: var(--radius-sm); }
.nav-icon.active { color: var(--fb-blue); border-bottom: 3px solid var(--fb-blue); border-radius: 0; }

.topnav-right { display: flex; align-items: center; gap: 10px; width: 280px; justify-content: flex-end; }
.my-name { font-size: 14px; font-weight: 600; }
.logout-link { font-size: 13px; color: var(--fb-blue); margin-left: 8px; }

.avatar-dropdown { position: relative; cursor: pointer; }
.avatar-dropdown .avatar:hover { opacity: 0.85; }
.dropdown-menu {
  position: absolute; right: 0; top: 52px; min-width: 190px; padding: 8px 0;
  z-index: 1000; background: var(--glass-bg-strong, rgba(255,255,255,0.72)) !important;
}
.dropdown-menu a {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  color: var(--ink); font-size: 0.9rem; transition: background var(--transition);
}
.dropdown-menu a:hover { background: rgba(24,119,242,0.1); }
.dropdown-menu .divider { height: 1px; background: rgba(0,0,0,0.08); margin: 6px 0; }
.dropdown-menu .logout-item, .dropdown-menu a.logout-item { color: #e0245e; font-weight: 600; }
.dropdown-menu .logout-item:hover { background: rgba(224,36,94,0.1); }
.dropdown-arrow { font-size: 0.7rem; margin-left: 4px; color: var(--muted); }

/* ---------------------------------------------------------------------
   5. Layout — page-wrap / container (3 responsive columns like FB)
   --------------------------------------------------------------------- */
.page-wrap,
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: center;
}

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  position: sticky;
  top: calc(var(--topnav-h) + 16px);
}
.center-col { width: 560px; flex: 1 1 560px; min-width: 0; max-width: 680px; }

.sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm);
  transition: background var(--transition), transform var(--transition);
}
.sidebar-item:hover { background: rgba(255,255,255,0.5); cursor: pointer; transform: translateX(2px); }
.sidebar-item span { font-size: 14px; font-weight: 600; }
.sidebar-header { font-size: 0.8rem; font-weight: 700; color: var(--muted); padding: 8px 10px 6px; letter-spacing: 0.4px; text-transform: uppercase; }

/* ---------------------------------------------------------------------
   6. Composer
   --------------------------------------------------------------------- */
.composer { padding: 14px; }
.composer-top { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; }
.composer-top input, .composer-top textarea {
  flex: 1; background: rgba(255,255,255,0.55); border: 1px solid var(--glass-border, rgba(255,255,255,0.45)); border-radius: var(--radius-pill);
  padding: 11px 16px; font-size: 15px; outline: none; resize: none; font-family: inherit; color: var(--ink);
  transition: background var(--transition);
}
.composer-top input:focus, .composer-top textarea:focus { background: rgba(255,255,255,0.85); }
.extra-fields input { width: 100%; }
.composer-actions {
  display: flex; justify-content: space-between; flex-wrap: wrap;
  border-top: 1px solid rgba(0,0,0,0.08); padding-top: 8px;
}
.composer-actions button, .composer-actions label {
  background: none; border: none; font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition);
}
.composer-actions button:hover, .composer-actions label:hover { background: rgba(24,119,242,0.08); color: var(--fb-blue); }
.file-name { font-size: 12px; color: var(--muted); }
.media-preview { position: relative; margin: 0 12px 10px; border-radius: var(--radius-md); overflow: hidden; }
.media-preview img, .media-preview video { width: 100%; display: block; border-radius: var(--radius-md); }
.remove-media {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.55); color: #fff; border: none;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1;
}
.upload-progress { height: 6px; background: rgba(0,0,0,0.08); border-radius: 4px; margin: 0 12px 10px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--fb-blue), #4fa8ff); transition: width .2s; }

/* ---------------------------------------------------------------------
   7. Stories bar
   --------------------------------------------------------------------- */
.stories-bar { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0; scroll-snap-type: x mandatory; }
.story-item { flex: 0 0 100px; scroll-snap-align: start; text-align: center; cursor: pointer; }
.story-avatar {
  width: 100px; height: 150px; border-radius: var(--radius-md); overflow: hidden; position: relative;
  background: linear-gradient(135deg, var(--fb-blue), #4fa8ff);
  border: 3px solid transparent;
  box-shadow: var(--glass-shadow);
  display: flex; align-items: center; justify-content: center;
}
.story-avatar img, .story-avatar video { width: 100%; height: 100%; object-fit: cover; }
.story-avatar.viewed { border-color: rgba(0,0,0,0.15); filter: saturate(0.6) brightness(0.92); }
.add-story {
  width: 32px; height: 32px; border-radius: 50%; background: var(--fb-blue); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
  border: 3px solid #fff; margin: 0 auto;
}
.story-name { font-size: 12px; font-weight: 600; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.story-viewer {
  position: fixed; inset: 0; background: rgba(10,10,15,0.92); z-index: 2000;
  display: none; align-items: center; justify-content: center; flex-direction: column;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.story-viewer.show { display: flex; }
.story-progress { position: absolute; top: 16px; left: 16px; right: 16px; height: 3px; background: rgba(255,255,255,0.25); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: #fff; }
.story-close { position: absolute; top: 12px; right: 20px; color: #fff; font-size: 32px; cursor: pointer; }
.story-content { max-width: 90vw; max-height: 75vh; border-radius: var(--radius-md); overflow: hidden; }
.story-content img, .story-content video { max-width: 100%; max-height: 75vh; display: block; }
.story-text { color: #fff; margin-top: 14px; font-size: 15px; text-align: center; max-width: 480px; }

/* ---------------------------------------------------------------------
   8. Modal overlay (create story, etc.)
   --------------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 15, 30, 0.35);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; z-index: 1500; padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal { width: 100%; max-width: 420px; padding: 20px; position: relative; background: var(--glass-bg-strong, rgba(255,255,255,0.72)) !important; }
.close-modal { position: absolute; top: 12px; right: 16px; font-size: 24px; cursor: pointer; color: var(--muted); }
.story-preview { min-height: 120px; border-radius: var(--radius-md); overflow: hidden; margin: 12px 0; background: rgba(0,0,0,0.04); }

/* ---------------------------------------------------------------------
   9. Posts
   --------------------------------------------------------------------- */
.post-header { display: flex; gap: 10px; padding: 14px 14px 8px; align-items: flex-start; }
.post-author { font-size: 14px; font-weight: 700; }
.post-time { font-size: 12px; color: var(--muted); }
.post-feeling-location { font-size: 13px; color: var(--muted); }
.post-content-wrapper { padding: 0 14px 8px; }
.post-content { font-size: 15px; white-space: pre-wrap; line-height: 1.45; }
.post-media { width: 100%; }
.post-media img, .post-media video { width: 100%; display: block; max-height: 520px; object-fit: cover; }
.post-stats {
  display: flex; justify-content: space-between; padding: 8px 14px; font-size: 13px;
  color: var(--muted); border-top: 1px solid rgba(0,0,0,0.06);
}
.post-actions { display: flex; border-top: 1px solid rgba(0,0,0,0.06); padding: 4px; position: relative; }
.post-actions > .reaction-wrap { flex: 1; position: relative; }
.post-actions > .comment-focus-btn,
.post-actions > button:not(.react-btn) { flex: 1; }
.post-actions-right { display: flex; gap: 4px; align-items: center; padding: 0 6px; }
.post-actions button, .edit-post-btn, .delete-post-btn {
  width: 100%; background: none; border: none; padding: 9px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background var(--transition), color var(--transition);
}
.edit-post-btn, .delete-post-btn { width: auto; padding: 6px 10px; }
.post-actions button:hover, .edit-post-btn:hover, .delete-post-btn:hover { background: rgba(24,119,242,0.08); color: var(--fb-blue); }

/* ----- Reaction picker (Facebook-style hover/long-press) ----- */
.react-btn.reacted { color: var(--fb-blue); font-weight: 700; }
.react-btn.reacted-love { color: #f33e58; }
.react-btn.reacted-haha, .react-btn.reacted-wow, .react-btn.reacted-sad { color: #f7b125; }
.react-btn.reacted-angry { color: #e9710f; }
.reaction-picker {
  position: absolute; bottom: calc(100% + 6px); left: 0;
  display: flex; gap: 4px; padding: 6px 8px;
  background: var(--glass-bg-strong, rgba(255,255,255,0.72)); -webkit-backdrop-filter: var(--glass-blur-strong); backdrop-filter: var(--glass-blur-strong);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.45)); border-radius: var(--radius-pill); box-shadow: var(--glass-shadow-hover);
  opacity: 0; visibility: hidden; transform: translateY(6px) scale(0.9); transform-origin: bottom left;
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
  z-index: 20; white-space: nowrap;
}
.reaction-wrap:hover .reaction-picker,
.reaction-picker.show { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.reaction-emoji-btn {
  background: none; border: none; font-size: 22px; padding: 4px; cursor: pointer; border-radius: 50%;
  transition: transform var(--transition);
  line-height: 1;
}
.reaction-emoji-btn:hover { transform: scale(1.35) translateY(-4px); }

.comments-block { padding: 10px 14px 14px; }
.comment { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-start; }
.comment-body { flex: 1; min-width: 0; }
.comment-bubble { background: rgba(255,255,255,0.6); border: 1px solid var(--glass-border, rgba(255,255,255,0.45)); border-radius: 16px; padding: 7px 12px; font-size: 13px; display: inline-block; max-width: 100%; word-break: break-word; }
.comment-bubble b { margin-right: 4px; }
.comment-actions { display: flex; align-items: center; gap: 10px; padding: 3px 12px 0; font-size: 12px; color: var(--muted); }
.comment-time { color: var(--muted); }
.comment-like-btn, .comment-reply-btn {
  background: none; border: none; padding: 0; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.comment-like-btn:hover, .comment-reply-btn:hover { color: var(--fb-blue); text-decoration: underline; }
.comment-like-btn.liked { color: var(--fb-blue); }
.comment-like-count { color: var(--muted); font-size: 11px; }
.comment-replies { margin-left: 34px; margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.comment-reply .comment-bubble { font-size: 12.5px; padding: 6px 10px; }
.reply-form { display: flex; gap: 8px; margin: 6px 0 0 0; align-items: center; }
.reply-form input {
  flex: 1; background: rgba(255,255,255,0.5); border: 1px solid var(--glass-border, rgba(255,255,255,0.45)); border-radius: 14px;
  padding: 5px 10px; font-size: 12.5px; outline: none;
}
.comment-form { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.comment-form input {
  flex: 1; background: rgba(255,255,255,0.55); border: 1px solid var(--glass-border, rgba(255,255,255,0.45)); border-radius: 16px;
  padding: 7px 12px; font-size: 13px; outline: none;
}
.post-reactions-summary { display: inline-flex; align-items: center; gap: 2px; }

/* ---------------------------------------------------------------------
   10. Buttons (shared)
   --------------------------------------------------------------------- */
.btn-primary {
  width: 100%; background: linear-gradient(135deg, var(--fb-blue), #4fa8ff); color: white; border: none; padding: 13px;
  border-radius: var(--radius-sm); font-size: 17px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 18px rgba(24,119,242,0.35); transition: transform var(--transition), box-shadow var(--transition);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(24,119,242,0.45); }
.btn-create-account {
  background: linear-gradient(135deg, var(--fb-green), #57cf3e);
  color: white; font-weight: 700; font-size: 17px; padding: 13px 16px;
  border-radius: var(--radius-sm); display: inline-block;
  box-shadow: 0 6px 18px rgba(66,183,42,0.35); transition: transform var(--transition);
}
.btn-create-account:hover { transform: translateY(-1px); }
.small-btn {
  background: linear-gradient(135deg, var(--fb-blue), #4fa8ff); color: white; border: none; padding: 7px 12px;
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; cursor: pointer; transition: transform var(--transition);
}
.small-btn:hover { transform: translateY(-1px); }
.small-btn.grey { background: rgba(255,255,255,0.6); color: var(--ink); border: 1px solid var(--glass-border, rgba(255,255,255,0.45)); }
.resend-form { background: none; border: none; color: var(--fb-blue); font-weight: 700; cursor: pointer; text-decoration: underline; font-size: 13px; }

/* ---------------------------------------------------------------------
   11. Login page
   --------------------------------------------------------------------- */
.login-body { min-height: 100vh; padding-top: 0 !important; }
.login-topbar { height: 60px; display: flex; align-items: center; padding: 0 24px; }
.login-topbar-logo { font-size: 22px; font-weight: 800; color: var(--fb-blue); }

.login-wrap, .login-wrapper {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 60px; max-width: 1000px; margin: 20px auto 60px; padding: 0 24px;
}
.login-left, .login-brand { max-width: 420px; padding-top: 20px; }
.login-brand h1 { font-size: 44px; font-weight: 800; color: var(--fb-blue); letter-spacing: -1px; margin-bottom: 12px; }
.login-brand p { font-size: 19px; line-height: 1.35; color: var(--ink); }
.login-wordmark { font-size: 44px; font-weight: 800; color: var(--fb-blue); letter-spacing: -1px; margin-bottom: 12px; }
.login-pitch { font-size: 19px; line-height: 1.35; color: var(--ink); }

.login-right, .login-card-wrap { width: 396px; flex-shrink: 0; }
.login-card { padding: 24px; background: var(--glass-bg-strong, rgba(255,255,255,0.72)) !important; }
.login-card input {
  width: 100%; padding: 14px 16px; margin-bottom: 12px; border: 1px solid var(--glass-border, rgba(255,255,255,0.45));
  background: rgba(255,255,255,0.5); border-radius: var(--radius-sm); font-size: 17px; outline: none;
  transition: background var(--transition), border-color var(--transition);
}
.login-card input:focus { border-color: var(--fb-blue); background: rgba(255,255,255,0.85); }
.login-card .btn-primary { font-size: 20px; padding: 13px; margin-bottom: 12px; }
.forgot-link { text-align: center; margin-bottom: 16px; }
.forgot-link a { color: var(--fb-blue); font-size: 14px; }
.login-divider { border: none; border-top: 1px solid rgba(0,0,0,0.1); margin: 4px 0 16px; }
.login-create-wrap { display: flex; justify-content: center; }
.login-extra { text-align: center; font-size: 13px; color: var(--ink); margin-top: 16px; }
.login-cta-text { text-align: center; font-size: 13px; color: var(--ink); margin-top: 16px; }
.login-footer { text-align: center; font-size: 12px; color: var(--muted); padding: 20px; }

@media (max-width: 760px) {
  .login-wrap, .login-wrapper { flex-direction: column; gap: 24px; margin-top: 0; }
  .login-left, .login-brand { text-align: center; }
  .login-wordmark, .login-brand h1 { font-size: 34px; }
  .login-pitch, .login-brand p { font-size: 16px; }
  .login-right, .login-card-wrap { width: 100%; max-width: 396px; }
}

/* ---------------------------------------------------------------------
   12. Auth pages (register)
   --------------------------------------------------------------------- */
.auth-wrap { max-width: 420px; margin: 60px auto; padding: 0 16px; }
.auth-card { padding: 28px; background: var(--glass-bg-strong, rgba(255,255,255,0.72)) !important; }
.auth-card h1 { font-size: 26px; text-align: center; color: var(--fb-blue); margin-bottom: 4px; }
.auth-card p.tagline { text-align: center; color: var(--muted); margin-bottom: 20px; font-size: 15px; }
.auth-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--glass-border, rgba(255,255,255,0.45));
  background: rgba(255,255,255,0.5); border-radius: var(--radius-sm); font-size: 15px; outline: none;
  transition: background var(--transition), border-color var(--transition);
}
.auth-card input:focus { border-color: var(--fb-blue); background: rgba(255,255,255,0.85); }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; }
.error-msg { background: rgba(255, 90, 100, 0.16); border: 1px solid rgba(255,90,100,0.3); color: #c0392b; padding: 11px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; }
.success-msg { background: rgba(66,183,42,0.16); border: 1px solid rgba(66,183,42,0.3); color: #1e7e34; padding: 11px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; }

/* ---------------------------------------------------------------------
   13. Profile
   --------------------------------------------------------------------- */
.profile-card { overflow: visible; }
.cover-photo-wrapper, .cover-photo {
  height: 280px; position: relative; overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(135deg, var(--fb-blue), var(--fb-green));
}
.cover-photo-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.cover-upload-btn {
  position: absolute; bottom: 12px; right: 12px;
}
.cover-upload-btn label {
  background: rgba(255,255,255,0.85); padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: var(--glass-shadow);
}
.cover-upload-btn input { display: none; }

.profile-head { display: flex; flex-direction: column; align-items: center; margin-top: -64px; padding: 0 16px 16px; text-align: center; }
.profile-pic-wrapper { position: relative; }
.profile-pic-wrapper img, .profile-head .avatar {
  border: 5px solid rgba(255,255,255,0.85); border-radius: 50%; box-shadow: var(--glass-shadow);
  width: 168px; height: 168px; object-fit: cover;
}
.profile-pic-upload { position: absolute; bottom: 8px; right: 8px; }
.profile-pic-upload label {
  background: rgba(255,255,255,0.9); width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--glass-shadow);
}
.profile-pic-upload input { display: none; }

.profile-name { font-size: 24px; font-weight: 800; margin-top: 12px; }
.profile-meta { font-size: 14px; color: var(--muted); margin-top: 2px; }
.profile-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.profile-actions .small-btn, .profile-actions .small-btn.grey { padding: 10px 18px; font-size: 14px; }

.edit-bio-form { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px 20px; }
.edit-bio-form input, .edit-bio-form textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--glass-border, rgba(255,255,255,0.45)); background: rgba(255,255,255,0.5);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; outline: none; resize: vertical;
  transition: background var(--transition), border-color var(--transition);
}
.edit-bio-form input:focus, .edit-bio-form textarea:focus { border-color: var(--fb-blue); background: rgba(255,255,255,0.85); }
.edit-bio-form .btn-row { display: flex; gap: 8px; }

/* ---------------------------------------------------------------------
   14. Friends grid
   --------------------------------------------------------------------- */
.friends-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding: 16px; }
.friend-card {
  padding: 12px; display: flex; align-items: center; gap: 10px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.friend-card:hover { transform: translateY(-2px); box-shadow: var(--glass-shadow-hover); }
.friend-card .fname { font-size: 14px; font-weight: 700; }
.friend-card .fstatus { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------------
   15. Messages
   --------------------------------------------------------------------- */
.messages-wrap { display: flex; gap: 0; height: 72vh; overflow: hidden; }
.thread-list { width: 250px; border-right: 1px solid rgba(0,0,0,0.07); overflow-y: auto; border-radius: var(--radius-lg) 0 0 var(--radius-lg); flex-shrink: 0; background: transparent !important; }
.thread-item { display: flex; align-items: center; gap: 10px; padding: 12px; cursor: pointer; transition: background var(--transition); }
.thread-item:hover, .thread-item.active { background: rgba(24,119,242,0.1); }
.chat-panel { flex: 1; display: flex; flex-direction: column; border-radius: 0 var(--radius-lg) var(--radius-lg) 0; min-width: 0; }
.chat-header { padding: 12px 16px; border-bottom: 1px solid rgba(0,0,0,0.07); font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; gap: 10px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; background: rgba(255,255,255,0.15); display: flex; flex-direction: column; gap: 8px; }
.msg-row { display: flex; margin-bottom: 2px; align-items: flex-end; gap: 8px; }
.msg-row.mine { justify-content: flex-end; }
.msg-bubble-wrapper { max-width: 70%; display: flex; flex-direction: column; }
.msg-row.mine .msg-bubble-wrapper { align-items: flex-end; }
.msg-bubble { max-width: 100%; padding: 9px 14px; border-radius: 18px; font-size: 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.msg-bubble.mine { background: linear-gradient(135deg, var(--fb-blue), #4fa8ff); color: white; border-bottom-right-radius: 4px; }
.msg-bubble.theirs { background: rgba(255,255,255,0.75); color: var(--ink); border-bottom-left-radius: 4px; }
.msg-time { font-size: 0.7rem; color: var(--muted); margin-top: 2px; padding: 0 4px; }
.msg-attachment { margin-top: 4px; border-radius: var(--radius-sm); overflow: hidden; max-width: 100%; }
.msg-attachment img, .msg-attachment video { max-width: 100%; max-height: 300px; border-radius: var(--radius-sm); display: block; }
.file-download { display: inline-block; background: rgba(255,255,255,0.3); padding: 5px 12px; border-radius: var(--radius-sm); font-size: 0.8rem; color: inherit; text-decoration: none; }

.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(0,0,0,0.07); align-items: center; flex-wrap: wrap; }
.chat-input-row .input-group { flex: 1; display: flex; gap: 6px; background: rgba(255,255,255,0.5); border: 1px solid var(--glass-border, rgba(255,255,255,0.45)); border-radius: var(--radius-pill); padding: 2px 2px 2px 16px; }
.chat-input-row input, .chat-input-row .input-group input[type="text"] { flex: 1; padding: 9px 0; border-radius: 18px; border: none; background: transparent; outline: none; }
.chat-input-row button, .chat-input-row .input-group button {
  background: linear-gradient(135deg, var(--fb-blue), #4fa8ff); color: white; border: none; padding: 0 18px;
  border-radius: var(--radius-pill); font-weight: 700; cursor: pointer; height: 38px;
}
.action-buttons { display: flex; gap: 4px; }
.action-btn { background: transparent; border: none; padding: 8px 10px; font-size: 1.2rem; cursor: pointer; border-radius: 50%; color: var(--muted); transition: background var(--transition); }
.action-btn:hover { background: rgba(24,119,242,0.1); }
.action-btn.recording { color: #e0245e; animation: pulse 1s infinite; }
@keyframes pulse { 0%{transform:scale(1);} 50%{transform:scale(1.12);} 100%{transform:scale(1);} }

/* ---------------------------------------------------------------------
   16. Search results
   --------------------------------------------------------------------- */
.search-results-wrap { display: flex; flex-direction: column; gap: 10px; }
.search-result-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; transition: transform var(--transition); }
.search-result-card:hover { transform: translateY(-2px); }
.search-result-info { flex: 1; min-width: 0; }
.search-result-info .name { font-weight: 700; color: var(--ink); font-size: 15px; }
.search-result-info .bio { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results-wrap h1 { font-size: 20px; margin: 0 0 16px; color: var(--ink); }
.search-badge { font-size: 12px; font-weight: 600; color: var(--muted); background: rgba(0,0,0,0.05); padding: 4px 10px; border-radius: var(--radius-pill); }
.search-empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* ---------------------------------------------------------------------
   17. Footer
   --------------------------------------------------------------------- */
.app-footer {
  background: var(--glass-bg, rgba(255,255,255,0.55)) !important;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-border, rgba(255,255,255,0.45));
  padding: 16px 20px;
  margin-top: 20px;
  width: 100%;
}
.footer-content { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 0.85rem; color: var(--muted); }
.footer-content p { margin: 0; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); transition: color var(--transition); }
.footer-links a:hover { color: var(--fb-blue); text-decoration: underline; }

.empty-state { text-align: center; color: var(--muted); padding: 30px; font-size: 14px; }

/* =====================================================================
   19. RESPONSIVE BREAKPOINTS — mobile-first adjustments
   ===================================================================== */

/* ----- Large desktop / wide screens ≥1280px : full 3-column FB layout, already default above ----- */

/* ----- Small desktop / laptop 992px–1279px : hide the right "contacts" column, keep left nav ----- */
@media (max-width: 1279px) {
  .container > .sidebar:last-of-type,
  .page-wrap > .sidebar:last-of-type {
    display: none;
  }
  .center-col { max-width: 680px; }
}

/* ----- Tablet 768px–991px : collapse BOTH sidebars, single centered feed column ----- */
@media (max-width: 991px) {
  .sidebar { display: none !important; }
  .center-col { width: 100%; max-width: 640px; flex: 1 1 100%; }
  .page-wrap, .container { padding: 18px 14px; gap: 0; }
  .topnav-left { width: auto; flex: 1; }
}

/* ----- Mobile ≤767px -----
   Note: this project's own includes/header.php already provides a
   hamburger + off-canvas mobile menu and hides .topnav-center at
   ≤900px, so we deliberately do NOT touch topnav-center here. */
@media (max-width: 767px) {
  .topnav { padding: 0 10px; }
  .topnav-left { gap: 8px; }
  .logo-circle { width: 36px; height: 36px; font-size: 18px; }

  .page-wrap, .container { padding: 14px 10px; }
  .card { border-radius: var(--radius-md); margin-bottom: 12px; }
  .post-media img, .post-media video { max-height: 360px; }

  .friends-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding: 12px; }

  .cover-photo-wrapper, .cover-photo { height: 180px; }
  .profile-pic-wrapper img, .profile-head .avatar { width: 120px; height: 120px; }
  .profile-head { margin-top: -50px; }

  .login-topbar { padding: 0 14px; }
  .auth-wrap { margin: 30px auto; }
}

/* ----- Extra small phones ≤480px ----- */
@media (max-width: 480px) {
  .nav-icon { font-size: 20px; }
  .logo-circle { width: 32px; height: 32px; font-size: 16px; }
  .story-item { flex-basis: 84px; }
  .story-avatar { width: 84px; height: 128px; }
  .post-header { padding: 12px 10px 6px; }
  .post-content-wrapper, .comments-block { padding-left: 10px; padding-right: 10px; }
  .composer-actions button, .composer-actions label { font-size: 12px; padding: 6px 8px; }
  .login-wordmark, .login-brand h1 { font-size: 28px; }
  .friend-card { flex-direction: column; text-align: center; }
  .profile-actions { flex-direction: column; width: 100%; }
  .profile-actions .small-btn, .profile-actions .small-btn.grey { width: 100%; }
}

/* ----- Fold / very narrow ≤340px ----- */
@media (max-width: 340px) {
  .logo-circle { display: none; }
}

/* ----- Large screens ≥1600px : give the feed a touch more room ----- */
@media (min-width: 1600px) {
  .page-wrap, .container { max-width: 1400px; }
  .center-col { max-width: 720px; }
}

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