/*
 * Baseline design system for the www site.
 * Goal: a clean, modern, easy-to-reskin foundation — not a recreation of the
 * original 2009-era table layout. Swap the CSS variables below (or replace
 * this file entirely) when a real design/template is ready to drop in.
 */

:root {
  --color-bg:        #f7f3ef;
  --color-surface:    #ffffff;
  --color-border:     #e6ddd3;
  --color-text:       #333333;
  --color-text-muted: #767066;
  --color-brand:      #af1f3a;
  --color-brand-dark: #7d1529;
  --color-accent:     #d03c3c;
  --color-online:     #2e7d32;
  --color-offline:    #b0b0b0;
  --color-private:    #b8860b;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --gap: 16px;
  --max-width: 1200px;
}

* { box-sizing: border-box; }

body.site-body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--color-brand); text-decoration: none; }
a:hover { color: var(--color-brand-dark); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.site-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ---------- Header ---------- */

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header__bar {
  width: 100%;
  padding: 10px var(--gap);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.site-header__logo { width: 100%; text-align: center; }
.site-header__logo img { max-height: 60px; width: auto; margin: 0 auto; }

/* Language dropdown — pinned to the top-right corner of the header bar */
.site-langbar-wrap {
  position: absolute;
  top: 10px;
  right: var(--gap);
}

.site-langbar-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
}
.site-langbar-toggle:hover { background: var(--color-bg); }
.site-langbar-toggle .fa-caret-down { font-size: 11px; color: var(--color-text-muted); }

.site-langbar {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 100;
}
.site-langbar-wrap.open .site-langbar { display: block; }

/* The PHP-generated markup wraps every language link in one <span> — that's
   the actual flex container that needs to stack them vertically. It also
   inserts a literal "&nbsp;" text node after every link; at font-size:0 that
   collapses to nothing instead of becoming its own tiny row in the column. */
.site-langbar > span {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  font-size: 0;
}

.site-langbar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
}
.site-langbar a:hover { background: var(--color-bg); text-decoration: none; }
.site-langbar img { height: 16px; width: auto; flex-shrink: 0; }

/* The language name isn't in the markup — only in each link's title
   attribute — so surface it as visible text instead of a hover-only tooltip. */
.site-langbar a::after { content: attr(title); color: var(--color-text); }

/* ---------- Top nav ---------- */

.site-nav {
  background: var(--color-brand);
}

.site-nav ul {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap);
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.site-nav li { margin: 0; }

.site-nav a {
  display: block;
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
}

.site-nav a:hover {
  background: var(--color-brand-dark);
  text-decoration: none;
}

/* The "menu"/"menu_item" templates are shared by both the top nav
   (www_top_menu) and the sidebar (the {menu} var) — .side-menu's styling
   below is tuned for the sidebar, so override it here when that same
   markup is reused inside .site-nav (otherwise its higher-source-order
   rules win the specificity tie and produce unreadable dark-on-dark text). */
.site-nav .side-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.site-nav .side-menu li { border-bottom: none; }
.site-nav .side-menu a {
  color: #fff;
  padding: 10px 14px;
}
.site-nav .side-menu a:hover {
  color: #fff;
  background: var(--color-brand-dark);
  text-decoration: none;
}
.site-nav .side-menu .menu-sep {
  display: inline;
  color: rgba(255,255,255,0.4);
  align-self: center;
}

/* ---------- Layout ---------- */

.site-main {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--gap);
  padding: var(--gap) 0;
  align-items: start;
}

.site-sidebar > * + * { margin-top: var(--gap); }

/* A secondary 2-up grid used for smaller promo/info boxes (VIP models,
   new registrations, etc.) — separate from .site-main so it can collapse
   independently on narrow screens. */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

/* A 2-column page-layout table (e.g. a filter/category sidebar next to a
   content list) that needs to stack on narrow screens — different from
   .content-table, which holds normal tabular data and stays as-is. */
