/* ============================================
   VAPE CUP Tournament - Bracket Styles
   ============================================ */

/* Tournament Header */
.tournament-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  gap: var(--space-md);
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}

.header-info {
  flex: 1;
  min-width: 0;
}

.header-info h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 12px;
  color: var(--text);
  opacity: 0.8;
}

.current-round {
  font-weight: 600;
  color: var(--primary);
}

.progress-divider {
  opacity: 0.5;
}

.header-menu {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all var(--transition-fast);
}

.header-menu:active {
  background: var(--bg-2);
}

/* Tournament Progress */
.tournament-progress {
  background: var(--bg);
  padding: var(--space-md) var(--space-lg);
}

.progress-bar {
  height: 6px;
  background: var(--bg-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow) ease;
}

.progress-text {
  font-size: 12px;
  color: var(--text);
  text-align: center;
  font-weight: 500;
}

/* Main Content */
.tournament-main {
  flex: 1;
  padding: var(--space-lg) var(--space-md);
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* Welcome Section */
.welcome-section {
  text-align: center;
  margin-bottom: var(--space-xl);
}

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

.welcome-section p {
  font-size: 14px;
  color: var(--text);
  opacity: 0.8;
  line-height: 1.5;
}

/* Bracket Section */
.bracket-section {
  position: relative;
  min-height: 400px;
}

.bracket-loading,
.bracket-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  text-align: center;
}

.bracket-empty .empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.bracket-empty h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

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

/* Bracket Container */
.bracket-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.bracket-round {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.round-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
}

.round-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.round-badge {
  background: var(--primary);
  color: white;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
}

/* Match Card */
.match-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  position: relative;
}

.match-card.completed {
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.match-card.current {
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 4px var(--bg), var(--shadow-lg);
}

.match-card:active {
  transform: scale(0.98);
}

/* Match Content */
.match-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.match-product {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
}

.match-product:not(.disabled):active {
  background: var(--bg);
  transform: scale(0.95);
}

.match-product.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.match-product.winner {
  background: var(--bg);
}

.match-product.winner::after {
  content: '👑';
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 16px;
}

.product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-xs);
}

.product-category {
  font-size: 10px;
  color: var(--text);
  opacity: 0.7;
  text-transform: uppercase;
}

/* VS Badge */
.vs-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.match-card.completed .vs-badge {
  background: var(--primary);
  color: white;
}

/* Match Details Trigger */
.match-details-trigger {
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--bg-2);
}

.details-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-sm);
}

.details-link:hover {
  opacity: 0.8;
}

/* Bracket Connector Lines */
.bracket-connector {
  display: flex;
  justify-content: center;
  padding: var(--space-md) 0;
}

.connector-line {
  width: 2px;
  height: 20px;
  background: var(--bg-2);
}

/* Floating Action Buttons */
.fab-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: var(--z-dropdown);
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
}

.fab:active {
  transform: scale(0.95);
}

.fab-restart {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--bg-2);
}

.fab-share {
  background: var(--gradient-primary);
  color: white;
}

/* Completion Screen */
.completion-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: calc(var(--z-modal) + 50);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  overflow-y: auto;
}

.completion-content {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  text-align: center;
  max-width: 400px;
  width: 100%;
  animation: scaleIn var(--transition-base) ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.celebration-icon {
  font-size: 64px;
  margin-bottom: var(--space-md);
}

.completion-content h2 {
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

.winner-text {
  font-size: 16px;
  color: var(--text);
  margin-bottom: var(--space-lg);
}

.winner-text strong {
  color: var(--primary);
}

/* Points Earned */
.points-earned {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.points-icon {
  font-size: 32px;
}

.points-info {
  flex: 1;
  text-align: left;
}

.points-label {
  font-size: 12px;
  color: var(--text);
  margin-bottom: var(--space-xs);
}

.points-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

/* Prize Section */
.prize-section {
  text-align: left;
  margin-bottom: var(--space-xl);
}

.prize-section h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-md);
}

.prize-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

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

.prize-rank {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.prize-info {
  flex: 1;
}

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

.prize-type {
  font-size: 12px;
  color: var(--text);
  opacity: 0.7;
}

/* Completion Actions */
.completion-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.btn-large {
  padding: var(--space-lg);
  font-size: 16px;
}

.btn-secondary {
  background: var(--bg);
  color: var(--ink);
  border: 2px solid var(--bg-2);
}

.btn-secondary:active {
  background: var(--bg-2);
}

/* Product Modal */
.product-content {
  max-width: 400px;
}

.product-image {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-content h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

.product-description {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.product-specs {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.spec-item {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm);
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.spec-label {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

.spec-value {
  font-size: 12px;
  color: var(--ink);
  font-weight: 600;
}

/* Menu Modal */
.menu-content {
  max-width: 300px;
}

.menu-items {
  display: flex;
  flex-direction: column;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.menu-item:hover {
  background: var(--bg);
}

.menu-item:active {
  background: var(--bg-2);
}

/* Confetti Animation */
@keyframes confetti {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: calc(var(--z-modal) + 200);
  animation: confetti 3s linear forwards;
}

/* Responsive Design */
@media (min-width: 768px) {
  .tournament-main {
    padding: var(--space-lg) var(--space-xl);
  }

  .bracket-container {
    flex-direction: row;
    align-items: flex-start;
  }

  .bracket-round {
    flex: 1;
  }

  .match-content {
    flex-direction: column;
  }

  .vs-badge {
    transform: rotate(90deg);
    margin: var(--space-sm) 0;
  }

  .fab-container {
    bottom: var(--space-xl);
    right: var(--space-xl);
  }
}

@media (min-width: 1024px) {
  .tournament-main {
    max-width: 900px;
  }

  .bracket-container {
    gap: var(--space-xl);
  }

  .completion-content {
    max-width: 500px;
  }
}

/* Product Option */
.product-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: var(--bg);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.product-option:hover:not(.winner) {
  border-color: var(--primary);
  background: var(--bg-2);
}

.product-option:active:not(.winner) {
  transform: scale(0.98);
}

.product-option.winner {
  background: var(--bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}

.product-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.product-desc {
  font-size: 12px;
  color: var(--text);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-action {
  flex-shrink: 0;
  margin-left: var(--space-sm);
}

.select-indicator {
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg-2);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.product-option:hover:not(.winner) .select-indicator {
  border-color: var(--primary);
  background: var(--primary);
}

.winner-badge {
  font-size: 16px;
}

/* VS Divider */
.vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  flex-shrink: 0;
}

/* Match Pending State */
.match-pending {
  opacity: 0.6;
  pointer-events: none;
}

.match-pending-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  color: var(--text);
  opacity: 0.7;
}

.match-pending-message span {
  font-size: 24px;
  margin-bottom: var(--space-sm);
}

/* Round Divider */
.round-divider {
  flex: 1;
  height: 1px;
  background: var(--bg-2);
  margin-left: var(--space-md);
}