/**
 * Site-wide responsive helpers (Bootstrap 3 main layout).
 * Loaded after bundle.css — keep overrides minimal and high-specificity where needed.
 */

#body-wrapper {
  overflow-x: hidden;
  max-width: 100%;
}

/*
 * Fluid images — but NOT fixed-size UI (flags, announcement thumbs). Those sit in flex
 * rows on desktop; max-width:100% + flex-shrink can resolve to 0px width (visible on
 * mobile where the flag strip has a fixed width).
 */
img:not(.lang-flag-img):not(.news-list-thumb) {
  max-width: 100%;
  height: auto;
}

.nav-lang-dropdown {
  flex-shrink: 0;
}

.lang-flag-img {
  max-width: none;
  width: 22px;
  height: 14px;
}

/* Announcement row: anchor wraps thumb + body (bundle .media is flex with one child) */
@media (min-width: 576px) {
  .media-list .media > a {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .media-list .media .media-left {
    flex-shrink: 0;
    padding-right: 12px;
  }

  .media-list .media .media-body {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* --- Homepage: main column first on phones/tablets (<992px) --- */
@media (max-width: 991px) {
  .home-layout-row {
    display: flex;
    flex-direction: column;
  }

  .home-layout-row > [class*="col-"] {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .home-layout-row .home-main-col {
    order: 1;
  }

  .home-layout-row .home-left-col {
    order: 2;
  }

  .home-layout-row .home-right-col {
    order: 3;
  }
}

@media (min-width: 992px) {
  .home-layout-row {
    display: block;
  }

  .home-layout-row:before,
  .home-layout-row:after {
    display: table;
    content: " ";
  }

  .home-layout-row:after {
    clear: both;
  }
}

/*
 * Navbar: language left, primary links centered, account links and server time
 * right-aligned without pushing the clock onto a second row.
 */
.navbar-main.container {
  overflow: visible;
  max-width: 100%;
  width: 100%;
}

.navbar-main-cluster {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  justify-content: center;
  column-gap: 18px;
  width: 100%;
  max-width: 100%;
}

.navbar-main-cluster .nav-lang-switcher.nav-lang-in-mainbar {
  justify-self: end;
  min-width: 0;
}

.navbar-main-cluster .navbar-main-nav {
  justify-self: center;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

.navbar-main-cluster .navbar-main-nav .navbar-nav-list,
.navbar-main-cluster .navbar-account-cluster .navbar-nav-list {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  margin: 0;
  padding: 0;
}

.navbar-main-cluster .navbar-main-nav .navbar-nav-list {
  justify-content: center;
  gap: 12px;
  width: auto;
  margin-left: auto;
  margin-right: auto;
  min-height: 32px;
}

.navbar-main-cluster .navbar-main-nav .navbar-nav-list > li,
.navbar-main-cluster .navbar-account-cluster .navbar-nav-list > li {
  flex: 0 0 auto;
  margin-left: 0 !important;
}

.navbar-main-cluster .navbar-account-cluster.navbar-right-section {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  justify-self: start;
  gap: 16px;
  min-width: 0;
  padding-left: 0 !important;
  text-align: left;
}

.navbar-main-cluster .navbar-account-cluster .navbar-nav-list {
  justify-content: flex-end;
  gap: 14px;
}

#serverdatetime.servertimer {
  position: static !important;
  left: auto !important;
  display: inline-block;
  flex: 0 0 auto;
  width: auto;
  margin-left: 0 !important;
  white-space: nowrap;
}

@media (min-width: 900px) {
  #body-wrapper {
    padding-inline-end: 0;
  }

  .navbar-main .nav-lang-switcher.nav-lang-in-mainbar {
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
  }

  .navbar-main .nav-lang-dropdown > .dropdown-menu {
    z-index: 10020;
  }

  .navbar-main-cluster .navbar-main-nav .navbar-nav-list li a,
  .navbar-main-cluster .navbar-account-cluster .navbar-nav-list li a {
    white-space: nowrap;
    display: inline-block;
    line-height: 1.25;
    padding: 4px 2px;
  }
}

@media (max-width: 1199px) and (min-width: 900px) {
  .navbar-main.container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .navbar-main-cluster {
    grid-template-columns: auto auto auto;
    column-gap: 12px;
  }

  .navbar-main-cluster .navbar-main-nav .navbar-nav-list {
    gap: 8px;
  }

  .navbar-main-cluster .navbar-main-nav .navbar-nav-list li a,
  .navbar-main-cluster .navbar-account-cluster .navbar-nav-list li a {
    font-size: 12px;
  }
}

@media (max-width: 899px) {
  .navbar-main.container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 60px;
    padding: 10px 12px 10px 72px;
  }

  .navbar-main-cluster {
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    justify-content: flex-start;
    column-gap: 8px;
    width: 100%;
  }

  .navbar-main-cluster .navbar-main-nav {
    display: none !important;
  }

  .navbar-main-cluster .nav-lang-switcher.nav-lang-in-mainbar {
    display: block !important;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .navbar-main-cluster .navbar-account-cluster.navbar-right-section {
    display: contents;
  }

  .navbar-main-cluster .navbar-account-cluster .navbar-nav-list {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    justify-content: flex-end;
    gap: 8px;
  }

  #serverdatetime.servertimer {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    justify-self: end;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .navbar-main.container {
    padding-right: 8px;
  }

  .navbar-main-cluster {
    gap: 6px;
  }

  .navbar-main-cluster .navbar-account-cluster .navbar-nav-list {
    gap: 6px;
  }

  .navbar-main-cluster .navbar-account-cluster .navbar-nav-list li a {
    font-size: 11px;
  }

  .nav-lang-dropdown .lang-dropdown-toggle {
    gap: 5px;
    min-height: 30px;
    padding-left: 6px;
    padding-right: 6px;
  }

  .nav-lang-dropdown .lang-dropdown-label {
    display: none;
  }

  #serverdatetime.servertimer {
    font-size: 10px;
    letter-spacing: -0.2px;
  }
}

@media (max-width: 360px) {
  .navbar-main.container {
    padding-left: 64px;
    padding-right: 6px;
  }

  .navbar-main-cluster {
    column-gap: 4px;
  }

  .navbar-main-cluster .navbar-account-cluster .navbar-nav-list {
    gap: 4px;
  }

  .navbar-main-cluster .navbar-account-cluster .navbar-nav-list li a,
  #serverdatetime.servertimer {
    font-size: 9px;
  }
}