.layout-table {
  width: 100%;
  border-collapse: collapse;
}
.layout-table > tbody > tr > td { vertical-align: top; padding: 0 8px; }
.layout-table__side { width: 200px; }

.site-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.site-panel h2, .site-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--color-brand-dark);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
}

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-block;
  padding: 8px 16px;
  background: var(--color-brand);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { background: var(--color-brand-dark); color: #fff; text-decoration: none; }

.field {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 8px;
}

.form-stack > * { display: block; width: 100%; }

/* ---------- Model grid ----------
   Rendered as a <table> (the backend builds rows with literal <tr> tags),
   but each cell is styled like a card. */

.model-grid-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 10px;
}

.model-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  text-align: center;
  vertical-align: top;
}

.model-card img { border-radius: var(--radius); margin: 0 auto 8px; }

.model-card__name { font-weight: 600; margin-bottom: 4px; }

.model-card__actions { margin-top: 8px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.model-card__actions .btn { padding: 4px 8px; font-size: 12px; }

.status-online  { color: var(--color-online);  font-weight: 600; }
.status-offline { color: var(--color-offline); font-weight: 600; }
.status-private { color: var(--color-private); font-weight: 600; }

/* ---------- Generic content table ---------- */

.content-table {
  width: 100%;
  border-collapse: collapse;
}

.content-table td, .content-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

/* ---------- Side menu ---------- */

.side-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.side-menu li { border-bottom: 1px solid var(--color-border); }
.side-menu li:last-child { border-bottom: none; }

.side-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  color: var(--color-text);
  font-size: 13px;
}

.side-menu a:hover { color: var(--color-brand); text-decoration: none; }
.side-menu img { max-height: 18px; width: auto; }
.side-menu i { width: 16px; text-align: center; font-size: 14px; }

/* menu_item's separator ("|") is only meaningful between horizontal nav
   items — the sidebar already separates items with the border-bottom
   above, so hide it there by default. */
.menu-sep { display: none; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  margin-top: var(--gap);
  padding: var(--gap) 0;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 12px;
}

.site-footer a { color: var(--color-text-muted); }

/* ---------- Utility ---------- */

.text-center, .stylecenter { text-align: center; }
.styleleft { text-align: left; }
.styleright { text-align: right; }
.mt-0 { margin-top: 0; }

/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 800px) {
  .site-main {
    grid-template-columns: 1fr;
  }

  /* Show the login/menu sidebar before the model list when stacked - on
     mobile, pushing it after a long model grid made it effectively
     unreachable without scrolling past everything first. */
  .site-main .site-sidebar { order: 1; }
  .site-main main { order: 2; }

  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  body.site-body { font-size: 15px; }

  .site-header__bar {
    justify-content: center;
    text-align: center;
  }

  /* Bigger touch targets in the top nav */
  .site-nav a,
  .site-nav .side-menu a {
    padding: 12px 14px;
    font-size: 14px;
  }

  /* The model grid is a real <table> (the backend emits literal <tr> row
     breaks every N items), so it can't reflow like a CSS grid — instead,
     make every row/cell a full-width block so cards stack vertically
     instead of overflowing horizontally. */
  .model-grid-table,
  .model-grid-table > tbody,
  .model-grid-table > tbody > tr,
  .model-grid-table > tbody > tr > td.model-card {
    display: block;
    width: 100% !important;
  }
  .model-grid-table > tbody > tr > td.model-card {
    margin-bottom: 10px;
  }

  /* Same idea for the sidebar+content layout table used on a few pages
     (e.g. video browsing) — stack instead of squeezing two columns. */
  .layout-table,
  .layout-table > tbody,
  .layout-table > tbody > tr,
  .layout-table > tbody > tr > td {
    display: block;
    width: 100% !important;
  }
  .layout-table > tbody > tr > td {
    padding: 0 0 var(--gap);
  }

  .btn { padding: 10px 16px; font-size: 14px; }
  .field { padding: 10px; font-size: 14px; }
}
