/* mobile.css — Grillegrill Mobile Responsive
 * Phase 0: CSS Grid + responsive foundation
 * Last updated: 2026-06-07
 */

/* ============================================
   VIEW TOGGLE
   ============================================ */
.view-toggle {
  background: var(--gg-green);
  padding: var(--gg-space-xs) var(--gg-space-sm);
  text-align: right;
  font-size: var(--gg-font-size-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}
.view-toggle a { 
  color: var(--gg-white); 
  font-weight: bold; 
  padding: var(--gg-space-xs) var(--gg-space-sm);
  display: inline-block;
  min-height: var(--gg-touch-min);
  min-width: var(--gg-touch-min);
  line-height: 1.4;
}
.view-toggle strong { color: var(--gg-white); }

/* ============================================
   BASE MOBILE
   Screen widths 320px - 767px
   ============================================ */

/* Reset body for mobile */
body.MAIN {
  background-color: var(--gg-bg);
  margin: 0;
  padding: 0;
  font-size: var(--gg-font-size-base);
  -webkit-text-size-adjust: 100%;
}

.MAIN {
  width: 100%;
  background-color: var(--gg-white);
  margin: 0;
  padding: 0;
}

/* ============================================
   MAIN LAYOUT — CSS Grid (replaces table)
   ============================================ */
.MAINTB {
  display: grid !important;
  grid-template-columns: 1fr;
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 auto;
  border: none;
  padding: 0;
}

/* Header row — full width */
.MAINTB > tr:first-child > td {
  display: block;
  width: 100%;
  padding: var(--gg-space-xs);
}

/* Message row */
.MAINTB > tr:nth-child(2) > td {
  display: block;
  width: 100%;
  padding: var(--gg-space-xs);
}

/* Next game crawl row */
.MAINTB > tr:nth-child(3) > td {
  display: block;
  width: 100%;
  padding: var(--gg-space-xs);
}

/* Main content row — 3 columns become 1 */
.MAINTB > tr:nth-child(4) {
  display: flex;
  flex-direction: column;
}

.MAINTB > tr:nth-child(4) > td.LEFTCOL,
.MAINTB > tr:nth-child(4) > td.RIGHTCOL {
  display: none;  /* Hide side columns on mobile */
}

.MAINTB > tr:nth-child(4) > td.CENTERCOL {
  display: block;
  width: 100% !important;
  max-width: 100%;
  padding: var(--gg-space-sm);
  /* Override any fixed width from td.CENTERCOL */
  flex: 1 1 100%;
}

/* Footer rows */
.MAINTB > tr:nth-child(5) > td,
.MAINTB > tr:nth-child(6) > td {
  display: block;
  width: 100%;
  padding: var(--gg-space-xs);
  text-align: center;
}

/* ============================================
   BANNER / HEADER IMAGE
   ============================================ */
.MAINTB img {
  max-width: 100%;
  width: 100%;
  height: auto;
}

/* ============================================
   TABLES — Scrollable horizontally
   ============================================ */
table {
  font-size: var(--gg-font-size-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Tables that should be full-width block containers */
table.MAINTB,
table.STANDTB,
table.PREDTB,
table.MENUTB,
table.LOGINTB,
table.SHOUT {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

table.STANDTB {
  display: block;
  overflow-x: auto;
  width: 100%;
  font-size: var(--gg-font-size-xs);
  white-space: normal;
  word-wrap: break-word;
  hyphens: auto;
}

table.PREDTB {
  display: block;
  overflow-x: auto;
  width: 100%;
  white-space: normal;
  word-wrap: break-word;
  hyphens: auto;
}

table.MENUTB {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

table.LOGINTB {
  display: block;
  overflow-x: auto;
}

table.SHOUT {
  display: block;
  overflow-x: auto;
  font-size: var(--gg-font-size-xs);
}

/* Table cells */
td {
  padding: var(--gg-space-xs) var(--gg-space-sm);
  line-height: 1.4;
  white-space: normal;
  word-wrap: break-word;
}

td.LEFTCOL {
  display: none;
  width: 0;
}

td.RIGHTCOL {
  display: none;
  width: 0;
}

td.CENTERCOL {
  display: block;
  width: 100% !important;
  padding: var(--gg-space-sm);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
font.TBLHEAD {
  font-size: var(--gg-font-size-sm);
  line-height: 1.3;
  color: var(--gg-white);
  font-family: var(--gg-font);
  font-weight: bold;
}

font.TBLROW {
  font-size: var(--gg-font-size-sm);
  line-height: 1.4;
  color: var(--gg-text);
  font-family: var(--gg-font);
}

font.TABELL {
  font-size: var(--gg-font-size-sm);
  color: var(--gg-text);
  font-family: var(--gg-font);
}

/* ============================================
   LINKS — Touch-friendly
   ============================================ */
a {
  padding: var(--gg-space-sm) var(--gg-space-sm);
  display: inline-block;
  min-height: var(--gg-touch-min);
  min-width: var(--gg-touch-min);
  line-height: 1.4;
  text-decoration: none;
  color: var(--gg-black);
}

a:link {
  font-family: var(--gg-font);
  font-size: var(--gg-font-size-sm);
  color: var(--gg-black);
  text-decoration: none;
}

a:visited {
  font-family: var(--gg-font);
  font-size: var(--gg-font-size-sm);
  color: var(--gg-black);
  text-decoration: none;
}

a:hover {
  font-family: var(--gg-font);
  font-size: var(--gg-font-size-sm);
  color: orange;
  text-decoration: none;
}

/* ============================================
   INPUT ELEMENTS — Touch-friendly
   ============================================ */
.inputbox {
  font-family: var(--gg-font);
  font-size: var(--gg-font-size-base);
  font-weight: bold;
  color: var(--gg-text);
  background: var(--gg-white);
  border: 1px solid var(--gg-black);
  padding: var(--gg-space-sm) var(--gg-space-md);
  min-height: var(--gg-touch-min);
  width: 100%;
  box-sizing: border-box;
}

.submit {
  font-family: var(--gg-font);
  font-style: normal;
  font-weight: bold;
  font-size: var(--gg-font-size-sm);
  color: var(--gg-red);
  border: 1px solid var(--gg-black);
  background: var(--gg-white);
  padding: var(--gg-space-sm) var(--gg-space-md);
  min-height: var(--gg-touch-min);
  min-width: 80px;
  cursor: pointer;
}

/* ============================================
   TABLE HEADER CELLS
   ============================================ */
td.TBLHEAD {
  background-color: var(--gg-green);
  padding: var(--gg-space-sm);
  font-family: var(--gg-font);
  font-size: var(--gg-font-size-sm);
  color: var(--gg-white);
  font-weight: bold;
}

td.TBLPOS { background-color: var(--gg-green); width: 40px; text-align: center; }
td.TBLUSER { background-color: var(--gg-green); width: 120px; text-align: center; }
td.TBLPLAYED { background-color: var(--gg-green); width: 40px; text-align: center; }
td.TBLWON { background-color: var(--gg-green); width: 40px; text-align: center; }
td.TBLDRAWN { background-color: var(--gg-green); width: 40px; text-align: center; }
td.TBLLOST { background-color: var(--gg-green); width: 40px; text-align: center; }
td.TBLFOR { background-color: var(--gg-green); width: 40px; text-align: center; }
td.TBLAGAINST { background-color: var(--gg-green); width: 40px; text-align: center; }
td.TBLGD { background-color: var(--gg-green); width: 40px; text-align: center; }
td.TBLPTS { background-color: var(--gg-green); width: 40px; text-align: center; }

/* ============================================
   TABLE DATA ROWS
   ============================================ */
td.TBLROW {
  background-color: var(--gg-row-even);
  overflow: hidden;
  text-overflow: ellipsis;
}

td.TBLROWODD {
  background-color: var(--gg-row-odd);
}

/* ============================================
   POSITION COLORS (medal colors)
   ============================================ */
td.POS1,
font.POS1 { background-color: gold; }
td.POS2,
font.POS2 { background-color: silver; }
td.POS3,
font.POS3 { background-color: var(--gg-bronze); }

td.POS45,
font.POS45 {
  border-collapse: collapse;
  background: repeating-linear-gradient(45deg, var(--gg-white), var(--gg-white) 5px, #D3F2DA 5px, #D3F2DA 10px);
}

td.POS610,
font.POS610 {
  border-collapse: collapse;
  background: repeating-linear-gradient(45deg, var(--gg-white), var(--gg-white) 5px, #DDF9F7 5px, #DDF9F7 10px);
}

td.POS10TH,
font.POS10TH {
  border-collapse: collapse;
  background: repeating-linear-gradient(45deg, var(--gg-white), var(--gg-white) 5px, #f0f0f0 5px, #f0f0f0 10px);
}

td.POS6,
font.POS6 { background-color: #7CFC00; }
td.POS5,
font.POS5 { background-color: BLUE; }
td.POS4,
font.POS4 { background-color: #ff66ff; }

/* ============================================
   UP/DOWN STATUS
   ============================================ */
td.UADUP { background-color: var(--gg-up); }
td.UADDOWN { background-color: var(--gg-down); }
font.UADUP { color: var(--gg-white); }
font.UADDOWN { color: var(--gg-white); }

/* ============================================
   ERROR / WARNING / INFO STATES
   ============================================ */
td.ERROR { background-color: var(--gg-error); }
td.WARNING { background-color: var(--gg-warning); }
td.INFO { background-color: var(--gg-info); }
font.ERROR, font.WARNING, font.INFO { color: var(--gg-white); }

/* ============================================
   MESSAGE BOXES
   ============================================ */
td.MESSAGE {
  font-size: var(--gg-font-size-sm);
  color: var(--gg-white);
  font-family: var(--gg-font);
  text-decoration: none;
  background-color: var(--gg-green);
  padding: var(--gg-space-sm);
}

/* ============================================
   LOGIN PANEL
   ============================================ */
td.LOGINHD { background-color: var(--gg-green); }
td.LOGINRW { background-color: var(--gg-row-even); }
font.LOGINHD { font-size: var(--gg-font-size-xs); color: var(--gg-white); font-family: var(--gg-font); font-weight: bold; }
font.LOGINRW { font-size: var(--gg-font-size-xs); color: var(--gg-text); font-family: var(--gg-font); }

/* ============================================
   SHOUTBOX / CHAT
   ============================================ */
div.SHOUTROW {
  background: var(--gg-row-even);
  color: var(--gg-text);
  padding: var(--gg-space-xs);
  width: 100%;
  height: 200px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

font.SHOUTROW {
  font-size: var(--gg-font-size-xs);
  color: var(--gg-text-muted);
  font-family: var(--gg-font);
}

font.SHOUTHEAD {
  font-size: var(--gg-font-size-xs);
  color: var(--gg-text-muted);
  font-family: var(--gg-font);
  font-weight: bold;
}

font.SHOUTDATE {
  font-size: 10px;
  color: var(--gg-text-muted);
  font-family: var(--gg-font);
}

font.SHOUTMSG {
  font-size: var(--gg-font-size-xs);
  color: var(--gg-text-muted);
  font-family: var(--gg-font);
}

/* ============================================
   LEADERBOARD / STANDINGS
   ============================================ */
td.LEADER { background-color: yellow; }
font.LEADER { font-size: var(--gg-font-size-sm); color: var(--gg-text); font-family: var(--gg-font); }

/* ============================================
   FLAG ICONS
   ============================================ */
img.FLAG {
  height: 14px;
  border: 0;
  vertical-align: middle;
}

/* ============================================
   TAB ICONS
   ============================================ */
img.TABICON {
  height: 16px;
  border: 0;
}

/* ============================================
   TEAM CELLS
   ============================================ */
td.TEAM {
  display: inline;
  background-color: var(--gg-white);
  vertical-align: middle;
}
font.TEAM {
  font-size: var(--gg-font-size-sm);
  color: var(--gg-text);
  font-family: var(--gg-font);
  font-weight: normal;
  text-decoration: none;
}

td.FLAG {
  background-color: var(--gg-row-even);
  text-align: center;
}
font.FLAG {
  font-size: var(--gg-font-size-sm);
  color: var(--gg-text);
  font-family: var(--gg-font);
}

/* ============================================
   CRAWL / MARQUEE ROW
   ============================================ */
td.TDCRAWL {
  background-color: var(--gg-white);
  width: 100%;
  text-align: center;
  padding: var(--gg-space-sm);
}

/* ============================================
   MENU STYLING
   ============================================ */
#MENU li a {
  text-decoration: none;
  color: var(--gg-white);
  display: block;
  padding: var(--gg-space-md) var(--gg-space-sm);
  min-height: var(--gg-touch-min);
}

#MENU li a:hover {
  text-decoration: none;
  color: var(--gg-black);
  background-color: #33B5E5;
}

/* ============================================
   BLINK ANIMATION (retro)
   ============================================ */
.blink {
  animation-duration: 1s;
  animation-name: blink;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  animation-timing-function: ease-in-out;
}

@keyframes blink {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ============================================
   LANGUAGE OPTIONS
   ============================================ */
td.LANG {
  background-color: var(--gg-green);
  text-align: center;
}
font.LANG {
  font-size: var(--gg-font-size-xs);
  color: var(--gg-white);
  font-family: var(--gg-font);
  font-weight: bold;
  text-decoration: none;
}

/* ============================================
   INLINE ELEMENTS
   ============================================ */
td.INLINE {
  display: inline;
  background-color: var(--gg-row-even);
}

/* ============================================
   HELP / INFO STYLES
   ============================================ */
font.HELPTEXT {
  font-size: var(--gg-font-size-sm);
  color: var(--gg-text);
  font-family: var(--gg-font);
  text-decoration: none;
  background-color: var(--gg-white);
}

font.HELPROW {
  font-size: var(--gg-font-size-sm);
  color: var(--gg-text);
  font-family: var(--gg-font);
  text-decoration: none;
}

font.HELPHEAD {
  font-size: var(--gg-font-size-sm);
  color: var(--gg-white);
  font-family: var(--gg-font);
  text-decoration: BOLD;
}

font.PREDHEAD {
  font-size: var(--gg-font-size-xs);
  color: var(--gg-red);
  font-family: var(--gg-font);
  text-decoration: BOLD;
}

/* ============================================
   PRIZE / HALL OF FAME
   ============================================ */
font.HOFAME {
  font-size: var(--gg-font-size-lg);
  color: var(--gg-white);
  font-family: var(--gg-font);
  font-weight: bold;
  text-decoration: none;
  background-color: var(--gg-black);
}

/* ============================================
   VERSION TEXT
   ============================================ */
font.VERSION {
  font-size: 10px;
  color: var(--gg-text);
  font-family: var(--gg-font);
}

font.NEDFLYTT {
  font-size: var(--gg-font-size-sm);
  color: var(--gg-text);
  font-family: var(--gg-font);
  text-decoration: none;
}

font.KVAL {
  font-size: var(--gg-font-size-sm);
  color: var(--gg-text);
  font-family: var(--gg-font);
  text-decoration: none;
}

td.NEDFLYTT { background-color: #A0A0A0; }
td.KVAL { background-color: #D0D0D0; }
td.TABELL { background-color: var(--gg-white); }

/* ============================================
   MESSAGE NOTICES (global messages)
   ============================================ */
font.MESSAGE {
  font-size: var(--gg-font-size-sm);
  color: var(--gg-white);
  font-family: var(--gg-font);
  text-decoration: none;
  background-color: var(--gg-green);
}

/* ============================================
   PRD ROW (prediction rows)
   ============================================ */
font.PRDROW {
  font-size: var(--gg-font-size-sm);
  color: var(--gg-text);
  font-family: var(--gg-font);
  font-weight: normal;
  text-decoration: none;
  background-color: var(--gg-row-even);
}

/* ============================================
   TABLE BORDERS (keep retro rounded look)
   ============================================ */
td {
  border-collapse: separate;
  border: solid white 0px;
  border-radius: 3px;
  -moz-border-radius: 3px;
}

/* ============================================
   RESPONSIVE: 376px - 767px (larger phones)
   ============================================ */
@media (min-width: 376px) and (max-width: 767px) {
  font.TBLROW {
    font-size: var(--gg-font-size-base);
  }
  
  td.TBLUSER { width: 150px; }
  
  table.STANDTB {
    font-size: var(--gg-font-size-sm);
  }
  
  /* Slightly larger touch targets still fine */
  a {
    padding: var(--gg-space-md);
  }
}

/* ============================================
   RESPONSIVE: 768px - 1023px (tablet / small laptop)
   ============================================ */
@media (min-width: 768px) and (max-width: 1023px) {
  .MAINTB {
    display: grid !important;
    grid-template-columns: 162px 1fr;
    max-width: 100%;
  }

  /* Hide drawers at tablet — table columns are visible */
  .mobile-header,
  .left-drawer,
  .right-drawer,
  .drawer-overlay,
  .bottom-tab-bar {
    display: none !important;
  }

  /* Show table columns */
  .desktop-only {
    display: table-cell !important;
  }

  .MAINTB > tr:nth-child(4) > td.RIGHTCOL {
    display: none;  /* Hide right column on tablet too */
  }
  
  .MAINTB > tr:nth-child(4) > td.LEFTCOL {
    display: block;
    width: 162px !important;
  }
  
  .MAINTB > tr:nth-child(4) > td.CENTERCOL {
    display: block;
    width: auto !important;
  }
  
  td.LEFTCOL {
    display: block;
    width: 162px !important;
  }
  
  td.RIGHTCOL {
    display: none;
  }
  
  td.CENTERCOL {
    width: auto !important;
  }
  
  table.STANDTB {
    display: block;
    overflow-x: auto;
    width: 100%;
  }
  
  table.PREDTB {
    display: block;
    overflow-x: auto;
    width: 100%;
  }
}

/* ============================================
   RESPONSIVE: 1024px+ (desktop)
   Desktop gets full 3-column layout
   This is the fallback — desktop CSS handles it
   ============================================ */
@media (min-width: 1024px) {
  /* Mobile CSS does not apply to desktop.
     common.css handles desktop layout at this width. */
  .MAINTB {
    display: table !important;
    width: var(--gg-max-width) !important;
  }
  
  td.LEFTCOL,
  td.RIGHTCOL {
    display: table-cell;
  }
  
  td.CENTERCOL {
    display: table-cell;
  }
}

/* ============================================
   MOBILE HEADER
   Fixed top bar with hamburger + logo + profile
   ============================================ */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--gg-green);
  padding: var(--gg-space-sm) var(--gg-space-md);
  position: sticky;
  top: 0;
  z-index: 200;
  min-height: 56px;
  box-sizing: border-box;
}

.mobile-menu-btn,
.mobile-profile-btn {
  background: none;
  border: none;
  padding: var(--gg-space-sm);
  cursor: pointer;
  min-width: var(--gg-touch-min);
  min-height: var(--gg-touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hamburger-icon {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--gg-white);
  position: relative;
}
.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 24px;
  height: 2px;
  background-color: var(--gg-white);
}
.hamburger-icon::before { top: -8px; }
.hamburger-icon::after { top: 8px; }

.profile-icon {
  font-size: 24px;
  line-height: 1;
}

.mobile-logo {
  font-family: var(--gg-font);
  font-size: var(--gg-font-size-lg);
  font-weight: bold;
  color: var(--gg-white);
  text-decoration: none;
}

/* ============================================
   DRAWERS (slide-in panels)
   ============================================ */
.drawer-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.drawer-overlay.open {
  display: block;
  opacity: 1;
}

.left-drawer,
.right-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 280px;
  max-width: 80vw;
  background-color: var(--gg-white);
  z-index: 400;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.left-drawer {
  left: 0;
  transform: translateX(-100%);
}

.right-drawer {
  right: 0;
  transform: translateX(100%);
}

.left-drawer.open {
  transform: translateX(0);
}

.right-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--gg-green);
  color: var(--gg-white);
  padding: var(--gg-space-md);
  font-family: var(--gg-font);
  font-size: var(--gg-font-size-base);
  font-weight: bold;
  min-height: 56px;
  box-sizing: border-box;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--gg-white);
  font-size: 20px;
  padding: var(--gg-space-sm);
  cursor: pointer;
  min-width: var(--gg-touch-min);
  min-height: var(--gg-touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-content {
  padding: var(--gg-space-sm);
}

.drawer-content table {
  width: 100%;
}

/* Login panel in drawer */
.drawer-content .LOGINTB {
  margin-bottom: var(--gg-space-md);
}

/* Menu in drawer */
.drawer-content #MENU {
  list-style: none;
  padding: 0;
  margin: 0;
}

.drawer-content #MENU li {
  border-bottom: 1px solid var(--gg-bg);
}

.drawer-content #MENU li a {
  display: block;
  padding: var(--gg-space-md);
  color: var(--gg-text);
  text-decoration: none;
  min-height: var(--gg-touch-min);
}

.drawer-content #MENU li a:hover {
  background-color: var(--gg-bg);
  color: var(--gg-green);
}

/* ============================================
   BOTTOM TAB BAR
   Fixed bottom navigation
   ============================================ */
.bottom-tab-bar {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--gg-white);
  border-top: 2px solid var(--gg-green);
  z-index: 100;
  padding: 0;
  margin: 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--gg-space-sm) var(--gg-space-xs);
  text-decoration: none;
  color: var(--gg-text-muted);
  min-height: var(--gg-touch-min);
  transition: color 0.2s ease;
}

.tab-item:active,
.tab-item.active {
  color: var(--gg-green);
}

.tab-icon {
  font-size: 20px;
  line-height: 1.2;
}

.tab-label {
  font-family: var(--gg-font);
  font-size: 10px;
  margin-top: 2px;
}

/* ============================================
   DESKTOP-ONLY elements (hidden on mobile)
   ============================================ */
.desktop-only {
  display: none !important;
}

/* Add bottom padding to main content for tab bar */
@media (max-width: 1023px) {
  body {
    padding-bottom: 60px;
  }

  .MAINTB {
    padding-bottom: 60px;
  }
}