/* ================================================================
   TIKTOK COMPLETE MOBILE EXPERIENCE  
   Full TikTok-style mobile UI overhaul
================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─────────────────────────────────────────────────────────────
   1. CSS VARIABLES
───────────────────────────────────────────────────────────── */
:root {
  --tt-bg:          #fff;
  --tt-surface:     #f8f8f8;
  --tt-border:      #e8e8e8;
  --tt-text:        #161823;
  --tt-muted:       #8a8a8a;
  --tt-accent-r:    #fe2c55;
  --tt-accent-c:    #25f4ee;
  --tt-nav-h:       58px;
  --tt-header-h:    52px;
  --tt-safe-bottom: env(safe-area-inset-bottom, 0px);
  --tt-safe-top:    env(safe-area-inset-top, 0px);
  --tt-radius:      12px;
  --tt-font:        'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─────────────────────────────────────────────────────────────
   2. GLOBAL MOBILE RESETS  (≤ 940px only)
───────────────────────────────────────────────────────────── */
@media screen and (max-width: 940px) {

  * { box-sizing: border-box; }

  html, body {
    font-family: var(--tt-font) !important;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
  }

  /* Content padding so nothing hides under nav/header */
  body {
    padding-top: calc(var(--tt-header-h) + var(--tt-safe-top)) !important;
    padding-bottom: calc(var(--tt-nav-h) + var(--tt-safe-bottom) + 8px) !important;
  }

  /* Hide desktop sidebars */
  .leftSticky,
  .leftSidebarWrapper,
  .left_menu_wrapper,
  .rightSticky,
  .rightSidebarWrapper,
  .mobile_hamburger {
    display: none !important;
  }

  /* Wrapper becomes single column */
  .wrapper {
    flex-direction: column !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: auto !important;
  }

  /* Main feed column fills width */
  .pageMiddle,
  .i_section_wrapper,
  .section {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: transparent !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   3. TIKTOK TOP HEADER  (mobile only)
───────────────────────────────────────────────────────────── */
@media screen and (max-width: 940px) {

  /* Hide the original header on mobile – replace with TikTok header */
  .header {
    display: none !important;
  }

  /* TikTok header */
  .tt-header {
    display: flex !important;
  }
}


.tt-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--tt-header-h);
  padding-top: var(--tt-safe-top);
  background: var(--tt-bg);
  box-shadow: 0 1px 0 var(--tt-border);
  border-bottom: 1px solid var(--tt-border);
  z-index: 9990;
  align-items: center;
  justify-content: space-between;
  padding-left: 14px;
  padding-right: 14px;
  font-family: var(--tt-font);
}

/* Logo / Site name */
.tt-header-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none !important;
}

.tt-header-logo img {
  height: 28px;
  width: auto;
  object-fit: contain;
  filter: brightness(1.1);
  display: block;
}

.tt-header-logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--tt-text);
  letter-spacing: -0.5px;
}

.tt-header-tabs {
  display: flex;
  align-items: center;
  gap: 15px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

@media screen and (max-width: 420px) {
  .tt-header-tabs {
    position: static;
    transform: none;
    margin: 0 auto;
    gap: 8px;
  }
  .tt-header-tab {
    font-size: 14px;
  }
  .tt-header-actions {
    gap: 0px;
  }
  .tt-header-action-btn {
    width: 32px; height: 32px;
  }
  .tt-header-action-btn svg {
    width: 19px; height: 19px;
  }
}


.tt-header-tab {
  font-size: 15px;
  font-weight: 600;
  color: rgba(22,24,35,0.4);
  cursor: pointer;
  padding: 4px 0;
  position: relative;
  white-space: nowrap;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.tt-header-tab.tt-tab-active {
  color: var(--tt-text);
}

.tt-header-tab.tt-tab-active::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 50%;
  transform: translateX(-50%);
  width: 20px; height: 3px;
  border-radius: 2px;
  background: var(--tt-text);
}


/* Right icons cluster */
.tt-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tt-header-action-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
  position: relative;
  text-decoration: none !important;
  color: var(--tt-text) !important;
}

.tt-header-action-btn:active {
  background: rgba(22,24,35,0.06);
}

.tt-header-action-btn svg {
  width: 22px; height: 22px;
  fill: var(--tt-text);
  display: block;
}

