/* ==========================================================================
   Plascon Lucky Draw - Modern Broadcast Styling System
   Tailored for Kansai Plascon Uganda (Paint and Win Promotions)
   ========================================================================== */

:root {
  --plascon-blue-dark: #04142f;
  --plascon-blue: #0b2f64;
  --plascon-blue-vibrant: #0056b3;
  --plascon-yellow: #ffc20e;
  --plascon-yellow-hover: #e0a800;
  --plascon-red: #e31837;
  --plascon-gold: #d4af37;
  --plascon-gold-bright: #ffd700;
  
  --surface-glass: rgba(11, 47, 100, 0.65);
  --surface-glass-border: rgba(255, 255, 255, 0.15);
  --surface-card: rgba(4, 20, 47, 0.85);
  
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --text-gold: #ffc20e;
  
  --reel-bg-top: #152238;
  --reel-bg-bot: #0a111e;
  --reel-border: rgba(255, 194, 14, 0.35);
  --reel-text: #ffffff;
  
  --shadow-gold: 0 0 25px rgba(255, 194, 14, 0.45);
  --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-reel: inset 0 8px 12px rgba(0,0,0,0.8), inset 0 -8px 12px rgba(0,0,0,0.8);

  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Courier New', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  font-family: var(--font-family);
  background: var(--plascon-blue-dark);
  color: var(--text-main);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* Background Atmosphere */
body {
  background: 
    radial-gradient(circle at 50% 15%, rgba(0, 86, 179, 0.35) 0%, transparent 60%),
    radial-gradient(circle at 10% 90%, rgba(227, 24, 55, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 85%, rgba(255, 194, 14, 0.15) 0%, transparent 40%),
    linear-gradient(180deg, #051632 0%, #030d1e 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App Shell Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Ambient Canvas Layers */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* Header & Broadcast Branding */
.broadcast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 36px;
  background: rgba(3, 13, 30, 0.6);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-glass-border);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-svg {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 2px 8px rgba(0, 86, 179, 0.6));
}

.brand-title-group h1 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffffff 0%, #ffc20e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.brand-title-group .subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--plascon-yellow);
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.9;
}

/* Header Utilities */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 194, 14, 0.15);
  color: var(--plascon-yellow);
  border: 1px solid rgba(255, 194, 14, 0.3);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge-live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #28a745;
  box-shadow: 0 0 10px #28a745;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(40, 167, 69, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--surface-glass-border);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-icon.active {
  background: rgba(255, 194, 14, 0.2);
  border-color: var(--plascon-yellow);
  color: var(--plascon-yellow);
}

/* Main Arena Stage */
.main-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  position: relative;
}

/* Campaign Banner */
.campaign-banner {
  text-align: center;
  margin-bottom: 25px;
}

.campaign-tagline {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--plascon-yellow);
  font-weight: 700;
  margin-bottom: 6px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.campaign-headline {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
}

.region-display-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  background: rgba(227, 24, 55, 0.2);
  border: 1px solid rgba(227, 24, 55, 0.4);
  color: #ff6b7e;
  padding: 4px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 1px;
}

/* 3D Mechanical Odometer Stage */
.odometer-wrapper {
  background: var(--surface-card);
  backdrop-filter: blur(20px);
  border: 2px solid var(--surface-glass-border);
  box-shadow: var(--shadow-card), 0 0 40px rgba(0, 86, 179, 0.25);
  border-radius: 24px;
  padding: 30px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  max-width: 1000px;
  width: 95%;
  margin-bottom: 30px;
  transition: all 0.3s ease;
}

.odometer-wrapper.spinning {
  border-color: rgba(255, 194, 14, 0.6);
  box-shadow: var(--shadow-card), var(--shadow-gold);
}

.odometer-wrapper.winner-celebration {
  border-color: var(--plascon-gold-bright);
  box-shadow: 0 0 60px rgba(255, 215, 0, 0.6), var(--shadow-card);
  animation: winnerGlow 1.2s infinite alternate ease-in-out;
}

@keyframes winnerGlow {
  0% { transform: scale(1); box-shadow: 0 0 30px rgba(255, 215, 0, 0.4); }
  100% { transform: scale(1.015); box-shadow: 0 0 70px rgba(255, 215, 0, 0.85); }
}

.odometer-label-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding: 0 10px;
}

/* Reels Container */
.reels-board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  perspective: 1200px;
}

.country-prefix-badge {
  background: linear-gradient(135deg, #0b2f64 0%, #04142f 100%);
  border: 2px solid rgba(255, 194, 14, 0.4);
  border-radius: 12px;
  height: 94px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--plascon-yellow);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 1px;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.15), 0 4px 10px rgba(0,0,0,0.5);
  margin-right: 6px;
}

.country-prefix-badge .flag-icon {
  font-size: 1.3rem;
  line-height: 1;
  margin-bottom: 4px;
}

