/* css/popup-overlays.css */
:root {
  --popup-width: 320px;
  --accent-color: gold;
  --text-glow: 1px 1px 3px rgba(0, 0, 0, 0.6);
  --bg-dark: #2a0a1f;
  --bg-darker: #12000f;
  --ribbon-gradient: linear-gradient(to right, #FFD700, #FF8C00);
  --btn-glow: rgba(255, 215, 0, 0.7);
}

/* Overlay System - Interactive Styling from page.html */
:root {
  --popup-width: 320px;
  --accent-color: gold;
  --text-glow: 1px 1px 3px rgba(0, 0, 0, 0.6);
  --bg-dark: #2a0a1f;
  --bg-darker: #12000f;
  --ribbon-gradient: linear-gradient(to right, #FFD700, #FF8C00);
  --btn-glow: rgba(255, 215, 0, 0.7);
}

/* Overlay container positioning */
#overlay-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  pointer-events: none; /* Allow clicks to pass through to background */
}

/* Base overlay styling */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: auto; /* Re-enable clicks for overlay content */
  
  /* NO TRANSITIONS: Instant appearance */
  transition: none;
  
  /* PREVENT LAYOUT SHIFTS: Ensure consistent sizing */
  box-sizing: border-box;
  
  /* PREVENT BUTTON SIZE CHANGES: Maintain consistent button sizing */
  --button-transition: none;
}

/* Overlays are naturally visible when loaded (like pages) */

/* PREVENT VISUAL GLITCHES: Ensure content doesn't shift during loading */
.overlay .overlay-content {
  
  /* NO TRANSITIONS: Instant appearance */
  transition: none;
}


/* Remove overlay background and icon animations */
.overlay::before,
.overlay[style*="display: flex"]::before,
.overlay-content::before,
.overlay-content::after,
.overlay[style*="display: flex"] .overlay-content::after {
  display: none;
  content: none;
  animation: none;
}

/* Unified overlay content styling - applies to ALL overlays */
.overlay .overlay-content,
#info-overlay .overlay-content,
#diamond-spin-overlay .overlay-content,
#pass-n-play-overlay .overlay-content,
#return-bonus-overlay .overlay-content,
.overlay-inner .overlay-content,
#info-overlay .overlay-inner .overlay-content,
#diamond-spin-overlay .overlay-inner .overlay-content,
#pass-n-play-overlay .overlay-inner .overlay-content,
#return-bonus-overlay .overlay-inner .overlay-content {
  opacity: 1;
  transform: none;
  animation: none;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('../images/wpref.jpg') no-repeat center center / cover;
  border: clamp(2px, 0.5vw, 3px) solid gold;
  border-radius: clamp(15px, 3vw, 25px);
  box-shadow: 0 0 clamp(15px, 3vw, 25px) var(--btn-glow);
  max-height: 75vh; /* Cap height at 75vh */
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  margin-bottom: clamp(5px, 1vw, 10px);
  position: relative;
  width: 92.5%; /* Reduced by 7.5% from 100% */
  max-width: 92.5%; /* Reduced by 7.5% from 100% */
  margin-left: auto; /* Center horizontally */
  margin-right: auto; /* Center horizontally */
  -webkit-overflow-scrolling: touch; /* Enable smooth scrolling on iOS */
  overscroll-behavior: contain; /* Prevent scroll chaining */
  touch-action: pan-y; /* Enable vertical touch scrolling */

}

/* Override theme inheritance for overlays */
body.theme-evening .overlay .overlay-content,
body.theme-morning .overlay .overlay-content,
body.theme-afternoon .overlay .overlay-content,
body.theme-night .overlay .overlay-content {
  border: clamp(2px, 0.5vw, 3px) solid gold;
}

/* Ensure all overlay content respects container width */
.overlay .overlay-content *,
.overlay-inner .overlay-content * {
  max-width: 100%;
  box-sizing: border-box;
}

