/* Action bar & betting controls */
.action-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 1000;
  width: 100%;
  max-width: 600px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Mobile action bar positioning - ONLY affects screens <= 600px */
@media (max-width: 600px) {
  .action-bar {
    left: 0;
    right: 0;
    transform: none;
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 12px 10px;
    gap: 10px;
    background: rgba(15,15,15,0.95);
    border-top: 2px solid #333;
    backdrop-filter: blur(10px);
  }
}

.action-btn {
  padding: 12px 18px;
  border: none;
  border-radius: 50px;
  font-weight: bold;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform .2s;
  text-align: center;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}
.action-btn:hover { transform: translateY(-3px); }
.action-btn:active { transform: translateY(1px); }

/* Action buttons are hidden by default - JS shows them based on game state */
.action-btn {
  display: none;
}

/* Only show action buttons when they have the 'hidden' class removed */
.action-btn:not(.hidden) {
  display: inline-flex;
}

/* The hidden class ALWAYS wins - highest priority */
.action-btn.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Even more specific - ensure hidden class wins over everything */
#hit-btn.hidden,
#stand-btn.hidden,
#double-btn.hidden,
#split-btn.hidden,
#surrender-btn.hidden,
#insurance-btn.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

#hit-btn { background: #4CAF50; color: #fff; }
#stand-btn { background: #f44336; color: #fff; }
#double-btn { background: #2196F3; color: #fff; }
#split-btn { background: #9C27B0; color: #fff; }
#surrender-btn { background: #FF9800; color: #fff; }
#insurance-btn { background: #795548; color: #fff; }

/* Betting controls – hidden by default; JS shows/hides with inline display */
#betting-controls,
.betting-controls {
  display: none;   /* default hidden; inline 'flex' from renderer will reveal */
  background: rgba(0,0,0,0.8);
  padding: 15px 25px;
  border-radius: 50px;
  align-items: center;
  gap: 15px;
  z-index: 1000;
  flex-direction: row;
}

.bet-label {
  font-size: 0.9rem;
  color: #ffd700;
  text-align: center;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.bet-input-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
}

/* Touch-friendly enhancements for mobile */
@media (max-width: 600px) {
  #betting-controls *,
  .betting-controls * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  #betting-controls input,
  .betting-controls input {
    -webkit-user-select: text;
    user-select: text;
    -webkit-tap-highlight-color: rgba(255,215,0,0.2);
  }
  
  #place-bet {
    -webkit-tap-highlight-color: rgba(255,215,0,0.3);
  }
}

/* Ensure betting controls stay hidden when they have the 'hidden' class */
#betting-controls.hidden,
.betting-controls.hidden { 
  display: none !important; 
  visibility: hidden !important;
  opacity: 0 !important;
}

/* The hidden class ALWAYS wins for betting controls too */
.betting-controls.hidden,
#betting-controls.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Mobile betting controls */
@media (max-width: 600px) {
  #betting-controls,
  .betting-controls {
    padding: 16px 20px;
    border-radius: 16px;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(15px);
    width: 95%;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.9);
    border: 1px solid rgba(255,255,255,0.1);
  }
  
  .bet-label {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
  }
  
  .bet-input-row {
    flex-direction: row;
    gap: 12px;
    justify-content: center;
    align-items: center;
  }
}

#betting-controls input,
.betting-controls input {
  padding: 12px;
  border: none;
  border-radius: 5px;
  width: 120px;
  font-size: 1.1rem;
  text-align: center;
}