/* Single Digit Reel */
.digit-slot {
  width: 64px;
  height: 94px;
  background: linear-gradient(180deg, var(--reel-bg-top) 0%, #070e1a 50%, var(--reel-bg-bot) 100%);
  border: 2px solid var(--reel-border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-reel), 0 6px 12px rgba(0, 0, 0, 0.5);
}

/* Center Magnifying Lens Overlay */
.digit-slot::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(
    180deg, 
    rgba(0, 0, 0, 0.55) 0%, 
    rgba(255, 255, 255, 0.08) 45%, 
    rgba(255, 255, 255, 0) 55%, 
    rgba(0, 0, 0, 0.65) 100%
  );
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom: 1px solid rgba(0, 0, 0, 0.8);
}

/* Reel Strip of Digits */
.digit-strip {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.12, 0.8, 0.32, 1);
  will-change: transform;
}

.digit-strip.blur-motion {
  filter: blur(2px);
}

.digit-item {
  width: 100%;
  height: 94px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  font-weight: 800;
  color: #ffffff;
  font-family: var(--font-mono);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Reel Separator */
.reel-spacer {
  width: 12px;
  height: 94px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.reel-spacer::after {
  content: '';
  width: 5px;
  height: 16px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

/* Presenter Controls HUD */
.controls-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 900px;
  margin-top: 5px;
}

/* Primary Action Buttons */
.btn-primary-draw {
  background: linear-gradient(135deg, #ffc20e 0%, #e09800 100%);
  color: #030d1e;
  border: none;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 16px 42px;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 194, 14, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.6);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary-draw:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 30px rgba(255, 194, 14, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.8);
}

.btn-primary-draw:active {
  transform: translateY(1px) scale(0.98);
}

.btn-primary-draw.btn-stop {
  background: linear-gradient(135deg, #e31837 0%, #b80c25 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(227, 24, 55, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

.btn-primary-draw.btn-stop:hover {
  box-shadow: 0 12px 30px rgba(227, 24, 55, 0.7);
}

/* Control Pills & Options Bar */
.options-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(3, 13, 30, 0.7);
  backdrop-filter: blur(12px);
  padding: 10px 20px;
  border-radius: 40px;
  border: 1px solid var(--surface-glass-border);
}

.select-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.select-control {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--surface-glass-border);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 8px;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.select-control:focus, .select-control:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--plascon-yellow);
}

.select-control option {
  background: #0b2f64;
  color: #ffffff;
}

/* Hotkey Hints Tooltip Bar */
.hotkey-bar {
  margin-top: 18px;
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.5px;
}

.hotkey-item kbd {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--plascon-yellow);
}

/* Winner Modal Overlay */
.winner-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(2, 8, 20, 0.85);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.winner-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.winner-card {
  background: linear-gradient(145deg, #0d2957 0%, #061633 100%);
  border: 3px solid var(--plascon-gold-bright);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 50px rgba(255, 215, 0, 0.4);
  border-radius: 28px;
  padding: 40px 48px;
  text-align: center;
  max-width: 580px;
  width: 90%;
  position: relative;
  transform: scale(0.85);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.winner-modal-overlay.open .winner-card {
  transform: scale(1);
}

.winner-trophy-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.2) 0%, transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.winner-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--plascon-yellow);
  margin-bottom: 8px;
}

.winner-phone-number {
  font-size: 2.8rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 2px;
  margin: 12px 0;
  font-family: var(--font-mono);
  text-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
}

.winner-meta-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.winner-meta-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
}

.winner-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--surface-glass-border);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Winner Sidebar Drawer */
.history-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: #061633;
  border-left: 1px solid var(--surface-glass-border);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 24px;
  border-bottom: 1px solid var(--surface-glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--plascon-yellow);
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.drawer-close-btn:hover {
  color: #ffffff;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.winner-list-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.winner-list-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.winner-list-item:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 194, 14, 0.3);
}

.winner-list-phone {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: #ffffff;
}

.winner-list-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.drawer-footer {
  padding: 20px;
  border-top: 1px solid var(--surface-glass-border);
}

.drawer-footer .btn-export {
  width: 100%;
  background: linear-gradient(135deg, #0056b3 0%, #0b2f64 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.drawer-footer .btn-export:hover {
  background: linear-gradient(135deg, #0069d9 0%, #0047ba 100%);
  border-color: var(--plascon-yellow);
}

/* TV Broadcast Clean Mode */
body.tv-broadcast-mode .broadcast-header,
body.tv-broadcast-mode .options-bar,
body.tv-broadcast-mode .hotkey-bar {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}

body.tv-broadcast-mode .app-container {
  justify-content: center;
}

body.tv-broadcast-mode .campaign-banner {
  margin-bottom: 40px;
}

/* Responsive Scaling */
@media (max-width: 860px) {
  .reels-board {
    gap: 4px;
  }
  .digit-slot {
    width: 48px;
    height: 72px;
  }
  .digit-item {
    height: 72px;
    font-size: 2.3rem;
  }
  .country-prefix-badge {
    height: 72px;
    padding: 0 10px;
    font-size: 0.95rem;
  }
  .campaign-headline {
    font-size: 1.8rem;
  }
}

@media (max-width: 600px) {
  .digit-slot {
    width: 32px;
    height: 52px;
  }
  .digit-item {
    height: 52px;
    font-size: 1.5rem;
  }
  .country-prefix-badge {
    height: 52px;
    padding: 0 6px;
    font-size: 0.75rem;
  }
  .reel-spacer {
    width: 6px;
  }
}
