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

:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(30, 41, 59, 0.45);
  --bg-card-hover: rgba(30, 41, 59, 0.65);
  --bg-input: rgba(15, 23, 42, 0.6);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  
  /* Modern sports gradients & neon colors */
  --primary: #3b82f6; /* Electric Blue */
  --primary-hover: #1d4ed8;
  --secondary: #10b981; /* Neon Emerald */
  --secondary-hover: #047857;
  --accent: #8b5cf6; /* Royal Violet */
  --accent-glow: rgba(139, 92, 246, 0.2);
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 60px;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* App Header styling */
header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(11, 15, 25, 0.8);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 24px;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.logo-title {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  line-height: 1;
}

.logo-subtitle {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.company-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 1px solid var(--border-color);
  padding-left: 20px;
  height: 38px;
}

.hosted-by {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.company-logo {
  height: 32px; /* Økt høyde for at logoen ikke skal bli for liten eller krasje */
  width: auto;
  object-fit: contain;
  opacity: 0.9;
  transition: all 0.2s ease;
}

.company-logo:hover {
  opacity: 1;
  transform: scale(1.02);
}

@media (max-width: 600px) {
  .logo-container {
    gap: 10px;
  }
  .company-brand {
    padding-left: 10px;
    gap: 0;
    height: 24px;
  }
  .hosted-by {
    display: none;
  }
  .company-logo {
    height: 18px;
  }
}

.user-status {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--secondary);
  color: var(--secondary);
  padding: 4px 10px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Tab Navigation */
.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  max-width: 800px;
  margin: 20px auto;
  padding: 4px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Main Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.view-section {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login View Styling */
.login-card {
  max-width: 450px;
  margin: 60px auto;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 36px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.login-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.login-card h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 1rem;
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.3);
}

/* Group Stage Grid Layout (Desktop Side-by-Side) */
.group-stage-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 30px;
  align-items: start;
}

@media (max-width: 1024px) {
  .group-stage-layout {
    grid-template-columns: 1fr;
  }
}

/* Group Selection Carousel */
.group-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 20px;
  scrollbar-width: thin;
}

.group-nav-btn {
  background: rgba(30, 41, 59, 0.3);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  min-width: 60px;
  height: 40px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.group-nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.group-nav-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Group Match Cards */
.matches-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.match-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.match-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

.match-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.match-ui {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.prediction-btn {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
  min-height: 50px;
}

.prediction-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Active predictions (green for win, violet for draw) */
.prediction-btn.selected-win {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
  border-color: var(--secondary);
  color: #fff;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
  font-weight: 700;
}

.prediction-btn.selected-draw {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.05));
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
  font-weight: 700;
}

.vs-divider {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  background: rgba(15, 23, 42, 0.5);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

/* Group Standings Table styling */
.standings-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  position: sticky;
  top: 90px;
}

.standings-card h3 {
  font-size: 1.25rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.standings-table th {
  padding: 10px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.standings-table td {
  padding: 12px 8px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-weight: 500;
  transition: all 0.2s;
}

.standings-row {
  transition: transform 0.3s ease;
}

.standings-row.qualify-top {
  color: #fff;
}

.standings-row.qualify-top td:first-child {
  border-left: 3px solid var(--secondary);
}

.standings-row.qualify-third td:first-child {
  border-left: 3px solid var(--primary);
}

.standings-table td.pos {
  font-weight: 700;
  width: 24px;
}

.standings-table td.pts {
  font-weight: 700;
  color: var(--secondary);
}

/* Action Floating Bar */
.action-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 24px;
  border-radius: 100px;
  display: flex;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 99;
  min-width: 320px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: 9999px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-pill {
  padding: 10px 24px;
  border-radius: 9999px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pill.primary {
  background: linear-gradient(135deg, var(--secondary), #059669);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-pill.primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Visuell Sluttspills-Brakett */
.bracket-layout {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-bottom: 100px;
}

.bracket-rounds-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.bracket-round-btn {
  background: rgba(30, 41, 59, 0.3);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.bracket-round-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.bracket-round-view {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.bracket-round-view.active {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.ko-match-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ko-match-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.ko-team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.ko-team-row:hover:not(.locked) {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.15);
}

.ko-team-row.selected {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.04));
  border-color: var(--primary);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.1);
}

.ko-team-row.loser {
  opacity: 0.4;
  filter: grayscale(40%);
}

.ko-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.ko-team-row.selected .ko-check {
  border-color: var(--primary);
  background: var(--primary);
}

.ko-team-row.selected .ko-check::after {
  content: "✓";
  color: white;
  font-size: 0.65rem;
  font-weight: 900;
}

/* Horizontal Connector Bracket (For Desktop, Optional Enhancement) */
@media (min-width: 1200px) {
  .bracket-tree-container {
    display: none; /* Can implement dynamic SVGs if desired, but column selector is bulletproof! */
  }
}

/* Leaderboard view styling */
.leaderboard-card {
  max-width: 800px;
  margin: 30px auto;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

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

.leaderboard-table td {
  padding: 16px;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.leaderboard-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.leaderboard-table tr.me td {
  background: rgba(139, 92, 246, 0.08);
  color: #fff;
  font-weight: 700;
}

.leaderboard-table tr.me td:first-child {
  border-left: 4px solid var(--accent);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.85rem;
}

.rank-badge.top-1 { background: #f59e0b; color: #000; }
.rank-badge.top-2 { background: #cbd5e1; color: #000; }
.rank-badge.top-3 { background: #b45309; color: #fff; }

.points-text {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--secondary);
}

/* Modal styling for viewing others' brackets */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 16, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  max-width: 900px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 16px;
  padding: 30px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  border: none;
  transition: color 0.2s;
}

.close-btn:hover {
  color: white;
}

/* Admin view style */
.admin-card {
  max-width: 800px;
  margin: 30px auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 28px;
}

.admin-match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.admin-btn {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.admin-btn.active-H {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--secondary);
}

.admin-btn.active-U {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--accent);
}

.admin-btn.active-B {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-left: 4px solid var(--primary);
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
  transform: translateX(0);
}

.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

/* Responsive Mobil Navigation Tabs */
@media (max-width: 768px) {
  .nav-tabs {
    overflow-x: auto;
    justify-content: flex-start;
    white-space: nowrap;
    padding: 6px 12px;
    -webkit-overflow-scrolling: touch;
  }
  .tab-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    flex-shrink: 0;
  }
}
