/* =============================================================
   GOALCODEX — responsive.css
   Tablet  ≤ 768px  |  Phone  ≤ 480px
   Desktop layout (> 768px) is NEVER touched here.
   ============================================================= */

/* ─────────────────────────────────────────────────────────────
   1. HEADER
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: center;
    padding: 10px 14px;
    gap: 8px;
  }
  .logo { text-align: center; }
  .logo img { height: 46px; }

  /* Explorer selects — two per row */
  .explorer-bar {
    width: 100%;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
  }
  .explorer-bar label { display: none; } /* hide "Explore:" and "by" labels on mobile */
  .explorer-bar select { flex: 1 1 45%; min-width: 0; font-size: 13px; }

  /* Auth buttons row */
  .header-right {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    width: 100%;
  }
  .auth-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    align-items: center;
    width: 100%;
  }
  .header-right a,
  .header-right button {
    font-size: 13px;
    padding: 7px 14px;
    min-height: 36px;
  }
  .join-free-btn,
  .btn-join-free { font-size: 13px; padding: 7px 16px; }
}

@media (max-width: 480px) {
  .header-container { padding: 8px 10px; gap: 6px; }
  .logo img { height: 38px; }

  /* Explorer selects — full width, stacked */
  .explorer-bar { flex-direction: column; gap: 5px; }
  .explorer-bar select { flex: 1 1 100%; width: 100%; font-size: 13px; }
  .explorer-bar span { font-size: 13px; }

  .header-right { gap: 5px; }
  .header-right a,
  .header-right button { font-size: 12px; padding: 6px 12px; }
}

/* ─────────────────────────────────────────────────────────────
   2. CONTAINER LAYOUT & SIDEBAR
   ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  /* Already column-flex at 1024px; fix sidebar & main width */
  .filters-side { max-width: 100%; width: 100%; }
  .main-content  { max-width: 100%; width: 100%; }
  .main-content--full { max-width: 100%; width: 100%; }
}

