/* Facebutt - Facebook-style layout, edge-to-edge, English */
:root {
  --fb-blue: #e67e22;
  --fb-blue-hover: #d35400;
  --fb-blue-dark: #bf5a00;
  --bg-main: #f5f0eb;
  --bg-secondary: #fff;
  --bg-tertiary: #ebe4dc;
  --text-primary: #050505;
  --text-secondary: #65676b;
  --divider: #ddd6ce;
  --hover-overlay: rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  padding-top: 56px;
}

/* Top bar - same grid as content so center nav aligns with feed/stories */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--fb-blue);
  display: grid;
  grid-template-columns: 360px 1fr 360px;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.5rem;
  margin-right: 8px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
}

.search-box {
  flex: 1;
  max-width: 240px;
  background: var(--fb-blue-dark);
  border-radius: 50px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
}

.search-box input {
  background: none;
  border: none;
  color: #fff;
  font-size: 0.9375rem;
  outline: none;
  width: 100%;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-icon {
  width: 20px;
  height: 20px;
  color: rgba(255, 255, 255, 0.8);
}

.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.nav-item {
  width: 112px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  border-radius: 0;
  transition: background 0.2s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
  color: #fff;
  border-bottom: 3px solid #fff;
}

.nav-item svg {
  width: 28px;
  height: 28px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-icon {
  color: #fff;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  text-decoration: none;
  transition: background 0.2s;
}

.topbar-icon:hover {
  background: rgba(255, 255, 255, 0.15);
}

.topbar-svg {
  width: 24px;
  height: 24px;
}

.topbar-icon.has-badge .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  background: #e41e3a;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.twitter-btn {
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
}

.twitter-icon {
  width: 20px;
  height: 20px;
}

.twitter-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.profile-dropdown {
  gap: 4px;
}

.dropdown-arrow {
  width: 16px;
  height: 16px;
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
}

.avatar.small {
  width: 36px;
  height: 36px;
  font-size: 0.8rem;
}

/* Main layout - edge to edge */
.main-wrapper {
  display: grid;
  grid-template-columns: 360px 1fr 360px;
  gap: 0;
  min-height: calc(100vh - 56px);
  max-width: 100%;
  padding: 0;
}

@media (max-width: 1200px) {
  .topbar {
    grid-template-columns: 72px 1fr 300px;
  }
  .main-wrapper {
    grid-template-columns: 72px 1fr 300px;
  }
  .sidebar.left .sidebar-link span:not(.icon-box) {
    display: none;
  }
  .sidebar-footer {
    font-size: 0.7rem;
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }
  .topbar-center {
    display: none;
  }
  .main-wrapper {
    grid-template-columns: 1fr;
  }
  .sidebar.right {
    display: none;
  }
  .nav-item {
    width: 64px;
  }
}

/* Left sidebar */
.sidebar {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 8px 8px 16px;
  border-right: 1px solid var(--divider);
  background: var(--bg-secondary);
}

.sidebar.left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar.left .sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  padding-left: 12px;
  padding-right: 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.sidebar-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.sidebar-footer a:hover {
  text-decoration: underline;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: background 0.2s;
}

.sidebar-link:hover {
  background: var(--bg-tertiary);
}

.icon-box {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.icon-box.ai { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; }
.icon-box.friends { background: var(--fb-blue); }
.icon-box.groups { background: var(--fb-blue); }
.icon-box.market { background: #27ae60; color: #fff; }
.icon-box.reels { background: var(--fb-blue); color: #fff; }
.icon-box.watch { background: var(--fb-blue); color: #fff; }
.icon-box.memories { background: linear-gradient(135deg, #f093fb, #f5576c); color: #fff; }
.icon-box.saved { background: var(--fb-blue); color: #fff; }
.icon-box.feeds { background: var(--fb-blue); color: #fff; }
.icon-box.events { background: var(--fb-blue); color: #fff; }
.icon-box.ads { background: var(--bg-tertiary); }
.icon-box.more { background: var(--bg-tertiary); }

/* Feed - center column */
.feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

/* Password reminder card */
.password-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.password-card-inner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.password-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.password-card-icon svg {
  width: 24px;
  height: 24px;
  color: var(--fb-blue);
}

.password-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.password-card p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.password-card-btns {
  display: flex;
  gap: 8px;
}

.btn-primary {
  padding: 8px 20px;
  background: var(--fb-blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--fb-blue-hover);
}

.btn-ghost {
  padding: 8px 20px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
}

.btn-ghost:hover {
  background: #d8dadf;
}

.password-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.password-close:hover {
  color: var(--text-primary);
}

/* Create post */
.create-post {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.create-post-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.create-post-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 50px;
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 1.0625rem;
  font-family: inherit;
  text-align: left;
  cursor: text;
  transition: background 0.2s;
}

.create-post-input::placeholder {
  color: var(--text-secondary);
}

.create-post-input:hover,
.create-post-input:focus {
  background: #d8dadf;
  outline: none;
}

.create-post-actions {
  display: flex;
  justify-content: space-around;
  padding-top: 8px;
  border-top: 1px solid var(--divider);
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}

.action-btn:hover {
  background: var(--hover-overlay);
}

/* Stories - vertical images */
.story-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.story-bar::-webkit-scrollbar {
  height: 6px;
}

.story-bar::-webkit-scrollbar-thumb {
  background: var(--divider);
  border-radius: 3px;
}

.story {
  flex-shrink: 0;
  width: 112px;
  height: 200px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.story-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #e67e22 0%, #f39c12 100%);
}

.story-avatar {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid var(--fb-blue);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  font-weight: 700;
}

.story.add-story .story-avatar {
  top: auto;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border-color: var(--bg-secondary);
  color: var(--fb-blue);
  font-size: 1.25rem;
}

.story span {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.story.add-story > span:first-of-type {
  color: var(--text-primary);
  text-shadow: none;
  bottom: 32px;
}

.story-sub {
  bottom: 8px;
  font-size: 0.7rem !important;
  font-weight: 400 !important;
  color: var(--text-secondary) !important;
  text-shadow: none !important;
}

/* Post */
.post {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.post-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.post-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-name {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
}

.author-name:hover {
  text-decoration: underline;
}

.post-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.post-menu,
.post-close {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.post-menu:hover,
.post-close:hover {
  background: var(--hover-overlay);
}

.post-text {
  font-size: 0.9375rem;
  line-height: 1.3333;
  margin-bottom: 12px;
}

.post-image {
  margin: 0 -16px 12px;
  max-height: 500px;
  background: var(--bg-tertiary);
  overflow: hidden;
}

.post-image img {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
}

.post-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--divider);
}

.reactions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.post-actions {
  display: flex;
  justify-content: space-around;
  padding-top: 4px;
}

.post-actions button {
  flex: 1;
  padding: 8px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}

.post-actions button:hover {
  background: var(--hover-overlay);
}

/* Right sidebar */
.sidebar.right {
  border-right: none;
  border-left: 1px solid var(--divider);
  padding: 16px 8px;
}

.contacts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.contacts-header h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.contacts-header a,
.contacts-header button {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
}

.contacts-menu {
  margin-left: auto;
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: background 0.2s;
  position: relative;
}

.contact:hover {
  background: var(--bg-tertiary);
}

.contact .check {
  color: var(--fb-blue);
  font-weight: 700;
}

.contact-time {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.avatar.status-online {
  position: relative;
}

.avatar.status-online::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #31a24c;
  border: 2px solid var(--bg-secondary);
  border-radius: 50%;
}

.group-chats {
  margin-top: 24px;
}

.group-chats h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding: 0 4px;
}

.create-group-chat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: 8px;
  font-size: 0.9375rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s;
}

.create-group-chat:hover {
  background: #d8dadf;
}

.create-group-chat .plus {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--text-secondary);
}
