/* ============================================
   VAPE CUP Tournament - Main Styles
   Mobile-First H5 with Brand Support
   ============================================ */

/* CSS Custom Properties - GV (Default) */
:root {
  /* Brand Colors - GV */
  --primary: #FF4D00;
  --accent: #FFD600;
  --bg: #F2EAFE;
  --bg-2: #E7DBFB;
  --surface: #FEFBFF;
  --surface-2: #F4EEFE;
  --ink: #1A0B2E;
  --text: #1A0B2E;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #FF6A2A 0%, #FF4D00 50%, #CC3D00 100%);
  --gradient-accent: linear-gradient(135deg, #FFD600 0%, #FFA500 100%);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.15);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;

  /* Z-Index */
  --z-modal: 1000;
  --z-dropdown: 900;
  --z-sticky: 800;
  --z-header: 700;
}

/* GB Brand Overrides */
body[data-brand="gb"] {
  --primary: #7C3AED;
  --accent: #2DD4E8;
  --bg: #EFE6FF;
  --bg-2: #E2D2FF;
  --surface: #FFFFFF;
  --surface-2: #F3ECFF;
  --ink: #190A33;
  --text: #190A33;

  --gradient-primary: linear-gradient(135deg, #2DD4E8 0%, #7C3AED 50%, #E020E0 100%);
  --gradient-accent: linear-gradient(135deg, #2DD4E8 0%, #7C3AED 100%);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
}

input {
  font-family: inherit;
  border: none;
  outline: none;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.text-center {
  text-align: center;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  transition: opacity var(--transition-base);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-md);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Activity Status Banner */
.activity-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: var(--space-sm) var(--space-md);
  background: var(--ink);
  color: var(--surface);
  text-align: center;
  z-index: var(--z-sticky);
  font-size: 14px;
  font-weight: 500;
}

.activity-banner.status-not-started {
  background: var(--accent);
  color: var(--ink);
}

.activity-banner.status-ended {
  background: var(--vi-red, #EF4444);
  color: white;
}

/* Page Container */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Entry Page */
.entry-page {
  padding-bottom: var(--space-2xl);
}

/* Header */
.entry-header {
  padding: var(--space-2xl) var(--space-md) var(--space-lg);
  text-align: center;
}

.tournament-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.logo-icon {
  font-size: 40px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.entry-header h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.tournament-subtitle {
  font-size: 16px;
  color: var(--text);
  opacity: 0.8;
  font-weight: 500;
}

/* Hero Section */
.hero-section {
  padding: var(--space-lg) var(--space-md);
}

.hero-content {
  text-align: center;
}

.hero-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

.hero-description {
  font-size: 14px;
  color: var(--text);
  opacity: 0.8;
  line-height: 1.6;
  margin-bottom: var(--space-lg);
}

/* Tournament Preview */
.tournament-preview {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  max-width: 300px;
  margin: 0 auto;
}

.preview-bracket {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.preview-match {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.vs-badge {
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
}

.preview-arrow {
  font-size: 20px;
  color: var(--primary);
}

.preview-winner {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Section Titles */
.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin-bottom: var(--space-lg);
}

/* Brand Selection */
.brand-selection {
  padding: var(--space-lg) var(--space-md);
}

.brand-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 400px;
  margin: 0 auto;
}

.brand-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  cursor: pointer;
  border: 2px solid transparent;
}

.brand-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.brand-card:active {
  transform: translateY(0);
}

.brand-card-inner {
  flex: 1;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: white;
  margin-bottom: var(--space-sm);
}

.gv-logo {
  background: var(--gradient-primary);
}

.gb-logo {
  background: linear-gradient(135deg, #2DD4E8, #7C3AED);
}

.brand-card h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-xs);
}

.brand-card p {
  font-size: 12px;
  color: var(--text);
  opacity: 0.7;
}

.brand-preview {
  height: 4px;
  border-radius: var(--radius-full);
  margin-top: var(--space-sm);
}

.brand-card-arrow {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-left: var(--space-md);
}

/* How to Play Section */
.how-to-play {
  padding: var(--space-lg) var(--space-md);
}

.steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 400px;
  margin: 0 auto;
}

.step {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.step p {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* Footer */
.entry-footer {
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  margin-top: auto;
}

.footer-text {
  font-size: 12px;
  color: var(--text);
  opacity: 0.6;
}

/* Modal System */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end; /* Bottom sheet on mobile */
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-xl) var(--space-lg);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp var(--transition-base) ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
}

/* Login Modal */
.login-content {
  text-align: center;
}

.login-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

.login-header p {
  font-size: 14px;
  color: var(--text);
  opacity: 0.8;
}

.login-methods {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}

.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 16px;
  transition: all var(--transition-fast);
  width: 100%;
  border: 2px solid var(--bg-2);
}

.btn-login:active {
  transform: scale(0.98);
}

.btn-google {
  background: white;
  color: var(--ink);
  border-color: var(--bg-2);
}

.btn-email {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--primary);
}

/* Email Form */
.email-form {
  margin-top: var(--space-lg);
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-sm);
  text-align: left;
}