/* --- Wide tables / panels: scroll instead of breaking layout --- */
.panel-body,
.well,
.page-header {
  max-width: 100%;
}

.panel-body {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* --- Inner page hero title --- */
@media (max-width: 767px) {
  .page-banner .page-banner-title {
    font-size: clamp(1.5rem, 8vw, 2.25rem);
    letter-spacing: -0.5px;
    text-align: center;
    padding-left: 8px;
    padding-right: 8px;
  }

  .page-banner .page-banner-content {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* --- News list thumbnails (index announcements) --- */
.news-list-thumb {
  width: 80px;
  height: 80px;
  max-width: none;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #1a1f2e;
}

/* --- News list: stack thumb + text on small screens --- */
@media (max-width: 575px) {
  .media-list .media {
    display: block;
  }

  .media-list .media .media-left {
    display: block;
    margin-bottom: 8px;
    padding-right: 0;
  }

  .media-list .media .media-body {
    display: block;
    width: 100%;
  }
}

/* --- First-visit features overlay (from index.tpl) --- */
.features-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  z-index: 99999;
  background: #fff;
  box-sizing: border-box;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.features-modal-overlay .features-modal-frame {
  display: block;
  width: 100%;
  height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: 100%;
  border: 0;
}

/* --- Footer fixed controls: keep inside safe area on notched phones --- */
#playmusic,
#pausemusic {
  bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
  right: max(12px, env(safe-area-inset-right, 12px)) !important;
}

/* --- Purchase history tables: narrow ID columns so status/actions stay visible --- */
.purchase-history-table {
  table-layout: fixed;
  width: 100%;
}

.purchase-history-scroll {
  max-width: 100%;
}

.purchase-history-table col.col-purchase-txn {
  width: 11%;
}

.purchase-history-table col.col-purchase-payer {
  width: 9%;
}

.purchase-history-table--account col.col-purchase-txn {
  width: 12%;
}

.purchase-history-table td.col-purchase-txn,
.purchase-history-table td.col-purchase-payer,
.purchase-history-table th.col-purchase-txn,
.purchase-history-table th.col-purchase-payer {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

@media (max-width: 1199px) {
  .purchase-history-table col.col-purchase-txn {
    width: 10%;
  }

  .purchase-history-table col.col-purchase-payer {
    width: 8%;
  }
}

@media (max-width: 991px) {
  .purchase-history-table col.col-purchase-txn {
    width: 88px;
  }

  .purchase-history-table col.col-purchase-payer {
    width: 72px;
  }
}

/* --- Rankings / pill nav: wrap instead of overflowing --- */
.nav.nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
