/* ===================== RESET / BASE ===================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --fb-blue: #1877f2;
  --fb-blue-dark: #166fe5;
  --text-primary: #050505;
  --text-secondary: #65676b;
  --bg-page: #f0f2f5;
  --bg-card: #ffffff;
  --border-light: #e4e6eb;
  --hashtag: #1877f2;
  --radius-card: 12px;
}

html, body {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }

.app {
  max-width: 100%;
  margin: 0 auto;
  background: var(--bg-page);
}

/* ===================== HEADER ===================== */
.page-header {
  background: var(--bg-card);
  border-bottom: 8px solid var(--bg-page);
}

.cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #cfd6dd;
  overflow: hidden;
}

.cover-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.avatar-wrap {
  position: absolute;
  left: 14px;
  bottom: -46px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 4px solid var(--bg-card);
  background: var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  overflow: hidden;
}

.avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-info {
  padding: 54px 14px 12px;
}

.page-name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}

.page-stats {
  color: var(--text-secondary);
  font-size: 14.5px;
  font-weight: 500;
}

.page-posts {
  color: var(--text-secondary);
  font-size: 14.5px;
  margin-bottom: 10px;
}

.page-desc {
  font-size: 14.5px;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.page-category {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.page-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fb-blue);
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.page-address {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.page-actions {
  display: flex;
  gap: 8px;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  transition: transform .08s ease, background .15s ease, filter .15s ease;
}

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

.btn-follow {
  background: var(--fb-blue);
  color: #fff;
}
.btn-follow:hover { background: var(--fb-blue-dark); }
.btn-follow.following {
  background: #e4e6eb;
  color: var(--text-primary);
}

.btn-message {
  background: #e4e6eb;
  color: var(--text-primary);
}
.btn-message:hover { filter: brightness(0.96); }

/* ===================== TABS ===================== */
.tabs {
  display: flex;
  border-top: 1px solid var(--border-light);
  padding: 0 4px;
}

.tab {
  flex: 1;
  padding: 13px 4px 11px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}

.tab.active {
  color: var(--fb-blue);
  border-bottom-color: var(--fb-blue);
}

/* ===================== FEED ===================== */
.feed {
  padding: 10px 8px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  overflow: hidden;
  animation: fadeIn .25s ease;
}

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

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 8px;
}

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.post-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.post-name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-primary);
}

.post-time {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.post-more {
  font-size: 20px;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 50%;
}
.post-more:hover { background: var(--bg-page); }

.post-body {
  padding: 0 12px 10px;
}

.post-text {
  font-size: 14.5px;
  color: var(--text-primary);
  white-space: pre-line;
}

.post-text.short .more-content { display: none; }

.hashtag {
  color: var(--hashtag);
  font-weight: 600;
}

.toggle-text {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}
.toggle-text:hover { text-decoration: underline; }

.post-media {
  width: 100%;
  background: #f0f2f5;
}

.post-media img {
  width: 100%;
  height: auto;
  display: block;
}

.placeholder-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
  text-align: center;
  padding: 20px;
}

.placeholder-img.jo-malone {
  background: linear-gradient(135deg, #cfa15c 0%, #8a6a3a 60%, #4a3a20 100%);
}

.placeholder-img.lancome-son {
  background: linear-gradient(135deg, #e0a3b0 0%, #c0526b 55%, #7a2a3d 100%);
}

.placeholder-brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.placeholder-title {
  font-size: 15px;
  font-weight: 500;
  opacity: .95;
}

.post-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

.like-count { display: flex; align-items: center; gap: 4px; }
.like-icon { font-size: 13px; }

.post-actions {
  display: flex;
  padding: 2px 4px;
}

.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: background .15s ease, color .15s ease;
}

.action-btn:hover { background: var(--bg-page); }

.action-btn.like-btn[data-liked="true"] {
  color: var(--fb-blue);
}
.action-btn.like-btn[data-liked="true"] svg {
  fill: var(--fb-blue);
  stroke: var(--fb-blue);
}

.action-btn svg { transition: transform .15s ease; }
.action-btn.like-btn.pop svg { transform: scale(1.3); }

/* comments */
.comment-box {
  border-top: 1px solid var(--border-light);
  padding: 8px 12px 10px;
  display: none;
}
.comment-box.open { display: block; }

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.comment-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.comment-item img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-bubble {
  background: var(--bg-page);
  border-radius: 14px;
  padding: 6px 12px;
  font-size: 13.5px;
}

.comment-bubble .cname {
  font-weight: 700;
  display: block;
  font-size: 12.5px;
}

.comment-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-input {
  flex: 1;
  border: none;
  background: var(--bg-page);
  border-radius: 16px;
  padding: 8px 12px;
  font-size: 13.5px;
  outline: none;
}

.comment-send {
  color: var(--fb-blue);
  font-weight: 700;
  font-size: 13.5px;
  padding: 6px 4px;
}
.comment-send:disabled { color: var(--text-secondary); cursor: default; }

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

/* ===================== BOTTOM NAV ===================== */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 54px;
  background: #fff;
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -1px 6px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  max-width: 680px;
  margin: 0 auto;
}

