/* ── PBEM Manager — Mobile Responsive Styles ──────────────────────────────── */
/* Include on all pages: <link rel="stylesheet" href="../css/mobile.css" />    */
/* (index.html uses: <link rel="stylesheet" href="css/mobile.css" />)          */
/* ─────────────────────────────────────────────────────────────────────────── */

/* ── FILTER TOGGLE — hidden on desktop, shown on mobile ────────────────────── */
.mobile-filter-toggle { display: none; }

/* ── MOBILE-ONLY CELLS — hidden on desktop ─────────────────────────────────── */
.col-mobile { display: none; }
.col-desktop { display: table-cell; }
.nav-install-btn { display: none !important; }

/* ── HAMBURGER BUTTON ──────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 3px;
  background: #fff;
  margin: 4px 0;
  border-radius: 2px;
  transition: all 0.3s;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ── TABLETS (≤ 900px) ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .header-inner {
    justify-content: center;
  }
  .header-managers-left img,
  .header-managers-right img {
    height: 80px !important;
  }
  .header-tactics-ball img {
    height: 90px !important;
  }
  .header-login-wrap {
    position: absolute;
    top: 8px;
    right: 60px;
  }
}

/* ── MOBILE (≤ 700px) ──────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  /* Prevent horizontal scroll */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* Header — logo + managers left, login + hamburger right */
  .site-header {
    height: 75px !important;
    margin-bottom: 2px;
  }
  .header-inner {
    height: 75px !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 0.5rem;
    position: relative;
  }
  .header-managers-left {
    display: flex !important;
    align-items: flex-end;
    padding: 0;
    flex-shrink: 0;
  }
  .header-managers-left img {
    height: 55px !important;
    width: auto;
  }
  .header-managers-right,
  .header-tactics-ball {
    display: none !important;
  }
  .header-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
  }
  .header-logo img {
    height: 36px !important;
  }
  .header-login-wrap {
    position: absolute !important;
    top: auto !important;
    bottom: 4px !important;
    right: 0.5rem !important;
    transform: none !important;
    display: block;
    text-align: right;
  }
  .header-login-wrap a {
    padding: 0.15rem 0.45rem;
    font-size: 0.65rem;
    white-space: nowrap;
  }

  /* Hamburger — square button with 3 stacked lines */
  .hamburger {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.1) !important;
    border-radius: 4px;
    padding: 0;
    position: absolute;
    top: 6px;
    right: 0.5rem;
  }
  .hamburger span {
    display: block !important;
    width: 20px !important;
    height: 2px !important;
    margin: 2.5px 0 !important;
  }

  /* Nav — mobile dropdown right-aligned */
  nav {
    position: relative;
  }
  .nav-inner {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    background: #313D75;
    z-index: 1000;
    box-shadow: -4px 4px 16px rgba(0,0,0,0.4);
    border-radius: 0 0 0 6px;
  }
  .nav-inner.open {
    display: flex;
  }
  .nav-inner a {
    padding: 0.7rem 1rem !important;
    font-size: 0.85rem !important;
    border-right: none !important;
    border-left: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    justify-content: flex-start !important;
    flex: none !important;
    min-width: auto !important;
  }
  .nav-inner a:first-child {
    border-left: none !important;
  }
  .nav-install-btn {
    background: rgba(255,255,255,0.08) !important;
    color: #aac0e8 !important;
    border-top: 2px solid rgba(255,255,255,0.2) !important;
    font-size: 0.85rem !important;
  }

  /* Collapsible search/filters on mobile */
  .mobile-filter-toggle {
    display: block;
    width: 100%;
    background: #1a2a5e;
    color: #fff;
    border: none;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    margin-bottom: 0.75rem;
    border-radius: 3px;
    text-align: center;
  }
  .mobile-filter-toggle:hover { background: #0f1a46; }
  .filters.mobile-hidden {
    display: none !important;
  }

  /* Content panels — full width, no overflow */
  .content-panel,
  .pay-panel {
    padding: 1.25rem 0.75rem !important;
    margin: 0;
    max-width: 100% !important;
    overflow: hidden;
  }
  .content-panel h1 {
    font-size: 1.4rem !important;
  }
  .page-body {
    padding: 1rem 0.5rem 2rem !important;
  }

  /* Vidiprinter — prevent overflow, hide title, setup left, timer right */
  .vidi-panel,
  .chat-panel {
    max-width: 100% !important;
    overflow: hidden;
  }
  .vidi-header {
    display: flex !important;
    flex-wrap: nowrap;
    gap: 0.4rem !important;
    padding: 0.6rem 0.75rem !important;
    justify-content: space-between;
    align-items: center;
  }
  .vidi-title {
    display: none !important;
  }
  .vidi-matchinfo {
    font-size: 0.82rem !important;
    flex: 1;
    text-align: left !important;
    order: 1;
    width: auto !important;
  }
  .vidi-clock {
    font-size: 0.9rem !important;
    min-width: 65px !important;
    text-align: right;
    order: 2;
  }
  .ev-score {
    font-size: 0.75rem !important;
    word-break: break-word;
  }

  /* Trophy box — below text */
  .content-layout {
    flex-direction: column !important;
  }
  .trophy-box {
    width: 100% !important;
  }

  /* Tables — 2-line card layout on mobile */
  .player-table,
  .legends-table {
    display: block !important;
    width: 100% !important;
  }
  .player-table thead,
  .legends-table thead {
    display: none !important;
  }
  .player-table tbody,
  .legends-table tbody {
    display: block;
  }
  .player-table td,
  .legends-table td {
    border: none !important;
    padding: 0 !important;
  }
  .player-table tr,
  .legends-table tr {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid #e0e0e0;
    row-gap: 0.15rem;
  }
  .player-table tr:nth-child(even),
  .legends-table tr:nth-child(even) {
    background: #f5f7fc;
  }
  /* Hide desktop-only columns */
  .col-code, .col-value, .col-wage, .col-desktop {
    display: none !important;
  }
  /* Show mobile-only combined row */
  .col-mobile {
    display: block !important;
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 0.72rem;
    color: #888;
  }
  /* Line 1: Name (left half) */
  .player-table td:nth-child(2),
  .legends-table td:nth-child(2) {
    grid-column: 1;
    grid-row: 1;
    font-weight: bold;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Line 1: Club (right half, left-aligned, bigger) */
  .player-table td:nth-child(3),
  .legends-table td:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
    font-size: 0.82rem;
    color: #666;
    text-align: left;
    padding-left: 0.5rem !important;
  }
  /* Line 2 — bigger text to match flag height */
  .col-mobile .pos-badge { font-size: 0.68rem !important; padding: 0.1rem 0.25rem !important; vertical-align: middle; }
  .col-mobile .rating-badge { font-size: 0.68rem !important; padding: 0.1rem 0.25rem !important; vertical-align: middle; }
  .col-mobile img { height: 14px; width: auto; vertical-align: middle; }
  .col-mobile { font-size: 0.78rem !important; }

  /* Manager table — compact */
  .manager-table {
    font-size: 0.75rem !important;
    width: 100% !important;
    table-layout: fixed;
  }
  .manager-table th, .manager-table td {
    padding: 0.3rem 0.25rem !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .col-email, .col-phone {
    display: none !important;
  }

  /* Profile page */
  .profile-header {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
  }
  .profile-name h1 { font-size: 1.3rem !important; }

  /* Vidiprinter layout — stack */
  .vidi-wrap {
    grid-template-columns: 1fr !important;
  }
  .vidi-panel,
  .chat-panel {
    height: auto !important;
    min-height: 400px;
  }
  .vidi-feed {
    min-height: 350px;
    max-height: 500px;
  }
  .vidi-event {
    grid-template-columns: 40px 58px 48px 1fr !important;
    padding: 0.35rem 0.6rem !important;
    font-size: 0.78rem;
  }

  /* Footer */
  .site-footer {
    padding: 1rem 0.75rem !important;
  }

  /* Search/filter inputs */
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  select {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
  }
}

/* ── SMALL PHONES (≤ 400px) ────────────────────────────────────────────────── */
@media (max-width: 400px) {
  .header-logo img {
    height: 36px !important;
  }
  .content-panel,
  .pay-panel {
    padding: 1rem 0.75rem !important;
  }
  .quick-amounts {
    flex-wrap: wrap;
  }
  .quick-btn {
    flex: 1 1 45%;
  }
}