@media (max-width: 768px) {
  .container { padding: 10px 12px; gap: 12px; }

  /* Sidebar: hidden until toggled via .sidebar-open */
  .filters-side {
    display: none;
    max-width: 100%;
    width: 100%;
    border-radius: 8px;
    order: 2; /* sits below main content */
  }
  .filters-side.sidebar-open { display: block; }

  /* Toggle button (injected by responsive.js) */
  .sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #003f7f;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background 0.15s;
  }
  .sidebar-toggle-btn:hover { background: #002c5f; }
  .sidebar-toggle-btn.active { background: #e74c3c; }

  .main-content {
    max-width: 100%;
    width: 100%;
    padding: 14px;
    gap: 16px;
    order: 1;
  }
}

@media (max-width: 480px) {
  .container { padding: 8px; gap: 8px; }
  .main-content { padding: 10px; border-radius: 12px; }
}

/* ─────────────────────────────────────────────────────────────
   3. STATISTICS CARDS (results pages)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-container { flex-wrap: wrap; gap: 0; padding: 12px; }
  .stat { flex: 1 1 45%; padding: 8px 4px; }
  .stat h3 { font-size: 22px; margin-bottom: 6px; }
  .stat h4 { font-size: 16px; }
  .stat p  { font-size: 12px; }
}

@media (max-width: 480px) {
  .stats-container { gap: 0; padding: 10px 6px; }
  .stat { flex: 1 1 50%; }
  .stat h3 { font-size: 18px; }
  .stat h4 { font-size: 14px; }
}

/* ─────────────────────────────────────────────────────────────
   4. FILTERS PANEL (inside main content)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .filters { gap: 10px; }
  .filter-input       { flex: 1 1 calc(50% - 10px); min-width: 0; }
  .filter-input-text  { flex: 1 1 100%; min-width: 0; }
  .filter-input input,
  .filter-input select { width: 100%; padding: 10px; font-size: 14px; box-sizing: border-box; }
  .filter-input label { font-size: 14px; }
  .filters-container { padding: 12px; }
}

@media (max-width: 480px) {
  .filter-input { flex: 1 1 100%; }
  .filters { gap: 8px; }
  .filter-input input,
  .filter-input select { padding: 10px; min-height: 44px; font-size: 14px; }
}

/* ─────────────────────────────────────────────────────────────
   5. HERO SECTION (homepage)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero { height: 75vh; }
  .hero-overlay h1 { font-size: 32px; margin-bottom: 12px; }
  .hero-overlay p  { font-size: 16px; margin-bottom: 18px; max-width: 100%; }
  .hero-buttons .btn { padding: 11px 22px; font-size: 14px; }
}

@media (max-width: 480px) {
  .hero { height: 65vh; }
  .hero-overlay { padding: 16px; }
  .hero-overlay h1 { font-size: 24px; line-height: 1.2; }
  .hero-overlay p  { font-size: 14px; }
  .hero-buttons { gap: 10px; }
  .hero-buttons .btn { padding: 10px 20px; font-size: 14px; width: 100%; text-align: center; }
}

/* ─────────────────────────────────────────────────────────────
   6. LANDING PAGE — stats, features, explore, recent updates
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-section,
  .features-section { padding: 24px 14px; margin: 10px auto; }
  .stats-section h2,
  .features-section h2 { font-size: 22px; }

  .stats { gap: 12px; justify-content: center; }
  .stats .stat-item,
  .stats > div { flex: 1 1 calc(50% - 12px); min-width: 0; text-align: center; }

  .features { gap: 14px; }
  .feature { flex: 1 1 calc(50% - 14px); min-width: 0; }

  .explore-by-section { padding: 30px 14px; }
  .explore-by-section h2 { font-size: 22px; }
  .explore-links { gap: 10px; }
  .explore-box { padding: 11px 20px; font-size: 14px; }

  .recent-updates-section { padding: 24px 14px; }
  .recent-updates-section h2 { font-size: 22px; }
  .updates-container { flex-direction: column; gap: 12px; }
  .updates-column { min-width: 0; width: 100%; }

  .featured-highlight { padding: 36px 14px; }
  .featured-highlight h2 { font-size: 22px; }
}

@media (max-width: 480px) {
  .feature { flex: 1 1 100%; }
  .explore-box { width: 100%; text-align: center; }
  .hero-section-stats .stat-num,
  .stats .stat-num { font-size: 28px; }
}

/* ─────────────────────────────────────────────────────────────
   7. DATA TABLES
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Wrapper must scroll horizontally */
  .dataTable-container,
  .dataTables_wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* Reduce min-width so the table is scrollable but not excessive */
  table.dataTable { min-width: 640px !important; }

  /* ── Disable responsive column-collapse; rely on horizontal scroll ──

     IMPORTANT: in dtr-inline mode (DataTables default), the .dtr-control
     class is applied to the FIRST DATA CELL of each row (e.g. SCORER).
     It is NOT a separate column. Hiding it would remove SCORER entirely.

     Strategy:
       1. Force all cells visible (overrides JS style="display:none")
       2. For dtr-inline: only remove the + icon & extra padding, keep the cell
       3. For dtr-column: hide the separate prepended control column
       4. Hide child detail rows
  */

  /* 1. Restore all hidden cells — !important beats JS inline styles */
  table.dataTable thead th,
  table.dataTable tbody td { display: table-cell !important; }

  /* 2a. dtr-inline mode: suppress the green + circle on the SCORER cell */
  table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before,
  table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control::before {
    display: none !important;
    content: none !important;
  }
  /* 2b. dtr-inline mode: reset the 30px left-padding added by DataTables */
  table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
  table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
    padding-left: 8px !important;
    cursor: default !important;
  }

  /* 3. dtr-column mode: a separate prepended control column — hide it fully */
  table.dataTable.dtr-column > tbody > tr > td.dtr-control,
  table.dataTable.dtr-column > tbody > tr > th.dtr-control {
    display: none !important;
    width: 0 !important;
    padding: 0 !important;
  }
  table.dataTable.dtr-column > tbody > tr > td.dtr-control::before,
  table.dataTable.dtr-column > tbody > tr > th.dtr-control::before {
    display: none !important;
    content: none !important;
  }

  /* 4. Hide child detail rows (no longer needed) */
  table.dataTable tr.child { display: none !important; }

  /* DataTables controls */
  .dataTables_info,
  .dataTables_paginate { font-size: 12px; }
  .dataTables_paginate .paginate_button {
    padding: 4px 8px !important;
    font-size: 12px !important;
    min-height: 36px;
  }
  table.dataTable thead th,
  table.dataTable tbody td { font-size: 12px; padding: 7px 8px; }

  /* Stack the length + filter controls */
  .dataTables_length,
  .dataTables_filter { width: 100%; text-align: left; }
  .dataTables_filter input { width: 100%; box-sizing: border-box; }
}

