/* =========================================================
   FaceVibe — "Midnight Aurora" theme
   Palette: #0F1123 (base) / #171A33 (surface) / #7C5CFC (violet)
            #FF6B6B (coral) / #2DD4BF (teal) / #E8E9F3 (text-hi)
   Display: Sora | Body: Inter
   ========================================================= */

:root{
  --bg: #0F1123;
  --surface: #171A33;
  --surface-2: #1F2340;
  --border: #2A2E52;
  --text-hi: #E8E9F3;
  --text-mid: #A6A9C8;
  --text-low: #6E7194;
  --violet: #7C5CFC;
  --violet-dim: #5B41C9;
  --coral: #FF6B6B;
  --teal: #2DD4BF;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text-hi);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3{ font-family:'Sora', sans-serif; margin:0; }
button{ font-family:'Inter', sans-serif; cursor:pointer; border:none; }
input, textarea{ font-family:'Inter', sans-serif; }
.hidden{ display:none !important; }

/* ---------- Auth screen ---------- */
.auth-screen{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  overflow:hidden;
  padding: 24px;
}
.auth-aurora{
  position:absolute; inset:-20%;
  background:
    radial-gradient(circle at 20% 25%, rgba(124,92,252,0.35), transparent 45%),
    radial-gradient(circle at 80% 20%, rgba(45,212,191,0.25), transparent 40%),
    radial-gradient(circle at 60% 80%, rgba(255,107,107,0.22), transparent 45%);
  filter: blur(40px);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift{
  from{ transform: translate3d(0,0,0) scale(1); }
  to{ transform: translate3d(-3%, 2%, 0) scale(1.08); }
}
.auth-card{
  position:relative;
  z-index:1;
  background: rgba(23,26,51,0.75);
  backdrop-filter: blur(18px);
  border:1px solid var(--border);
  border-radius: 24px;
  padding: 48px 40px;
  max-width: 380px;
  width:100%;
  text-align:center;
  box-shadow: var(--shadow);
}
.auth-logo{ display:flex; align-items:center; justify-content:center; gap:10px; margin-bottom:6px; }
.logo-mark{
  width:40px; height:40px; border-radius:12px;
  background: linear-gradient(135deg, var(--violet), var(--coral));
  display:flex; align-items:center; justify-content:center;
  font-family:'Sora',sans-serif; font-weight:800; font-size:15px; color:#fff;
}
.logo-mark.small{ width:28px; height:28px; font-size:11px; border-radius:8px; }
.auth-logo h1{ font-size:26px; font-weight:800; }
.auth-logo h1 span{ color: var(--violet); }
.auth-tagline{ color:var(--text-mid); font-size:14px; margin: 6px 0 28px; }
.btn-google{
  width:100%; display:flex; align-items:center; justify-content:center; gap:10px;
  background:#fff; color:#1f1f1f; font-weight:600; font-size:14.5px;
  padding:13px 18px; border-radius: var(--radius-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-google:hover{ transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255,255,255,0.15); }
.auth-note{ color: var(--text-low); font-size:12px; margin-top:18px; }

/* ---------- App shell ---------- */
.app-shell{ min-height:100vh; display:flex; flex-direction:column; }

.topbar{
  height:64px; flex-shrink:0;
  display:flex; align-items:center; gap:20px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top:0; z-index:50;
}
.topbar-logo{
  display:flex; align-items:center; gap:8px;
  font-family:'Sora',sans-serif; font-weight:800; font-size:17px;
  flex-shrink:0;
}
.topbar-search{ position:relative; flex:1; max-width:340px; }
.topbar-search input{
  width:100%; background: var(--surface-2); border:1px solid var(--border);
  border-radius: 999px; padding:9px 16px; color:var(--text-hi); font-size:13.5px; outline:none;
}
.topbar-search input:focus{ border-color: var(--violet); }
.search-results{
  position:absolute; top:calc(100% + 6px); left:0; right:0;
  background: var(--surface-2); border:1px solid var(--border);
  border-radius: var(--radius-sm); overflow:hidden; box-shadow: var(--shadow);
  max-height: 320px; overflow-y:auto; z-index: 60;
}
.search-result-item{
  display:flex; align-items:center; gap:10px; padding:10px 14px; cursor:pointer;
  transition: background .12s ease;
}
.search-result-item:hover{ background: rgba(124,92,252,0.12); }

.topbar-actions{ margin-left:auto; display:flex; align-items:center; gap:6px; }
.icon-btn{
  position:relative; background:transparent; border-radius:10px;
  width:40px; height:40px; font-size:18px; color: var(--text-mid);
  display:flex; align-items:center; justify-content:center;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover{ background: var(--surface-2); color: var(--text-hi); }
.badge{
  position:absolute; top:2px; right:2px; background: var(--coral); color:#fff;
  font-size:10px; font-weight:700; min-width:16px; height:16px; border-radius:999px;
  display:flex; align-items:center; justify-content:center; padding:0 3px;
}
.topbar-avatar{ width:30px; height:30px; border-radius:50%; object-fit:cover; }
.topbar-logo-avatar{ width:28px; height:28px; border-radius:50%; object-fit:cover; border:1.5px solid var(--violet); flex-shrink:0; }

.app-main{ flex:1; padding: 24px 16px 88px; display:flex; justify-content:center; }
.view{ display:none; width:100%; max-width: 640px; }
.view.active{ display:block; }
#view-friends.active, #view-chat.active{ max-width: 760px; }

.card{
  background: var(--surface);
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

/* ---------- Composer / Feed ---------- */
.composer{ margin-bottom: 18px; }
.composer-row{ display:flex; gap:12px; }
.avatar{ width:42px; height:42px; border-radius:50%; object-fit:cover; background:var(--surface-2); flex-shrink:0; }
.avatar.xl{ width:88px; height:88px; }
#post-text{
  flex:1; resize:none; background: var(--surface-2); border:1px solid var(--border);
  border-radius: var(--radius-sm); padding:12px 14px; color:var(--text-hi); font-size:14.5px; outline:none;
}
#post-text:focus{ border-color: var(--violet); }
.composer-preview{ margin-top:12px; border-radius: var(--radius-sm); overflow:hidden; position:relative; }
.composer-preview img, .composer-preview video{ width:100%; max-height:320px; object-fit:cover; display:block; }
.composer-preview .remove-media{
  position:absolute; top:8px; right:8px; background: rgba(15,17,35,0.75); color:#fff;
  border-radius:50%; width:26px; height:26px; font-size:14px;
}
.composer-footer{ display:flex; align-items:center; justify-content:space-between; margin-top:12px; }
.media-upload-btn{
  color: var(--text-mid); font-size:13.5px; cursor:pointer;
  padding:8px 12px; border-radius: var(--radius-sm); transition: background .15s ease;
}
.media-upload-btn:hover{ background: var(--surface-2); }
.upload-progress{ margin-top:10px; font-size:12.5px; color: var(--teal); }

.btn-primary{
  background: linear-gradient(135deg, var(--violet), var(--violet-dim));
  color:#fff; font-weight:600; font-size:13.5px;
  padding:10px 20px; border-radius: 999px;
  transition: transform .15s ease, opacity .15s ease;
}
.btn-primary:hover{ transform: translateY(-1px); }
.btn-primary:disabled{ opacity:.5; cursor:not-allowed; transform:none; }
.btn-primary.small{ padding:8px 16px; font-size:13px; }
.btn-secondary{
  background: var(--surface-2); color: var(--text-hi); font-weight:600; font-size:13.5px;
  padding:10px 20px; border-radius:999px; border:1px solid var(--border);
}
.btn-outline{
  background:transparent; border:1px solid var(--violet); color: var(--violet);
  font-weight:600; font-size:12.5px; padding:7px 14px; border-radius:999px;
}
.btn-outline.danger{ border-color: var(--coral); color: var(--coral); }
.btn-outline.subtle{ border-color: var(--border); color: var(--text-mid); }

.feed-list{ display:flex; flex-direction:column; gap:16px; }
.post-card{ padding:16px; }
.post-head{ display:flex; align-items:center; gap:12px; }
.post-head-info{ display:flex; flex-direction:column; }
.post-author{ font-weight:700; font-size:14.5px; }
.post-time{ font-size:12px; color: var(--text-low); }
.post-text{ margin:12px 0; font-size:14.5px; line-height:1.6; white-space:pre-wrap; }
.post-media{ border-radius: var(--radius-sm); overflow:hidden; margin-bottom:10px; }
.post-media img, .post-media video{ width:100%; max-height:460px; object-fit:cover; display:block; }
.post-stats{ display:flex; gap:16px; font-size:12.5px; color: var(--text-low); padding: 8px 0; border-bottom:1px solid var(--border); }
.post-actions{ display:flex; gap:6px; padding-top:8px; }
.post-action-btn{
  flex:1; background:transparent; color: var(--text-mid); font-size:13px; font-weight:600;
  padding:8px; border-radius: var(--radius-sm); display:flex; align-items:center; justify-content:center; gap:6px;
  transition: background .15s ease, color .15s ease;
}
.post-action-btn:hover{ background: var(--surface-2); }
.post-action-btn.liked{ color: var(--coral); }
.comments-box{ margin-top:10px; border-top:1px solid var(--border); padding-top:10px; }
.comment-item{ display:flex; gap:8px; margin-bottom:8px; font-size:13px; }
.comment-item .avatar{ width:28px; height:28px; }
.comment-bubble{ background: var(--surface-2); border-radius: var(--radius-sm); padding:7px 12px; }
.comment-bubble strong{ display:block; font-size:12.5px; margin-bottom:2px; }
.comment-input-row{ display:flex; gap:8px; margin-top:8px; }
.comment-input-row input{
  flex:1; background: var(--surface-2); border:1px solid var(--border); border-radius:999px;
  padding:8px 14px; color:var(--text-hi); font-size:13px; outline:none;
}

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

/* ---------- Friends / Follow view ---------- */
.panel-col{ display:flex; flex-direction:column; gap:14px; }
.tabs{ display:flex; gap:4px; border-bottom:1px solid var(--border); padding-bottom:2px; }
.tab-btn{
  background:transparent; color: var(--text-mid); font-size:13.5px; font-weight:600;
  padding:10px 16px; border-bottom:2px solid transparent;
}
.tab-btn.active{ color: var(--violet); border-color: var(--violet); }
.tab-panel{ display:none; }
.tab-panel.active{ display:block; }
.tab-panel h3{ font-size:14px; color: var(--text-mid); margin-bottom:10px; }
.tab-panel h3.mt{ margin-top:20px; }
.user-list{ display:flex; flex-direction:column; gap:10px; }
.user-row{
  display:flex; align-items:center; gap:12px; padding:10px; border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.user-row .user-info{ flex:1; min-width:0; }
.user-row .user-name{ font-weight:600; font-size:14px; }
.user-row .user-sub{ font-size:12px; color: var(--text-low); }
.user-row-actions{ display:flex; gap:6px; }

/* ---------- Chat view ---------- */
.chat-shell{ display:flex; height: 70vh; padding:0; overflow:hidden; }
.chat-sidebar{ width:220px; flex-shrink:0; border-right:1px solid var(--border); overflow-y:auto; }
.chat-sidebar-header{ padding:14px 16px; font-weight:700; font-size:14px; border-bottom:1px solid var(--border); }
.chat-thread-list{ display:flex; flex-direction:column; }
.chat-thread-item{
  display:flex; align-items:center; gap:10px; padding:12px 14px; cursor:pointer;
  border-bottom:1px solid var(--border); transition: background .15s ease;
}
.chat-thread-item:hover, .chat-thread-item.active{ background: var(--surface-2); }
.chat-thread-item .avatar{ width:36px; height:36px; }
.chat-thread-name{ font-size:13.5px; font-weight:600; }
.chat-thread-preview{ font-size:11.5px; color: var(--text-low); max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-main{ flex:1; display:flex; flex-direction:column; position:relative; }
.chat-header{ display:flex; align-items:center; gap:10px; padding:14px 16px; border-bottom:1px solid var(--border); font-weight:600; }
.chat-header .avatar{ width:34px; height:34px; }
.chat-active{ flex:1; display:flex; flex-direction:column; min-height:0; }
.chat-messages{ flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:8px; }
.chat-msg{ max-width:70%; padding:9px 14px; border-radius:16px; font-size:13.5px; line-height:1.45; }
.chat-msg.mine{ align-self:flex-end; background: linear-gradient(135deg, var(--violet), var(--violet-dim)); color:#fff; border-bottom-right-radius:4px; }
.chat-msg.theirs{ align-self:flex-start; background: var(--surface-2); border-bottom-left-radius:4px; }
.chat-input-row{ display:flex; gap:10px; padding:14px; border-top:1px solid var(--border); }
.chat-input-row input{
  flex:1; background: var(--surface-2); border:1px solid var(--border); border-radius:999px;
  padding:10px 16px; color:var(--text-hi); font-size:13.5px; outline:none;
}

/* ---------- Profile view ---------- */
.profile-header{ display:flex; gap:20px; align-items:flex-start; margin-bottom:18px; }
.profile-info{ flex:1; }
.profile-bio{ color: var(--text-mid); font-size:13.5px; margin: 6px 0 12px; }
.profile-stats{ display:flex; gap:18px; font-size:13px; color: var(--text-mid); margin-bottom:14px; }
.profile-stats strong{ color: var(--text-hi); }
.profile-actions{ display:flex; gap:8px; }

/* ---------- Modal ---------- */
.modal{ position:fixed; inset:0; background: rgba(5,6,15,0.65); backdrop-filter: blur(4px); display:flex; align-items:center; justify-content:center; z-index:200; }
.modal-box{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding:24px; width:100%; max-width:380px;
}
.modal-box h3{ margin-bottom:16px; }
.modal-box label{ display:block; font-size:12.5px; color: var(--text-mid); margin: 10px 0 5px; }
.modal-box input, .modal-box textarea{
  width:100%; background: var(--surface-2); border:1px solid var(--border); border-radius: var(--radius-sm);
  padding:10px 12px; color: var(--text-hi); font-size:13.5px; outline:none; resize:none;
}
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }

/* ---------- Toast ---------- */
.toast{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%);
  background: var(--surface-2); border:1px solid var(--border); color:var(--text-hi);
  padding:12px 20px; border-radius:999px; font-size:13px; box-shadow: var(--shadow); z-index:300;
}

/* ---------- Bottom nav (Facebook-style) ---------- */
.bottom-nav{
  position: fixed; bottom:0; left:0; right:0; z-index: 100;
  height: 56px; background: var(--surface); border-top: 1px solid var(--border);
  display:flex; align-items:center; justify-content:space-around;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-btn{
  position:relative; background:transparent; flex:1; height:100%;
  display:flex; align-items:center; justify-content:center; font-size:22px;
  color: var(--text-mid); transition: color .15s ease;
}
.bottom-nav-btn.active{ color: var(--violet); }
.bottom-nav-btn .badge{ top:6px; right: calc(50% - 22px); }
.bottom-nav-avatar{ width:26px; height:26px; border-radius:50%; object-fit:cover; }
.bottom-nav-btn.active .bottom-nav-avatar{ border:2px solid var(--violet); }

/* ---------- Edit profile photo row ---------- */
.edit-photo-row{ display:flex; flex-direction:column; align-items:center; gap:10px; margin-bottom:6px; }
.edit-photo-btn{ cursor:pointer; }
.profile-username{ color: var(--text-low); font-size:13px; margin: 0 0 8px; }

@media (max-width: 720px){
  .topbar-search{ display:none; }
  .chat-shell{ height: 78vh; }
  .chat-sidebar{ width:150px; }
  .profile-header{ flex-direction:column; align-items:center; text-align:center; }
  .profile-stats{ justify-content:center; }
}
