/* 
 * DebAItor - Silent Luxury Theme 
 * Palette: Charcoal (#121212), White (#FFFFFF), Klein Blue (#0033FF), Light Grey (#F5F5F5)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-dark: #121212;
  --bg-light: #FFFFFF;
  --text-dark: #121212;
  --text-light: #FFFFFF;
  --accent: #0033FF;
  --accent-hover: #0022AA;
  --surface-grey: #F5F5F5;
  --border-color: #E0E0E0;
  --success: #00CC66;
  --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-stack);
  background-color: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
p { font-size: 1rem; color: #444; }

/* Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.text-center { text-align: center; }
.hidden { display: none !important; }

/* Buttons - Matte & Minimal */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px; /* Slightly rounded, architectural */
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--text-dark);
  color: var(--text-light);
}

.btn-primary:hover {
  background-color: #000;
  transform: translateY(-1px);
}

.btn-accent {
  background-color: var(--accent);
  color: white;
}

.btn-accent:hover {
  background-color: var(--accent-hover);
}

.btn-secondary {
  background-color: var(--surface-grey);
  color: var(--text-dark);
}

.btn-secondary:hover {
  background-color: #E5E5E5;
}

/* Inputs */
input[type="text"] {
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  font-family: var(--font-stack);
  border: 2px solid var(--surface-grey);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg-light);
  color: var(--text-dark);
}

input[type="text"]:focus {
  border-color: var(--accent);
}

/* LANDING PAGE */
.landing-hero {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-light);
}

.app-title {
  font-size: 4rem;
  margin-bottom: 0.2em;
}

.app-tagline {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 3rem;
}

.action-buttons {
  display: flex;
  gap: 1rem;
}

/* HOST DASHBOARD (Grid System) */
.dashboard-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  height: 100vh;
  background-color: var(--bg-light);
}

.sidebar {
  background-color: var(--surface-grey);
  padding: 2rem;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.main-content {
  padding: 3rem;
  overflow-y: auto;
}

.room-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--text-dark);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.room-code-display {
  font-family: monospace;
  font-size: 1.5rem;
  color: var(--accent);
}

/* Leaderboard Grid */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  text-align: left;
  padding: 1rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #888;
  border-bottom: 1px solid var(--border-color);
}

.leaderboard-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.leaderboard-row {
  transition: background 0.2s;
}

.leaderboard-row:hover {
  background-color: #FAFAFA;
}

.score-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--text-dark);
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 4px;
}

/* MOBILE PARTICIPANT (Dark Mode) */
body.mobile-dark {
  background-color: var(--bg-dark);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  height: 100vh;
  justify-content: space-between;
  padding: 2rem;
}

.mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-indicator {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
}

.main-action-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.record-btn {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background-color: var(--bg-light);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2);
}

.record-btn:active {
  transform: scale(0.95);
}

.record-btn.recording {
  animation: pulse-white 1.5s infinite;
  background-color: var(--accent);
}

.record-btn svg {
  width: 40px;
  height: 40px;
  fill: var(--text-dark);
}

.record-btn.recording svg {
  fill: white;
}

.timer-display {
  font-size: 3rem;
  font-weight: 700;
  margin-top: 2rem;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.instruction-text {
  color: #888;
  margin-top: 1rem;
}

/* Animations */
@keyframes pulse-white {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
  70% { box-shadow: 0 0 0 30px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* QR Code */
#qrcode img {
  width: 100% !important;
  height: auto !important;
  border: 1px solid var(--border-color);
  padding: 1rem;
  background: white;
}

/* ============ MOBILE RESPONSIVE ============ */

/* Better scrollbar for iOS/mobile */
* {
  -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar that's visible on mobile */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
  min-height: 40px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Mobile-friendly scrollbar for dark mode */
body.mobile-dark ::-webkit-scrollbar-track {
  background: #222;
}

body.mobile-dark ::-webkit-scrollbar-thumb {
  background: #555;
}

/* Tablet & Mobile */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }
  
  .sidebar {
    position: relative;
    width: 100%;
    padding: 1rem;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .main-content {
    padding: 1.5rem;
    min-height: 50vh;
  }
  
  /* Collapsible QR code container */
  .qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  #qrcode {
    max-width: 200px;
    margin: 0 auto;
  }
  
  #qrcode img {
    max-height: 150px;
    object-fit: contain;
  }
}

/* Small phones */
@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  
  .container {
    padding: 1rem;
  }
  
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }
  
  .sidebar {
    padding: 0.75rem;
  }
  
  /* Smaller QR on phones */
  #qrcode {
    max-width: 150px;
  }
  
  #qrcode img {
    max-height: 120px;
    padding: 0.5rem;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  /* Participant view improvements */
  body.mobile-dark {
    padding: 1rem;
  }
  
  .record-btn {
    width: 100px;
    height: 100px;
  }
  
  .record-btn svg {
    width: 30px;
    height: 30px;
  }
  
  .timer-display {
    font-size: 2rem;
  }
  
  /* Landing page mobile */
  .app-title {
    font-size: 2rem;
  }
  
  .app-tagline {
    font-size: 1rem;
    padding: 0 1rem;
  }
  
  .action-buttons {
    flex-direction: column;
    width: 100%;
    padding: 0 2rem;
  }
  
  .action-buttons .btn {
    width: 100%;
  }
}

/* Safe area padding for iOS notch */
@supports (padding: max(0px)) {
  body.mobile-dark {
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}
