/* Site-wide mobile app chrome: tab bar + social feed/chats (demo → production) */
:root {
  --app-tab-h: 64px;
}

body.has-app-tabbar {
  padding-bottom: calc(var(--app-tab-h) + env(safe-area-inset-bottom, 0px));
}

.app-tabbar {
  display: none;
}

@media (max-width: 860px) {
  .app-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: calc(var(--app-tab-h) + env(safe-area-inset-bottom, 0px));
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(253, 251, 247, 0.94);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(232, 228, 221, 0.95);
  }

  .app-tabbar__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #928b82;
    font-size: 0.66rem;
    font-weight: 600;
    text-decoration: none;
  }

  .app-tabbar__item svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .app-tabbar__item.is-on,
  .app-tabbar__item[aria-current="page"] {
    color: #348f85;
  }

  .app-tabbar__badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #348f85;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: grid;
    place-items: center;
  }

  .app-tabbar__badge:empty,
  .app-tabbar__badge[hidden] {
    display: none !important;
  }

  /* Hide legacy LK bottom tabs when global app tabbar is present */
  body.has-app-tabbar .lk-body-wrap--with-sidebar .lk-sidebar-col {
    display: none !important;
  }

  body.has-app-tabbar.lk-page-site .lk-body-wrap--with-sidebar {
    display: block;
  }
}

/* Feed posts — VK-like */
.lk-social-post {
  padding: 14px 0 8px;
  border-bottom: 8px solid rgba(235, 230, 222, 0.9);
  list-style: none;
}

.lk-social-post__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.lk-social-post__av {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #ebe6de;
  flex: 0 0 auto;
}

.lk-social-post__who {
  margin: 0;
  font-weight: 700;
  color: #3f3a33;
  font-size: 0.95rem;
}

.lk-social-post__when {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: #928b82;
}

.lk-social-post__text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #6c665d;
  white-space: pre-wrap;
}

.lk-social-post__media {
  display: block;
  width: calc(100% + 0px);
  margin: 12px 0 0;
  max-height: 360px;
  object-fit: cover;
  border-radius: 4px;
  background: #ebe6de;
}

.lk-social-post__actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.lk-social-post__act {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #928b82;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.lk-social-post__act:hover {
  background: rgba(52, 143, 133, 0.1);
  color: #2a756d;
}

.lk-social-post__act.is-on {
  color: #348f85;
}

.lk-social-comments {
  margin-top: 8px;
  padding: 8px 0 0;
  border-top: 1px solid #e8e4dd;
}

.lk-social-comment {
  padding: 8px 0;
  font-size: 0.88rem;
  color: #6c665d;
}

.lk-social-comment strong {
  color: #3f3a33;
}

.lk-social-comment-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.lk-social-comment-form input {
  flex: 1;
  border: 0;
  border-bottom: 1.5px solid #e8e4dd;
  background: transparent;
  padding: 8px 0;
  font: inherit;
  outline: none;
}

.lk-social-comment-form input:focus {
  border-bottom-color: #348f85;
}

/* Friends */
.lk-social-friend {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #e8e4dd;
  list-style: none;
}

.lk-social-friend__av {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #ebe6de;
}

.lk-social-friend__name {
  margin: 0;
  font-weight: 700;
  color: #3f3a33;
}

.lk-social-friend__meta {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: #928b82;
}

.lk-social-friend__acts {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Chats */
.lk-chat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid #e8e4dd;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.lk-chat-row:hover {
  background: rgba(52, 143, 133, 0.05);
}

.lk-chat-row__av {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: #ebe6de;
  flex: 0 0 auto;
}

.lk-chat-row__body {
  flex: 1;
  min-width: 0;
}

.lk-chat-row__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.lk-chat-row__name {
  margin: 0;
  font-weight: 700;
  color: #3f3a33;
}

.lk-chat-row__time {
  font-size: 0.75rem;
  color: #928b82;
}

.lk-chat-row__preview {
  margin: 3px 0 0;
  font-size: 0.86rem;
  color: #928b82;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lk-chat-row__badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #348f85;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.lk-chat-thread {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  border: 1px solid #e8e4dd;
  border-radius: 14px;
  overflow: hidden;
  background: #fdfbf7;
}

.lk-chat-thread[hidden] {
  display: none !important;
}

.lk-chat-thread__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #e8e4dd;
}

.lk-chat-thread__msgs {
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow: auto;
  background: linear-gradient(180deg, #f7f4ef, #f5f3ef);
}

.lk-chat-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.4;
}