/* Unified overlay inner content styling */
.overlay .overlay-content > div {
  border-radius: clamp(15px, 3vw, 25px);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Close button styling - positioned relative to overlay container */
.close-overlay {
background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto; /* Ensure button is clickable even when container has pointer-events: none */
}

/* Sticky header styling for overlays */
.o1-popup-header {
  position: sticky;
  top: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.9), rgba(0,0,0,0.8));
  /* backdrop-filter removed for performance */
  border-bottom: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: clamp(15px, 3vw, 25px) clamp(15px, 3vw, 25px) 0 0;
  padding: 15px 20px;
  margin: 0 0 20px 0; /* Remove negative margins */
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.o1-popup-header h3 {
  color: #fff;
  font-size: 1.2rem;
  font-weight: bold;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 215, 0, 0.4);
  background: linear-gradient(to right, gold, orange);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

/* Button area spacing for overlays */
.o1-setup-actions {
  margin-top: 20px;
  margin-bottom: 10px;
  padding: 10px 0;
}



.overlay-inner {
  position: relative;       /* establishes context for the close button */
  width: 92.5%; /* Reduced by 7.5% from 100% */
  max-width: 92.5%; /* Reduced by 7.5% from 100% */
  max-height: 75vh; /* Cap height at 75vh */
  display: flex;
  flex-direction: column;
  margin-bottom: clamp(5px, 1vw, 10px);
  margin-left: auto;
  margin-right: auto;
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Header banner styling */
.header-banner {
  background: linear-gradient(to right, gold, orange);
  color: #000;
  font-weight: bold;
  font-size: clamp(16px, 4vw, 22px);
  text-align: center;
  padding: clamp(4px, 1vw, 6px) 0;
  border-radius: clamp(8px, 2vw, 12px);
  margin: clamp(5px, 1vw, 10px) 0;
  box-shadow: 0 clamp(1px, 0.3vw, 2px) clamp(3px, 1vw, 6px) rgba(0,0,0,0.3);
}

/* Info overlay content styling */

.info-content {
  position: relative;
  z-index: 2;
}

.info-content h2 {
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
  font-size: 2em;
  text-shadow: var(--text-glow);
  background: linear-gradient(to right, gold, orange);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.info-content p {
  color: #fff;
  text-align: center;
  margin-bottom: 30px;
  font-size: 1.1em;
  line-height: 1.6;
  text-shadow: var(--text-glow);
}

.info-content .features {
  margin-bottom: 30px;
}

.info-content .features h3 {
  color: #fff;
  margin-bottom: 15px;
  font-size: 1.5em;
  text-shadow: var(--text-glow);
  text-align: center;
}

.info-content .features ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.info-content .features li {
  color: #fff;
  padding: 8px 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  font-size: 0.95em;
  /* backdrop-filter removed for performance */
  text-shadow: var(--text-glow);
  transition: transform 0.2s ease, background 0.2s ease;
}

.info-content .features li:hover {
  transform: scale(1.05);
  background: rgba(255,255,255,0.15);
}

.game-modes-info h3 {
  color: #fff;
  margin-bottom: 20px;
  font-size: 1.5em;
  text-shadow: var(--text-glow);
  text-align: center;
}

.info-content .mode-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

.info-content .mode-info-card {
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  /* backdrop-filter removed for performance */
  border: 1px solid rgba(255,255,255,0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  z-index: 2;
}

.info-content .mode-info-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.3);
}

.info-content .mode-info-card .mode-icon {
  font-size: 2em;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 6px gold);
  animation: none; /* Animation will be enabled when overlay is visible */
}

/* Enable pulse animation only when overlay is visible */
.overlay[style*="display: flex"] .info-content .mode-info-card .mode-icon {
  animation: pulseLogo 3s ease-in-out; /* infinite removed */
}