.nav-item {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  position: relative;
  transition: color .15s ease;
}

.nav-item svg { transition: transform .15s ease; }

.nav-item.active {
  color: var(--fb-blue);
}

.nav-item.bump svg,
.nav-item.bump .nav-avatar {
  transform: scale(1.15);
}

.nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid transparent;
  transition: border-color .15s ease, transform .15s ease;
}

.nav-item.active .nav-avatar {
  border-color: var(--fb-blue);
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 20px);
  background: #e41e3f;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 5px;
  line-height: 1.3;
}

/* ===================== CONTACT FORM PAGE (NHẮN TIN) ===================== */
.form-page {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 150;
  overflow-y: auto;
}

.form-page[hidden] { display: none; }

.form-page-inner {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100%;
  padding: 14px 24px 40px;
  display: flex;
  flex-direction: column;
  animation: slideInForm .22s ease;
}

@keyframes slideInForm {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.form-page-header {
  display: flex;
  align-items: center;
  height: 44px;
}

.form-back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-primary);
}

.form-back:hover { background: var(--bg-page); }

.form-page-logo {
  display: flex;
  justify-content: center;
  margin: 16px 0 14px;
}

.form-page-logo-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--fb-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.form-page-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-page-sub {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  padding: 0 8px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
}

.form-field input,
.form-field textarea {
  width: 100%;
  border: 1.5px solid #dcdfe3;
  border-radius: 14px;
  padding: 15px 16px;
  font-size: 16px;
  color: var(--text-primary);
  background: #fff;
  outline: none;
  font-family: inherit;
  transition: border-color .15s ease;
}

.form-field textarea {
  resize: none;
  min-height: 96px;
  line-height: 1.4;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--fb-blue);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: #9aa0a6;
}

.form-submit-btn {
  margin-top: 8px;
  width: 100%;
  background: var(--fb-blue);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 15px;
  border-radius: 14px;
  transition: background .15s ease;
}

.form-submit-btn:hover { background: var(--fb-blue-dark); }
.form-submit-btn:disabled { opacity: .6; cursor: default; }

/* ===================== TOAST ===================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(0,0,0,.82);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 200;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===================== DESKTOP / TABLET ===================== */
@media (min-width: 640px) {
  body { background: #ebedf0; }

  .app {
    max-width: 640px;
    box-shadow: 0 0 0 1px rgba(0,0,0,.03);
  }

  .feed { padding: 12px 12px 0; gap: 14px; }

  .page-info { padding: 58px 20px 16px; }

  .avatar-wrap {
    left: 20px;
    width: 108px;
    height: 108px;
    bottom: -50px;
  }

  .page-name { font-size: 24px; }

  .tabs { padding: 0 12px; }

  .bottom-nav { max-width: 640px; }
}

@media (min-width: 900px) {
  .app { max-width: 680px; }
  .bottom-nav { max-width: 680px; }
}

@media (min-width: 640px) {
  .form-page { background: var(--bg-page); }

  .form-page-inner {
    margin: 40px auto;
    min-height: auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    padding: 18px 28px 32px;
  }
}