.form-group input {
  width: 100%;
  padding: var(--space-md);
  border: 2px solid var(--bg-2);
  border-radius: var(--radius-md);
  font-size: 16px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--transition-fast);
}

.form-group input:focus {
  border-color: var(--primary);
}

.code-input-container {
  margin-top: var(--space-lg);
}

.resend-link {
  font-size: 14px;
  color: var(--text);
  margin-top: var(--space-md);
}

.resend-link a {
  color: var(--primary);
  font-weight: 600;
}

/* Primary Button */
.btn-primary {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.btn-primary:active {
  transform: scale(0.98);
  opacity: 0.9;
}

/* Share Modal */
.share-content {
  text-align: center;
}

.share-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

.share-header p {
  font-size: 14px;
  color: var(--text);
  opacity: 0.8;
}

.share-bonus-info {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-lg) 0;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.bonus-icon {
  font-size: 24px;
}

.bonus-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.bonus-cap {
  font-size: 12px;
  color: var(--text);
  opacity: 0.7;
  margin-top: var(--space-xs);
}

.share-platforms {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin: var(--space-xl) 0;
}

.share-platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 2px solid var(--bg-2);
  transition: all var(--transition-fast);
  width: 80px;
}

.share-platform-btn:active {
  transform: scale(0.95);
  border-color: var(--primary);
}

.share-platform-btn span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.share-link {
  margin-top: var(--space-xl);
}

.share-link-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

.share-link-row {
  display: flex;
  gap: var(--space-sm);
}

.share-link-row input {
  flex: 1;
  padding: var(--space-md);
  border: 2px solid var(--bg-2);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

.btn-copy {
  padding: var(--space-md) var(--space-lg);
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  transition: opacity var(--transition-fast);
}

.btn-copy:active {
  opacity: 0.8;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  z-index: calc(var(--z-modal) + 100);
  animation: toastSlideUp var(--transition-base) ease;
  max-width: 90%;
  text-align: center;
}

@keyframes toastSlideUp {
  from {
    transform: translate(-50%, 100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.toast-success {
  background: var(--vi-green, #22C55E);
  color: white;
}

.toast-error {
  background: var(--danger, #E03131);
  color: white;
}

/* Responsive Design */
@media (min-width: 768px) {
  /* Tablet and desktop styles */
  .brand-cards {
    flex-direction: row;
    max-width: 600px;
  }

  .brand-card {
    flex: 1;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    gap: var(--space-md);
  }

  .brand-card-arrow {
    transform: rotate(90deg);
    margin-left: 0;
  }

  .modal {
    align-items: center;
  }

  .modal-content {
    border-radius: var(--radius-xl);
  }

  .share-platforms {
    gap: var(--space-lg);
  }

  .share-platform-btn {
    width: 100px;
  }
}

@media (min-width: 1024px) {
  /* Desktop specific styles */
  .entry-header {
    padding: var(--space-2xl) var(--space-lg);
  }

  .hero-section {
    padding: var(--space-lg) var(--space-2xl);
  }

  .brand-selection {
    padding: var(--space-lg) var(--space-2xl);
  }

  .brand-cards {
    max-width: 800px;
  }
}