.tt-header-notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--tt-accent-r);
  border: 1.5px solid var(--tt-bg);
  display: none;
}

.tt-header-notif-dot.visible {
  display: block;
}

/* ─────────────────────────────────────────────────────────────
   4. POSTS / FEED — TikTok card style (light)
───────────────────────────────────────────────────────────── */
@media screen and (max-width: 940px) {

  /* Each post card */
  .i_post_box,
  .i_post_main,
  [class*="post_box"] {
    background: #fff !important;
    border: 1px solid var(--tt-border) !important;
    border-radius: var(--tt-radius) !important;
    margin: 6px 8px !important;
    overflow: hidden !important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06) !important;
  }

  /* Post header row */
  .i_p_header,
  .i_post_user_info {
    padding: 10px 12px 6px !important;
    background: transparent !important;
  }

  /* Story circles */
  .stories_wrapper {
    background: transparent !important;
    padding: 8px 8px 4px !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex !important;
    gap: 10px !important;
  }

  /* Create post box */
  .i_create_post_box,
  .i_create_post_section {
    background: #fff !important;
    border: 1px solid var(--tt-border) !important;
    border-radius: var(--tt-radius) !important;
    margin: 8px !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   5. TIKTOK BOTTOM NAV  (full redesign — 5 tabs + hashtag)
───────────────────────────────────────────────────────────── */

/* Hide old mobile menu */
.mobile_footer_fixed_menu_container,
.mobile_fixed_box_wrapper {
  display: none !important;
}

/* Nav container */
.tt-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9999;
  background: var(--tt-bg);
  border-top: 1px solid var(--tt-border);
  padding-bottom: var(--tt-safe-bottom);
  height: calc(var(--tt-nav-h) + var(--tt-safe-bottom));
  font-family: var(--tt-font);
}

@media screen and (max-width: 940px) {
  .tt-bottom-nav { display: flex; }
}

/* Nav items row */
.tt-nav-items {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-around;
  height: var(--tt-nav-h);
  padding: 0 2px;
}

/* Individual item */
.tt-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  text-decoration: none !important;
  color: var(--tt-muted) !important;
  padding: 4px 2px;
  position: relative;
  transition: color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
}

.tt-nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: rgba(22,24,35,0);
  transition: background 0.25s;
  pointer-events: none;
}

.tt-nav-item:active::before {
  background: rgba(22,24,35,0.05);
}

.tt-nav-item.tt-active {
  color: var(--tt-text) !important;
}

/* Icon */
.tt-nav-icon {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1);
}

.tt-nav-item:active .tt-nav-icon { transform: scale(0.82); }
.tt-nav-item.tt-active .tt-nav-icon { transform: scale(1.06); }

.tt-nav-icon svg {
  width: 23px; height: 23px;
  fill: currentColor;
  transition: fill 0.18s, filter 0.18s;
  display: block;
}

.tt-nav-item.tt-active .tt-nav-icon svg {
  fill: var(--tt-text);
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.3));
}

/* Label */
.tt-nav-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.2px;
  line-height: 1;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52px;
  text-align: center;
}

.tt-nav-item.tt-active .tt-nav-label {
  font-weight: 700;
  color: var(--tt-text);
}

/* Notification badge */
.tt-nav-badge {
  position: absolute;
  top: 1px; right: calc(50% - 18px);
  min-width: 15px; height: 15px;
  border-radius: 8px;
  background: var(--tt-accent-r);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  padding: 0 3px;
  border: 1.5px solid var(--tt-bg);
  display: none;
  z-index: 1;
}

.tt-nav-badge.tt-badge-visible { display: block; }

/* Avatar circle */
.tt-nav-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--tt-muted);
  transition: border-color 0.18s;
  flex-shrink: 0;
}

.tt-nav-item.tt-active .tt-nav-avatar {
  border-color: var(--tt-text);
  box-shadow: 0 0 0 1.5px var(--tt-accent-r);
}

.tt-nav-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Hashtag tab special style ── */
.tt-nav-item.tt-hashtag.tt-active .tt-nav-icon svg {
  fill: var(--tt-accent-c);
  filter: drop-shadow(0 0 6px rgba(37,244,238,0.5));
}

.tt-nav-item.tt-hashtag.tt-active .tt-nav-label {
  color: var(--tt-accent-c);
}