/* ─────────────────────────────────────────────────────────────
   8. SEARCH BAR ROW (teams/players browse)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .search-bar-row { flex-direction: column; gap: 8px; }
  .search-bar-row input { width: 100%; box-sizing: border-box; font-size: 14px; }
  .reset-button { width: 100%; }
}

@media (max-width: 480px) {
  .search-bar-row input  { padding: 10px 12px; font-size: 14px; min-height: 44px; }
  .reset-button { min-height: 44px; font-size: 14px; }
}

/* ─────────────────────────────────────────────────────────────
   9. PAGE TITLES & HEADINGS
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-content h3,
  #pageTitle { font-size: 17px; }
  .applied-filters-text { font-size: 12px; }
}

@media (max-width: 480px) {
  .main-content h3,
  #pageTitle { font-size: 15px; }
}

/* ─────────────────────────────────────────────────────────────
   10. TIER NOTICE BAR
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .tier-notice-bar { font-size: 12px; padding: 10px 12px; flex-direction: column; gap: 6px; text-align: center; }
  .tier-notice-cta { margin-top: 4px; display: inline-block; }
}

/* ─────────────────────────────────────────────────────────────
   11. AUTH PAGES (login / register / forgot password)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .login-box,
  .register-box,
  .auth-box {
    margin: 16px;
    padding: 24px 18px;
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
  }
  .login-box input,
  .register-box input,
  .auth-box input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px;
    font-size: 14px;
    min-height: 44px;
  }
  .login-box button,
  .register-box button,
  .auth-box button { min-height: 44px; font-size: 15px; }
}

/* ─────────────────────────────────────────────────────────────
   12. UPGRADE / PRICING PAGE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .upgrade-page { padding: 0 14px 40px; }
  .upgrade-hero h1 { font-size: 22px; }
  .upgrade-hero p  { font-size: 14px; }
  .upgrade-tiers { grid-template-columns: 1fr; gap: 16px; }
  .upgrade-card--highlight { transform: none; }
  .upgrade-plan-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .upgrade-btn { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
  .upgrade-card { margin: 0; }
  .upgrade-features li { font-size: 13px; }
}

/* ─────────────────────────────────────────────────────────────
   13. GOAL / MATCH RESULT CARDS & HIGHLIGHTS
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .goal-card,
  .match-card { padding: 10px 12px; }

  /* Scoreline layout on matches */
  .match-teams { font-size: 13px; gap: 6px; }
  .match-score { font-size: 20px; }

  .goal-info { font-size: 12px; gap: 4px; }
  .goal-teams { font-size: 13px; }
}

@media (max-width: 480px) {
  .match-teams { flex-direction: column; text-align: center; gap: 4px; }
  .match-score { font-size: 24px; }
}

/* ─────────────────────────────────────────────────────────────
   14. PLAYER / TEAM GRID CARDS (fine-tune existing rules)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .team-name,
  .player-name { font-size: 11px; padding: 6px 4px 8px; }
}

/* ─────────────────────────────────────────────────────────────
   15. PAGINATION
   ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .pagination-container { gap: 4px; flex-wrap: wrap; justify-content: center; }
  .pagination-container button { min-width: 36px; min-height: 36px; font-size: 13px; padding: 4px 8px; }
}

/* ─────────────────────────────────────────────────────────────
   16. FOOTER
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* 2×2 grid — all 4 sections equal 50% tiles */
  .footer-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    padding: 20px 16px;
    text-align: left;
    align-items: start;
  }
  /* Logo tile: stacked (logo above tagline), no full-width span */
  .footer-section-logo-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 100%;
  }
  .footer-section-logo { width: 90px; margin: 0; }
  .footer-section-description { font-size: 12px; line-height: 1.4; margin: 0; }
  .footer-heading { font-size: 12px; margin-bottom: 6px; letter-spacing: 0.3px; }
  .footer-links li { margin-bottom: 5px; }
  .footer-links a { font-size: 12px; }
}

@media (max-width: 480px) {
  .footer-section { padding: 14px 12px; gap: 12px 14px; }
  .footer-section-logo { width: 72px; }
  .footer-section-description { font-size: 11px; }
  .footer-heading { font-size: 11px; margin-bottom: 5px; }
  .footer-links a { font-size: 11px; }
  .footer-links li { margin-bottom: 4px; }
}

/* ─────────────────────────────────────────────────────────────
   17. AD SLOTS
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ad-slot { margin: 10px auto; }
  .ad-slot img { border-radius: 4px; }
}

/* ─────────────────────────────────────────────────────────────
   18. ACCOUNT PAGE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .account-page { margin: 16px auto; padding: 0 14px 40px; }
  .account-section { padding: 18px; }
  .account-section h2 { font-size: 16px; }
}

@media (max-width: 480px) {
  .account-page input,
  .account-page select { width: 100%; box-sizing: border-box; min-height: 44px; }
  .account-page button { min-height: 44px; }
}

/* ─────────────────────────────────────────────────────────────
   19. COUNTRIES / ORGANIZATIONS BROWSE PAGES
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .countries-grid,
  .orgs-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .country-card,
  .org-card { padding: 12px; font-size: 13px; }
}

@media (max-width: 480px) {
  .countries-grid,
  .orgs-grid { grid-template-columns: 1fr !important; }
}

/* ─────────────────────────────────────────────────────────────
   20. MISC / UTILITY
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Ensure no element ever causes horizontal scroll */
  .main-content > * { max-width: 100%; }
  img { max-width: 100%; height: auto; }
  .export-btn,
  .btn-export { font-size: 13px; padding: 7px 14px; }
}

@media (max-width: 480px) {
  /* Touch-friendly tap targets on all buttons */
  button:not(.chat-chip):not(.sidebar-toggle-btn),
  a.btn,
  input[type="submit"] { min-height: 44px; }

  /* Remove horizontal padding squeeze */
  body { overflow-x: hidden; }
}