.lk-chat-bubble--in {
  align-self: flex-start;
  background: #ebe6de;
  color: #3f3a33;
  border-bottom-left-radius: 4px;
}

.lk-chat-bubble--out {
  align-self: flex-end;
  background: linear-gradient(160deg, #4aa89c, #348f85);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.lk-chat-bubble time {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  opacity: 0.7;
}

.lk-chat-thread__composer {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid #e8e4dd;
  background: #fdfbf7;
}

.lk-chat-thread__composer input {
  flex: 1;
  border: 0;
  border-bottom: 1.5px solid #e8e4dd;
  background: transparent;
  padding: 10px 4px;
  font: inherit;
  outline: none;
}

.lk-chat-thread__composer input:focus {
  border-bottom-color: #348f85;
}

/* Profile cover (mobile-app style) */
.lk-profile__cover {
  position: relative;
  height: 140px;
  margin: 0 0 48px;
  border-radius: 14px;
  overflow: hidden;
  background: center / cover no-repeat url("/assets/images/social/cover-default.jpg");
}

.lk-profile__cover-av {
  position: absolute;
  left: 16px;
  bottom: -36px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid #fdfbf7;
  object-fit: cover;
  background: #ebe6de;
  box-shadow: 0 8px 20px rgba(63, 58, 51, 0.12);
}

.lk-profile__subs {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 0 0;
  margin: 12px 0 8px;
  border-bottom: 1px solid #e8e4dd;
  scrollbar-width: none;
}

.lk-profile__subs::-webkit-scrollbar {
  display: none;
}

.lk-profile__sub {
  flex: 0 0 auto;
  padding: 10px 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: #928b82;
  cursor: pointer;
  position: relative;
}

.lk-profile__sub.is-on {
  color: #3f3a33;
}

.lk-profile__sub.is-on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: #348f85;
}

.lk-profile__panel[hidden] {
  display: none !important;
}