/* Mobile betting input */
@media (max-width: 600px) {
  #betting-controls input,
  .betting-controls input {
    width: 120px;
    padding: 16px 12px;
    border-radius: 12px;
    border: 2px solid rgba(255,215,0,0.3);
    background: rgba(34,34,34,0.9);
    color: #fff;
    min-height: 52px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
  
  #betting-controls input:focus,
  .betting-controls input:focus {
    outline: none;
    border-color: rgba(255,215,0,0.6);
    box-shadow: 0 0 0 3px rgba(255,215,0,0.1);
    background: rgba(34,34,34,1);
  }
}

#place-bet {
  padding: 12px 25px;
  border: none;
  border-radius: 50px;
  background: var(--gold);
  color: var(--black);
  font-weight: bold;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Mobile place bet button */
@media (max-width: 600px) {
  #place-bet {
    padding: 16px 28px;
    border-radius: 12px;
    min-height: 52px;
    min-width: 120px;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(255,215,0,0.3);
    border: 2px solid rgba(255,215,0,0.2);
    transition: all 0.2s ease;
  }
  
  #place-bet:active {
    transform: translateY(2px);
    box-shadow: 0 2px 8px rgba(255,215,0,0.2);
  }
  
  #place-bet:hover {
    box-shadow: 0 6px 20px rgba(255,215,0,0.4);
    transform: translateY(-1px);
  }
}

/* Additional mobile breakpoints for better scaling */
  @media (max-width: 480px) {
    #betting-controls,
    .betting-controls {
      padding: 14px 16px;
      gap: 10px;
      bottom: 110px;
      width: 98%;
      max-width: 350px;
    }
  
  .bet-label {
    font-size: 0.85rem;
  }
  
  .bet-input-row {
    gap: 10px;
  }
  
  #betting-controls input,
  .betting-controls input {
    width: 100px;
    padding: 14px 10px;
    min-height: 48px;
    font-size: 1rem;
  }
  
  #place-bet {
    padding: 14px 24px;
    min-height: 48px;
    min-width: 100px;
    font-size: 1.1rem;
  }
}

  @media (max-width: 360px) {
    #betting-controls,
    .betting-controls {
      padding: 12px 14px;
      gap: 8px;
      bottom: 100px;
      width: 99%;
      max-width: 320px;
    }
  
  .bet-label {
    font-size: 0.8rem;
  }
  
  .bet-input-row {
    gap: 8px;
  }
  
  #betting-controls input,
  .betting-controls input {
    width: 90px;
    padding: 12px 8px;
    min-height: 44px;
    font-size: 0.95rem;
  }
  
  #place-bet {
    padding: 12px 20px;
    min-height: 44px;
    min-width: 90px;
    font-size: 1rem;
  }
}

/* Game HUD buttons (Join, Leave, Shop) */
#join-btn, #leave-btn, #shop-btn {
  padding: 8px 16px;
  border: 2px solid #333;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  height: 36px;
}

#join-btn {
  background: #4CAF50;
  color: white;
  border-color: #45a049;
}

#join-btn:hover:not(:disabled) {
  background: #45a049;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#join-btn:disabled {
  background: #cccccc;
  color: #666666;
  cursor: not-allowed;
  border-color: #999999;
}

#leave-btn {
  background: #f44336;
  color: white;
  border-color: #da190b;
}

#leave-btn:hover {
  background: #da190b;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#shop-btn {
  background: #2196F3;
  color: white;
  border-color: #1976D2;
}

#shop-btn:hover {
  background: #1976D2;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Hide mobile navigation on desktop by default */
.mobile-nav {
  display: none;
}

/* Show desktop navigation by default */
.desktop-nav {
  display: block;
}

/* Mobile HUD button positioning */
@media (max-width: 600px) {
  /* Top navigation bar */
  .mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(15px);
    border-bottom: 2px solid #333;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
  }
  
  #join-btn, #leave-btn, #shop-btn {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    min-height: 40px;
    min-width: 70px;
    font-size: 0.85rem;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
    border-width: 2px;
    margin: 0 2px;
  }
  
  /* Ensure game content starts below nav */
  .game-container {
    padding-top: 70px;
    padding-bottom: 200px; /* Space for bottom controls */
  }
  
  /* Hide desktop nav, show mobile nav */
  .desktop-nav {
    display: none;
  }
  
  /* Mobile navigation styling */
  .mobile-nav {
    display: flex;
  }
  
  .mobile-nav button {
    background: #2196F3;
    color: white;
    border: 2px solid #1976D2;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
    min-width: 70px;
  }
  
  .mobile-nav button.secondary {
    background: #f44336;
    border-color: #da190b;
  }
  
  .mobile-nav button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }
}

/* Daily bonus button styling */
#daily-bonus-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  color: white;
  border: none;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
}

#daily-bonus-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

#daily-bonus-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
