/* =========================================================
   GLOBAL PAGE BASE
   ========================================================= */

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

body {
  margin: 0;
  background: #151515;
  color: #f4f4f6;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}


/* =========================================================
   APP SHELL STRUCTURE
   ========================================================= */

.app-shell {
  position: relative;
  display: flex;

  width: 100%;
  max-width: 900px;

  height: 100vh;
  height: 100dvh;

  margin: 0 auto;

  overflow: clip;
}

.bks-sidebar {
  width: 250px;

  height: 100vh;
  height: 100dvh;

  position: absolute;
  left: 0;
  top: 0;

  z-index: 20;

  display: flex;
  flex-direction: column;
  overflow: hidden;

  background: #101010;
  border-right: 1px solid #252525;
}


.main-content {
  margin-left: 250px;
  width: calc(100% - 250px);
  min-height: 100vh;
}

.page-area {
  box-sizing: border-box;

  height: calc(100vh - 76px);
  height: calc(100dvh - 76px);

  overflow-y: auto;
  overflow-x: hidden;

  -webkit-overflow-scrolling: touch;

  padding: 32px 24px;
}

.bks-page-container {
  width: 100%;
  max-width: 980px;
  margin: 0;
}


/* =========================================================
   TOP HEADER
   ========================================================= */

.topbar {
  height: 76px;

  position: sticky;
  top: 0;
  z-index: 10;

  display: flex;
  align-items: center;

  padding: 0 24px;

  background: #111;
  border-bottom: 1px solid #252525;
}

/*
 * Width wrapper for:
 * hamburger + search + create post
 *
 * This is intended to mirror the feed width.
 */
.bks-topbar-feed-width {
  width: 100%;
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 16px;

  white-space: nowrap;
}


/* =========================================================
   HEADER SEARCH
   ========================================================= */

.search-box {
  width: auto;
  min-width: 0;

  flex: 1 1 auto;
}

.search-box input {
  width: 86%;
  min-width: 0;

  background: #2b2b2b;
  border: 1px solid #393939;
  color: #fff;
}

.search-box input::placeholder {
  color: #999;
}

.btn-nav-search {
  background-color: #3a4953;
  border-color: #4f7f84;
  color: #fff;
}

.btn-nav-search:hover,
.btn-nav-search:focus {
  background-color: #456f73;
  border-color: #456f73;
  color: #fff;
}


/* =========================================================
   HEADER SIDEBAR TOGGLE
   ========================================================= */

.sidebar-toggle {
  flex: 0 0 auto;

  background: transparent;
  border: 0;

  color: #f4f4f6;

  font-size: 1.35rem;
  line-height: 1;

  padding: 6px 8px;
  cursor: pointer;
}

/* =========================================================
   SIDEBAR BRANDING
   ========================================================= */

.sidebar-brand {
  height: 76px;
  min-height: 76px;

  display: flex;
  align-items: center;

  padding: 0 16px;

  background: #101010;
  border-bottom: 1px solid #252525;
}

.sidebar-brand-link {
  display: flex;
  align-items: center;

  color: #f4f4f6;
  text-decoration: none;
}

.sidebar-logo {
  width: 38px;
  height: 38px;

  flex: 0 0 auto;

  object-fit: contain;
}

.sidebar-brand-text {
  margin-left: 10px;

  font-size: 22px;
  line-height: 1;
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;

  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
}


/* =========================================================
   SCROLLBARS
   ========================================================= */

.sidebar-nav,
.page-area {
  scrollbar-width: thin;
  scrollbar-color: #2b2b2b #111;
}

.sidebar-nav::-webkit-scrollbar,
.page-area::-webkit-scrollbar {
  width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track,
.page-area::-webkit-scrollbar-track {
  background: #111;
}

.sidebar-nav::-webkit-scrollbar-thumb,
.page-area::-webkit-scrollbar-thumb {
  background: #2b2b2b;

  border: 2px solid #111;
  border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover,
.page-area::-webkit-scrollbar-thumb:hover {
  background: #393939;
}


/* =========================================================
   SIDEBAR NAVIGATION
   ========================================================= */

.sidebar-section-title {
  margin: 22px 0 8px;

  color: #8f8f8f;

  font-size: 12px;
  font-weight: 500;

  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bks-sidebar .nav-link {
  padding: 10px 14px;

  color: #d7d7d7 !important;

  border-radius: 6px;

  font-weight: 600;
}

.bks-sidebar .nav-link:hover,
.bks-sidebar .nav-link.active {
  background: #48647b !important;
  color: #fff !important;
}

.bks-sidebar i {
  width: 22px;

  margin-right: 12px;

  font-size: 1.1rem;
}


/* =========================================================
   SIDEBAR NOTIFICATIONS
   ========================================================= */

.bks-sidebar-icon-wrap {
  position: relative;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bks-sidebar-alert-dot {
  position: absolute;

  top: -9px;

  min-width: 17px;
  height: 17px;

  padding: 1px 6px 5px;

  border-radius: 999px;

  background: #e33653;
  color: #fff;

  font-size: 0.5rem;
  font-style: normal;
  font-weight: 700;
  line-height: 15px;
}

/* =========================================================
   COLLAPSED SIDEBAR TOOLTIPS
   ========================================================= */

.bks-sidebar-tooltip {
  --bs-tooltip-opacity: 1;
}

.bks-sidebar-tooltip .tooltip-inner {
  padding: 0.45rem 0.7rem;

  background: #202225;
  color: #fff;

  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;

  font-size: 0.78rem;
  font-weight: 600;

  white-space: nowrap;

  box-shadow:
    0 8px 22px
    rgba(0, 0, 0, 0.4);
}


/* =========================================================
   SHARED DARK CARDS
   ========================================================= */

.card {
  background: #111113 !important;
  color: #f4f4f6 !important;

  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  border-radius: 18px !important;

  box-shadow:
    0 18px 45px
    rgba(0, 0, 0, 0.35) !important;
}

.card-header {
  padding: 18px 20px;

  background: #111113 !important;
  color: #f4f4f6 !important;

  border-bottom:
    1px solid
    rgba(255, 255, 255, 0.09) !important;
}


/* =========================================================
   BOOTSTRAP COLOR OVERRIDES
   ========================================================= */

.text-muted {
  color: #a7a7ad !important;
}

.bg-white,
.bg-light {
  background-color: transparent !important;
}

.text-dark {
  color: #f4f4f6 !important;
}


/* =========================================================
   PROFILE HERO IMAGES
   ========================================================= */

.profile-cover {
  height: 220px;

  background-size: cover;
  background-position: center;

  border-bottom:
    1px solid
    rgba(255, 255, 255, 0.06);
}

.profile-avatar {
  width: 120px;
  height: 120px;

  margin-top: -60px;

  object-fit: cover;

  border: 5px solid #111113;

  box-shadow:
    0 12px 30px
    rgba(0, 0, 0, 0.45);
}


/* =========================================================
   BOOK IMAGES AND CARDS
   ========================================================= */

.book-cover-sm {
  width: 72px;
  height: 108px;

  object-fit: cover;
}

.book-cover-grid {
  width: 100%;

  aspect-ratio: 2 / 3;

  object-fit: cover;

  border-radius: 12px;
}

.book-card {
  overflow: hidden;

  background: #151518 !important;

  border:
    1px solid
    rgba(255, 255, 255, 0.09) !important;

  border-radius: 16px !important;
}


/* =========================================================
   PROFILE TAB NAVIGATION
   ========================================================= */

.nav-pills:not(.flex-column) {
  padding: 6px;

  background: #080808;

  border:
    1px solid
    rgba(255, 255, 255, 0.09);

  border-radius: 18px;

  box-shadow:
    0 18px 45px
    rgba(0, 0, 0, 0.35);
}

.nav-pills:not(.flex-column) .nav-link {
  padding: 13px 22px;

  color: #a7a7ad;

  font-weight: 700;

  border-radius: 14px;
}

.nav-pills:not(.flex-column) .nav-link.active {
  background: #4f7f84;
  color: #fff;
}


/* =========================================================
   POST MEDIA
   ========================================================= */

.bks-post-media {
  width: 100%;
  max-width: 100%;

  background: #050505;
}

.bks-media-image,
.bks-media-video {
  display: block;

  width: 100%;
  height: 330px;

  object-fit: contain;

  background: #050505;
}

.bks-media-youtube {
  width: 100%;

  aspect-ratio: 16 / 9;

  background: #050505;
}

.bks-media-youtube iframe {
  width: 100%;
  height: 100%;

  border: 0;
}

.bks-media-vertical {
  width: 100%;
  max-width: 300px;
  height: 460px;

  margin: 0 auto;

  background: #050505;
}

.bks-media-vertical iframe,
.bks-media-vertical video {
  width: 100%;
  height: 100%;

  border: 0;

  object-fit: contain;

  background: #050505;
}

.bks-media-spotify iframe {
  width: 100%;
  height: 232px;

  border: 0;
}


/* =========================================================
   MANUAL SIDEBAR COLLAPSE
   ========================================================= */

body.sidebar-collapsed .bks-sidebar {
  width: 78px;
}

body.sidebar-collapsed .main-content {
  margin-left: 78px;
  width: calc(100% - 78px);
}

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;

  padding: 0;
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-section-title,
body.sidebar-collapsed .bks-sidebar .nav-label {
  display: none !important;
}

body.sidebar-collapsed .bks-sidebar .nav-link {
  justify-content: center;

  padding: 12px 10px;
}

body.sidebar-collapsed .bks-sidebar i {
  margin-right: 0;
}

body.sidebar-collapsed .sidebar-logo {
  width: 36px;
  height: 36px;

  margin-right: 0;
}

.bks-topbar-feed-width {
  width: 100%;
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 16px;

  white-space: nowrap;
}

/* =========================================================
   AUTO COLLAPSE ON SMALLER SCREENS
   ========================================================= */

@media (max-width: 1100px) {
  .bks-sidebar {
    width: 78px;
  }

  .main-content {
    margin-left: 78px;
    width: calc(100% - 78px);
  }

  .sidebar-brand {
    justify-content: center;

    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .sidebar-brand .fs-4,
  .sidebar-brand-text,
  .sidebar-section-title,
  .bks-sidebar .nav-link .nav-label {
    display: none !important;
  }
  
  .bks-sidebar .nav-link {
    justify-content: center;

    padding: 12px 10px;
  }

  .bks-sidebar i {
    margin-right: 0;
  }

  .sidebar-logo {
    margin-right: 0;
  }

  .topbar {
    padding-left: 20px;
    padding-right: 20px;
  }

  .page-area {
    box-sizing: border-box;

    height: calc(100vh - 76px);
    height: calc(100dvh - 76px);

    overflow-y: auto;
    overflow-x: hidden;

    -webkit-overflow-scrolling: touch;

    padding: 32px 24px 48px;
  }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {
  .bks-media-image,
  .bks-media-video {
    height: 320px;
  }

  .bks-media-vertical {
    max-width: 260px;
    height: 320px;
  }
}

.bks-create-text-desktop {
  display: inline !important;
}

.bks-create-text-mobile {
  display: none !important;
}

@media (max-width: 768px) {
  .bks-create-text-desktop {
    display: none !important;
  }

  .bks-create-text-mobile {
    display: inline !important;
  }
}

.bks-create-text-desktop {
  display: inline !important;
}

.bks-create-text-mobile {
  display: none !important;
}

@media (max-width: 768px) {
  .bks-create-text-desktop {
    display: none !important;
  }

  .bks-create-text-mobile {
    display: inline !important;
  }
}

/* =========================================================
   POST AUTHOR NAME
   ========================================================= */

.bks-post-author-name-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;

  width: auto;
  min-width: 0;

  padding: 0;
  margin: 0;

  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.bks-post-author-name-row .bks-post-name,
.bks-post-author-name-row .bks-author-link {
  display: inline-flex;
  align-items: center;

  width: auto;
  min-width: 0;

  padding: 0 !important;
  margin: 0 !important;

  background: transparent !important;
  background-color: transparent !important;

  border: 0 !important;
  border-radius: 0 !important;

  box-shadow: none !important;

  color: inherit;
  text-decoration: none;
}

.bks-post-author-name-row .bks-post-name:hover,
.bks-post-author-name-row .bks-author-link:hover {
  color: #58c7e8 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

/* =========================================================
   REAL MOBILE — USE DOCUMENT SCROLL
   Avoid nested viewport scrolling on mobile browsers
   ========================================================= */

@media (max-width: 520px) {

  html,
  body {
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  .main-content {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .page-area {
    height: auto !important;

    min-height: calc(100vh - 76px);
    min-height: calc(100dvh - 76px);

    overflow-y: visible !important;
    overflow-x: hidden !important;

    padding-bottom: 64px;
  }
}

/* =========================================================
   REAL MOBILE — FIXED SITE HEADER
   ========================================================= */

@media (max-width: 520px) {

  .topbar {
    position: fixed;
    top: 0;
    z-index: 1000;
  }

  .page-area {
    padding-top: calc(32px + 76px);
  }
}