/* —— Mobile app chrome (demo 1:1) —— */
@media (max-width: 860px) {
  body.has-app-tabbar .site-header,
  body.has-app-tabbar .site-footer {
    display: none !important;
  }

  body.has-app-tabbar {
    padding-bottom: calc(var(--app-tab-h) + env(safe-area-inset-bottom, 0px) + 8px);
  }

  body.has-app-tabbar .site-account-main,
  body.has-app-tabbar .booking-page,
  body.has-app-tabbar main#main {
    padding-top: 0;
  }

  body.has-app-tabbar .lk-profile__page-head,
  body.has-app-tabbar .lk-profile__mode-switch,
  body.has-app-tabbar .lk-profile__feed-aside {
    display: none !important;
  }

  body.has-app-tabbar .lk-profile__feed-layout {
    display: block;
  }

  .app-screen-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
    margin: 0 -4px 0;
    background: rgba(253, 251, 247, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(232, 228, 221, 0.9);
  }

  .app-screen-topbar h1,
  .app-screen-topbar .app-screen-topbar__title {
    margin: 0;
    font-family: var(--display, var(--serif));
    font-size: 1.35rem;
    font-weight: 550;
    color: var(--text-heading);
  }

  .lk-profile__feed-head {
    display: none !important;
  }

  .lk-profile__feed-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 16px 4px;
    margin: 0 -4px;
    scrollbar-width: none;
  }

  .lk-profile__feed-chips::-webkit-scrollbar {
    display: none;
  }

  .lk-profile__chip-filter {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 252, 247, 0.9);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
  }

  .lk-profile__chip-filter[aria-selected="true"] {
    color: #fff;
    background: var(--accent);
    border-color: transparent;
  }

  .lk-profile__feed-composer.lk-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 12px 4px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 252, 247, 0.9);
    box-shadow: none;
  }

  .lk-profile__feed-composer .lk-profile__label,
  .lk-profile__feed-composer-row,
  .lk-profile__feed-composer-actions .lk-profile__feed-msg {
    display: none;
  }

  .lk-profile__feed-composer #profileLkFeedBody {
    flex: 1;
    min-height: 0;
    height: auto;
    rows: 1;
    border: 0;
    background: transparent;
    padding: 8px 0;
    resize: none;
    font-size: 0.92rem;
    color: var(--text-heading);
  }

  .lk-profile__feed-composer-actions {
    margin: 0;
    flex: 0 0 auto;
  }

  .lk-profile__feed-composer-actions .lk-profile__btn {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .lk-profile__feed-list {
    margin: 0;
    padding: 8px 0 12px;
    list-style: none;
  }

  .lk-social-post {
    margin: 0;
    padding: 14px 0 10px;
    border-bottom: 8px solid rgba(235, 230, 222, 0.85);
  }

  .lk-social-post__head,
  .lk-social-post__text,
  .lk-social-post__actions,
  .lk-social-comments,
  .lk-social-comment-form {
    padding-left: 16px;
    padding-right: 16px;
  }

  .lk-social-post__media {
    width: 100%;
    max-height: none;
    aspect-ratio: 16 / 10;
    border-radius: 0;
    margin-left: 0;
    margin-right: 0;
  }

  .lk-profile__inbox-head {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
    margin: 0 -4px;
    background: rgba(253, 251, 247, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(232, 228, 221, 0.9);
  }

  .lk-profile__inbox-title {
    margin: 0;
    font-family: var(--display, var(--serif));
    font-size: 1.35rem;
    font-weight: 550;
    color: var(--text-heading);
  }

  .lk-profile__inbox-lead {
    display: none;
  }

  .lk-profile__inbox-subtabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .lk-chat-thread {
    position: fixed;
    inset: 0;
    z-index: 950;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    background: var(--surface);
  }

  .lk-chat-thread__head {
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  }

  .lk-chat-thread__msgs {
    max-height: none;
    flex: 1;
    min-height: 0;
  }

  .lk-chat-thread__composer {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  body.has-app-tabbar .lk-profile__cover {
    height: 160px;
    margin: 0 0 52px;
    border-radius: 0;
  }

  body.has-app-tabbar .lk-profile__hero .lk-profile__avatar-ring {
    display: none;
  }

  body.has-app-tabbar .lk-profile__name {
    font-family: var(--display, var(--serif));
    font-size: 1.55rem;
    font-weight: 550;
  }

  body.has-app-tabbar .lk-profile__metric--accent .lk-profile__metric-value {
    font-family: var(--display, var(--serif));
    font-size: 1.8rem;
    font-weight: 550;
  }

  body.has-app-tabbar .booking-cart-bar {
    bottom: calc(var(--app-tab-h) + env(safe-area-inset-bottom, 0px));
  }

  body.has-app-tabbar .booking-page {
    padding-bottom: calc(88px + var(--app-tab-h) + env(safe-area-inset-bottom, 0px));
  }

  body.has-app-tabbar .cart-page-content {
    padding: 12px 16px 24px;
  }

  body.has-app-tabbar .cart-page-content::before {
    content: "Корзина";
    display: block;
    font-family: var(--display, var(--serif));
    font-size: 1.7rem;
    font-weight: 550;
    letter-spacing: -0.02em;
    color: var(--text-heading);
    margin: calc(8px + env(safe-area-inset-top, 0px)) 0 4px;
  }

  body.has-app-tabbar .cart-items {
    gap: 0;
  }

  body.has-app-tabbar .cart-item {
    display: block;
    padding: 16px 0;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.has-app-tabbar .cart-item-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px 12px;
    align-items: center;
    margin: 0;
  }

  body.has-app-tabbar .cart-item-title h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
  }

  body.has-app-tabbar .cart-item-subtitle {
    display: block;
    margin: 2px 0 0;
    font-size: 0.86rem;
    color: var(--text-muted);
  }

  body.has-app-tabbar .cart-item-price {
    font-family: var(--display, var(--serif));
    font-size: 1.15rem;
    font-weight: 550;
    color: var(--text-heading);
    white-space: nowrap;
    margin: 0;
  }

  body.has-app-tabbar .cart-item-details {
    display: none;
  }

  body.has-app-tabbar .cart-item-remove {
    color: var(--text-muted);
  }

  body.has-app-tabbar .cart-footer {
    position: sticky;
    bottom: calc(var(--app-tab-h) + env(safe-area-inset-bottom, 0px));
    background: rgba(253, 251, 247, 0.94);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  }

  body.has-app-tabbar .cart-booking-btn {
    border-radius: 12px;
    background: var(--accent);
    box-shadow: none;
  }

  body.has-app-tabbar .app-tabbar {
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(253, 251, 247, 0.92);
  }

  body.has-app-tabbar .booking-page .booking-toolbar {
    position: sticky;
    top: 0;
    z-index: 30;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: rgba(253, 251, 247, 0.92);
    backdrop-filter: blur(14px);
  }
}