/* ── CREATE (centre) button ── */
.tt-nav-create {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 6px 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-decoration: none !important;
}

.tt-create-btn-inner {
  position: relative;
  width: 38px; height: 26px;
  border-radius: 7px;
  background: #161823;
  display: flex; align-items: center; justify-content: center;
  box-shadow:
    -2.5px 0 0 1.5px var(--tt-accent-c),
     2.5px 0 0 1.5px var(--tt-accent-r);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.18s;
}

.tt-nav-create:active .tt-create-btn-inner {
  transform: scale(0.88);
  box-shadow:
    -2.5px 0 0 1.5px var(--tt-accent-c),
     2.5px 0 0 1.5px var(--tt-accent-r),
     0 0 16px rgba(254,44,85,0.35);
}

.tt-create-btn-inner svg {
  width: 18px; height: 18px;
  fill: #fff;
  display: block;
}

/* ─────────────────────────────────────────────────────────────
   6. SLIDE-UP DRAWER
───────────────────────────────────────────────────────────── */
.tt-drawer-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9998;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.tt-drawer-overlay.tt-open { display: block; }

.tt-drawer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-radius: 20px 20px 0 0;
  z-index: 9999;
  padding: 14px 0 calc(var(--tt-safe-bottom) + var(--tt-nav-h) + 8px);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(.32,.72,0,1);
  max-height: 78vh;
  overflow-y: auto;
  border-top: 1px solid var(--tt-border);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
}

.tt-drawer.tt-open { transform: translateY(0); }

.tt-drawer-handle {
  width: 36px; height: 4px;
  background: #333;
  border-radius: 2px;
  margin: 0 auto 14px;
}

.tt-drawer-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--tt-muted);
  padding: 4px 18px 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--tt-border);
  margin-bottom: 4px;
}

.tt-drawer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 0 6px;
}

.tt-drawer-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 7px;
  padding: 14px 6px;
  border-radius: 14px;
  cursor: pointer;
  text-decoration: none !important;
  color: var(--tt-text) !important;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.tt-drawer-item:active,
.tt-drawer-item:hover {
  background: var(--tt-surface);
  color: var(--tt-text) !important;
  text-decoration: none !important;
}

.tt-drawer-item svg {
  width: 24px; height: 24px;
  fill: currentColor;
  display: block;
}

.tt-drawer-item span {
  font-size: 10px; font-weight: 500;
  color: inherit; text-align: center;
  line-height: 1.2;
}

.tt-drawer-divider {
  height: 1px;
  background: var(--tt-border);
  margin: 10px 16px;
}

/* ─────────────────────────────────────────────────────────────
   7. HASHTAG EXPLORE PAGE — TikTok discover style (light)
───────────────────────────────────────────────────────────── */
@media screen and (max-width: 940px) {

  .hashtags_container {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    padding: 8px !important;
  }

  .hashtag_item {
    background: #fff !important;
    border: 1px solid var(--tt-border) !important;
    border-radius: 12px !important;
    padding: 14px 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    transition: background 0.15s !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05) !important;
  }

  .hashtag_item:active {
    background: var(--tt-surface) !important;
  }

  .hashtag_item .hashtag_name,
  .hashtag_item a {
    color: var(--tt-text) !important;
    font-weight: 700 !important;
    font-size: 14px !important;
  }

  .hashtag_item .hashtag_count {
    color: var(--tt-muted) !important;
    font-size: 11px !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   8. SCROLL / SAFE AREA
───────────────────────────────────────────────────────────── */
@media screen and (max-width: 940px) {
  .i_load_more_btn,
  [class*="load_more"] {
    margin-bottom: 12px !important;
    border-radius: var(--tt-radius) !important;
    background: #fff !important;
    color: var(--tt-text) !important;
    border: 1px solid var(--tt-border) !important;
    font-family: var(--tt-font) !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   9. ANIMATIONS
───────────────────────────────────────────────────────────── */
@keyframes tt-slide-up {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes tt-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────
   10. LIGHT MODE MOBILE OVERRIDES
───────────────────────────────────────────────────────────── */
@media screen and (max-width: 940px) {
  /* Modals */
  .i_modal_bg_in .i_modal_in,
  .i_modal_cover_resize_bg_in .i_modal_in {
    background: #fff !important;
    border-radius: 20px !important;
    max-width: 92vw !important;
    width: 92vw !important;
  }
}