@keyframes pulseLogo {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

.info-content .mode-info-card h4 {
  color: #fff;
  margin: 0 0 5px 0;
  font-size: 1.1em;
  text-shadow: var(--text-glow);
}

.info-content .mode-info-card p {
  color: rgba(255,255,255,0.8);
  margin: 0;
  font-size: 0.9em;
  line-height: 1.4;
  text-shadow: var(--text-glow);
}

/* Board overlay content styling */

.board-header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
}

.board-header h1 {
  color: #fff;
  font-size: 2em;
  text-shadow: var(--text-glow);
  background: linear-gradient(to right, gold, orange);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

.board-header p {
  color: #fff;
  font-size: 1.1em;
  text-shadow: var(--text-glow);
}

.board-container {
  text-align: center;
  position: relative;
  z-index: 2;
}

.board-controls {
  text-align: center;
  margin-top: 20px;
  position: relative;
  z-index: 2;
}

.board-controls button {
  display: inline-block;
  margin: 0 10px;
  padding: 10px 20px;
  background: gold;
  color: #000;
  font-weight: bold;
  font-size: 16px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  animation: none; /* Animation will be enabled when overlay is visible */
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
}

/* Enable button pulse animation only when overlay is visible */
.overlay[style*="display: flex"] .board-controls button {
  animation: pulseBtn 2s; /* infinite removed */
}

@keyframes pulseBtn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.board-controls button:hover {
  background: orange;
  transform: scale(1.1);
  box-shadow: 0 0 12px orange;
}

/* Info button styling */
.info-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  margin-top: 20px;
  animation: none; /* Animation will be enabled when overlay is visible */
}

/* Enable info button pulse animation only when overlay is visible */
.overlay[style*="display: flex"] .info-btn {
  animation: pulseBtn 2s; /* infinite removed */
}

.info-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.info-section {
  text-align: center;
  margin-top: 20px;
}

/* Canvas styling for board */
#gameCanvas {
  border: 2px solid gold;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
  background: rgba(255,255,255,0.1);
}

/* Logout button styling */
.logout-btn {
  background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3);
  margin-top: 20px;
  animation: none; /* Animation will be enabled when overlay is visible */
}

/* Enable logout button pulse animation only when overlay is visible */
.overlay[style*="display: flex"] .logout-btn {
  animation: pulseBtn 2s; /* infinite removed */
}

.logout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 68, 68, 0.5);
  background: linear-gradient(135deg, #cc0000 0%, #ff4444 100%);
}

.logout-section {
  text-align: center;
  margin-top: 20px;
}

/* Hide scrollbar for webkit browsers */
.overlay-content::-webkit-scrollbar {
  width: 0px;
  display: none;
}

.overlay-content::-webkit-scrollbar-track {
  display: none;
}

.overlay-content::-webkit-scrollbar-thumb {
  display: none;
}

.overlay-content::-webkit-scrollbar-thumb:hover {
  display: none;
}

/* Hide scrollbar for Firefox - moved to unified styles above */

/* Pass N Play overlay specific styles */
#pass-n-play-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background: rgba(0,0,0,0.8);
}

/* Pass N Play overlay content styling */

.pass-n-play-content {
  position: relative;
  z-index: 2;
}

.pass-n-play-content h2 {
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
  font-size: 2em;
  text-shadow: var(--text-glow);
  background: linear-gradient(to right, gold, orange);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pass-n-play-content p {
  color: #fff;
  text-align: center;
  margin-bottom: 30px;
  font-size: 1.1em;
  line-height: 1.6;
  text-shadow: var(--text-glow);
}

.game-setup {
  margin-bottom: 30px;
}

.game-setup h3 {
  color: #fff;
  margin-bottom: 15px;
  font-size: 1.5em;
  text-shadow: var(--text-glow);
  text-align: center;
}

.setup-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

.setup-option {
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 15px;
  /* backdrop-filter removed for performance */
  border: 1px solid rgba(255,255,255,0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.setup-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.3);
}

.setup-option label {
  color: #fff;
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  text-shadow: var(--text-glow);
}

.setup-option select {
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.9);
  border: 2px solid gold;
  border-radius: 8px;
  font-size: 16px;
  color: #333;
  cursor: pointer;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.setup-option select:focus {
  outline: none;
  border-color: orange;
  box-shadow: 0 0 10px rgba(255, 165, 0, 0.5);
}

.reward-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  padding: 15px;
  background: rgba(255,215,0,0.1);
  border-radius: 12px;
  border: 2px solid gold;
  /* backdrop-filter removed for performance */
}

.reward-display img {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 0 6px gold);
}

.reward-display span {
  color: gold;
  font-size: 1.5em;
  font-weight: bold;
  text-shadow: var(--text-glow);
}

.double-text {
  color: #fff;
  text-align: center;
  margin: 15px 0;
  font-size: 1em;
  text-shadow: var(--text-glow);
  font-style: italic;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.button-group .btn {
  padding: 12px 24px;
  border: none;
  border-radius: 30px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-secondary {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.3);
  /* backdrop-filter removed for performance */
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255,255,255,0.2);
}

.btn-primary {
  background: linear-gradient(45deg, gold, orange);
  color: #000;
  border: 2px solid gold;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.btn-primary:hover {
  background: linear-gradient(45deg, orange, gold);
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.7);
}

/* Return Bonus Overlay Styles */
.return-bonus-content {
  text-align: center;
  color: #fff;
  padding: 20px;
}

.return-bonus-content h2 {
  color: #ffd700;
  font-size: 28px;
  margin-bottom: 15px;
  text-shadow: var(--text-glow);
  font-weight: bold;
}

.return-bonus-content p {
  font-size: 16px;
  margin-bottom: 20px;
  line-height: 1.5;
  text-shadow: var(--text-glow);
}

.return-bonus-content .reward-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin: 25px 0;
  padding: 20px;
  background: rgba(255,215,0,0.15);
  border-radius: 15px;
  border: 3px solid gold;
  /* backdrop-filter removed for performance */
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.return-bonus-content .reward-display img {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 0 8px gold);
  animation: coinGlow 2s ease-in-out alternate; /* infinite removed */
}

@keyframes coinGlow {
  0% { filter: drop-shadow(0 0 8px gold); }
  100% { filter: drop-shadow(0 0 15px gold); }
}

.return-bonus-content .reward-display span {
  color: gold;
  font-size: 2em;
  font-weight: bold;
  text-shadow: var(--text-glow);
  animation: numberPulse 1.5s ease-in-out; /* infinite removed */
}

@keyframes numberPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.return-bonus-content .double-text {
  color: #fff;
  text-align: center;
  margin: 20px 0;
  font-size: 14px;
  text-shadow: var(--text-glow);
  font-style: italic;
  opacity: 0.9;
}

.return-bonus-content .button-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 25px;
}

.return-bonus-content .button-group .btn {
  padding: 15px 30px;
  border: none;
  border-radius: 35px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.return-bonus-content .btn-secondary {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.4);
  /* backdrop-filter removed for performance */
}

.return-bonus-content .btn-secondary:hover {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.6);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255,255,255,0.3);
}

.return-bonus-content .btn-primary {
  background: linear-gradient(45deg, gold, orange);
  color: #000;
  border: 2px solid gold;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
  animation: primaryButtonGlow 2s ease-in-out alternate; /* infinite removed */
}

@keyframes primaryButtonGlow {
  0% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); }
  100% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.8); }
}

.return-bonus-content .btn-primary:hover {
  background: linear-gradient(45deg, orange, gold);
  transform: translateY(-3px);
  box-shadow: 0 0 35px rgba(255, 215, 0, 0.9);
}

.return-bonus-content .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Welcome back animation */
.return-bonus-content h2 {
  animation: welcomeBack 1s ease-out;
}

@keyframes welcomeBack {
  0% { 
    opacity: 0; 
    transform: translateY(-20px) scale(0.8); 
  }
  100% { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}
