/* AI4Sport Phase B — shared application shell and visual hierarchy. */

.app-page {
  background:
    radial-gradient(circle at 80% -4%, rgba(50, 128, 255, 0.15), transparent 31rem),
    radial-gradient(circle at 12% 105%, rgba(9, 185, 214, 0.08), transparent 28rem),
    linear-gradient(145deg, #f7faff 0%, #f1f5fb 48%, #f8fbff 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-page::before {
  background-image:
    linear-gradient(rgba(87, 135, 207, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(87, 135, 207, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  content: "";
  inset: 0;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 80%);
  pointer-events: none;
  position: fixed;
  z-index: 0;
}

.app-shell {
  isolation: isolate;
  position: relative;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 253, 255, 0.88)),
    radial-gradient(circle at 0 0, rgba(36, 99, 233, 0.08), transparent 17rem);
  border-right: 1px solid rgba(211, 224, 241, 0.88);
  box-shadow: 14px 0 42px rgba(40, 73, 123, 0.055);
  padding: 26px 16px 22px;
  width: 268px;
}

.sidebar::before {
  background: linear-gradient(180deg, rgba(36, 99, 233, 0.7), rgba(6, 182, 212, 0.08), transparent);
  content: "";
  height: 180px;
  left: 0;
  opacity: 0.72;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 2px;
}

.sidebar::after {
  background: radial-gradient(circle, rgba(36, 99, 233, 0.11), transparent 67%);
  content: "";
  filter: blur(12px);
  height: 210px;
  pointer-events: none;
  position: absolute;
  right: -110px;
  top: -95px;
  width: 210px;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar-brand {
  font-size: 20px;
  gap: 12px;
  padding: 0 10px 34px;
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.sidebar-brand .brand-mark {
  border-radius: 12px;
  height: 36px;
  width: 36px;
}

.sidebar-label,
.nav-group-label {
  color: #91a0b7;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.sidebar-label {
  padding: 0 11px 9px;
}

.team-select-wrap,
.platform-switcher {
  box-shadow: 0 8px 20px rgba(63, 99, 148, 0.045);
  margin-left: 0;
  margin-right: 0;
}

.team-select-wrap {
  background: rgba(248, 251, 255, 0.92);
  border-color: #dce7f5;
  border-radius: 15px;
  margin-bottom: 28px;
  min-height: 54px;
  padding: 9px 11px;
}

.team-avatar {
  border-radius: 10px;
  height: 32px;
  width: 32px;
  display: none;
}

.platform-switcher {
  border-radius: 16px;
  margin-bottom: 28px;
  min-height: 56px;
}

.main-nav {
  gap: 5px;
}

.nav-group {
  gap: 5px;
}

.nav-group + .nav-group {
  margin-top: 25px;
}

.nav-group-label {
  padding: 0 11px 8px;
}

.nav-item {
  border-radius: 13px;
  color: #7b8aa0;
  font-size: 14px;
  font-weight: 700;
  gap: 12px;
  min-height: 45px;
  padding: 0 12px;
  transition: background 180ms ease, box-shadow 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-item:hover {
  background: rgba(231, 240, 255, 0.76);
  color: var(--color-primary);
  transform: translateX(2px);
}

.nav-item.is-active {
  background: linear-gradient(100deg, rgba(226, 237, 255, 0.98), rgba(239, 247, 255, 0.76));
  box-shadow: 0 8px 18px rgba(52, 101, 181, 0.08), inset 0 0 0 1px rgba(36, 99, 233, 0.055);
  color: #1854c9;
}

.nav-item.is-active::before {
  box-shadow: 0 0 12px rgba(36, 99, 233, 0.42);
  height: 22px;
}

.nav-icon {
  color: currentColor;
  flex: 0 0 20px;
}

.nav-icon .ui-icon {
  height: 19px;
  width: 19px;
}

.nav-badge {
  background: #e7edf7;
  color: #73849d;
  font-size: 10px;
  font-weight: 850;
  min-width: 22px;
  padding: 3px 7px;
}

.nav-item.is-active .nav-badge {
  background: rgba(36, 99, 233, 0.13);
  color: var(--color-primary);
}

.sidebar-bottom {
  gap: 12px;
}

.privacy-note {
  background: linear-gradient(135deg, rgba(247, 251, 255, 0.96), rgba(240, 247, 255, 0.86));
  border-color: #dce9fa;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(46, 93, 151, 0.04);
  padding: 11px 12px;
}

.privacy-note strong {
  color: #344c6c;
  font-size: 12px;
}

.privacy-note small {
  font-size: 10px;
}

.main-content {
  margin-left: 268px;
  max-width: none;
  padding: 23px clamp(26px, 4.2vw, 76px) 78px;
  width: calc(100% - 268px);
}

.topbar {
  backdrop-filter: blur(14px);
  margin-bottom: 28px;
  padding: 8px 0 17px;
  position: sticky;
  top: 0;
  z-index: 4;
}

.topbar::before {
  background: linear-gradient(180deg, rgba(246, 249, 253, 0.98) 55%, rgba(246, 249, 253, 0));
  content: "";
  inset: -23px -3vw -1px;
  pointer-events: none;
  position: absolute;
  z-index: -1;
}

.topbar > * {
  position: relative;
}

.topbar-kicker {
  color: #8d9bb0;
  font-size: 10px;
  letter-spacing: 0.18em;
  margin-bottom: 8px;
}

.topbar h1 {
  font-size: clamp(27px, 2.1vw, 34px);
  letter-spacing: -0.05em;
}

.topbar-actions {
  gap: 12px;
}

.icon-button {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid #dce6f3;
  box-shadow: 0 7px 18px rgba(57, 90, 135, 0.05);
  height: 40px;
  width: 40px;
}

.icon-button:hover {
  background: #edf4ff;
  border-color: #cfe0ff;
  box-shadow: 0 9px 22px rgba(36, 99, 233, 0.1);
}

.notification-dot {
  border-color: #f4f7fb;
  right: 0;
  top: -1px;
}

.user-menu {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #dce6f3;
  border-radius: 15px;
  box-shadow: 0 7px 18px rgba(57, 90, 135, 0.045);
  gap: 10px;
  min-height: 48px;
  padding: 5px 9px 5px 6px;
}

.user-avatar {
  border-radius: 12px;
  height: 36px;
  width: 36px;
}

.user-menu strong {
  color: #273d5d;
  font-size: 13px;
}

.user-menu small {
  font-size: 11px;
}

.user-chevron {
  font-size: 14px;
  margin-left: 2px;
}

.mobile-nav-toggle {
  display: none;
}

.topbar-status-icon {
  color: #8a9aaf;
  cursor: default;
  display: flex;
  justify-content: center;
  align-items: center;
}

#admin-view.is-subpage > .admin-hero,
#admin-view.is-subpage > .admin-metric-grid {
  display: none;
}

#admin-view.is-subpage .admin-pages {
  margin-top: 0;
}

.view-panel:not(.hidden) {
  animation: shellViewEnter 360ms cubic-bezier(0.2, 0.76, 0.25, 1) both;
}

.hero-panel,
.player-hero,
.admin-hero {
  border-radius: 27px;
  box-shadow: 0 22px 56px rgba(45, 92, 156, 0.09), 0 2px 4px rgba(44, 83, 137, 0.035);
}

.hero-panel {
  min-height: 278px;
}

.metric-grid {
  gap: 14px;
  margin: 20px 0;
}

.metric-card {
  border-radius: 19px;
  min-height: 146px;
  overflow: hidden;
  padding: 21px 21px 19px;
  position: relative;
}

.metric-card::before {
  background: linear-gradient(90deg, rgba(36, 99, 233, 0.42), transparent);
  content: "";
  height: 2px;
  left: 21px;
  opacity: 0.7;
  position: absolute;
  right: 42%;
  top: 0;
}

.metric-card:nth-child(2)::before {
  background: linear-gradient(90deg, rgba(8, 181, 210, 0.5), transparent);
}

.metric-card:nth-child(3)::before {
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.46), transparent);
}

.metric-card-accent::before {
  background: linear-gradient(90deg, rgba(8, 181, 210, 0.58), transparent);
}

.metric-card:hover {
  transform: translateY(-3px);
}

.metric-card > strong {
  font-size: 34px;
  margin-top: 15px;
}

.metric-meta {
  font-size: 11px;
}

.content-grid,
.player-content-grid,
.admin-content-grid {
  gap: 20px;
}

.surface-card {
  border-color: rgba(218, 228, 241, 0.92);
  border-radius: 23px;
  box-shadow: 0 14px 38px rgba(37, 75, 127, 0.065);
  padding: 25px;
}

.surface-card:hover {
  box-shadow: 0 20px 46px rgba(37, 86, 150, 0.1);
  transform: translateY(-2px);
}

.section-heading {
  margin-bottom: 21px;
}

.section-heading h3,
.card-title-row h3 {
  font-size: 19px;
}

.task-row,
.player-task-item {
  border-color: #e6edf6;
  border-radius: 15px;
  background: linear-gradient(110deg, #fff, #fbfdff);
}

.task-row:hover,
.player-task-item:hover {
  border-color: #c9dcff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.08);
  transform: translateY(-2px);
}

.button {
  letter-spacing: -0.01em;
}

.button-primary,
.button-dark {
  box-shadow: 0 10px 23px rgba(36, 99, 233, 0.22);
}

.button-dark {
  box-shadow: 0 10px 23px rgba(18, 32, 56, 0.18);
}

@keyframes shellViewEnter {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .main-content {
    padding-left: 25px;
    padding-right: 25px;
  }
}

@media (max-width: 760px) {
  .app-page {
    background-attachment: scroll;
  }

  .sidebar {
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 30px rgba(37, 75, 127, 0.1);
    height: 70px;
    padding: 12px 15px;
    width: auto;
  }

  body.mobile-nav-is-open {
    overflow: hidden;
  }

  .mobile-nav-toggle {
    align-items: center;
    background: #edf4ff;
    border: 1px solid #d3e2f7;
    border-radius: 11px;
    color: #245fc8;
    display: inline-flex;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    gap: 6px;
    margin-left: auto;
    min-height: 42px;
    padding: 0 13px;
  }

  .mobile-nav-toggle:focus-visible {
    outline: 3px solid rgba(36, 99, 233, 0.22);
    outline-offset: 2px;
  }

  .sidebar:not(.mobile-nav-open) .platform-switcher {
    display: none;
  }

  .sidebar.mobile-nav-open {
    align-items: stretch;
    bottom: 0;
    flex-direction: column;
    height: 100dvh;
    overflow-y: auto;
    padding: 12px 15px 18px;
    width: min(340px, calc(100vw - 28px));
  }

  .sidebar.mobile-nav-open .sidebar-brand {
    min-height: 46px;
    display: flex;
    
  }

  .sidebar.mobile-nav-open .mobile-nav-toggle {
    position: absolute;
    right: 15px;
    top: 12px;
  }

  .sidebar.mobile-nav-open .sidebar-label {
    display: block;
    margin-top: 12px;
  }

  .sidebar.mobile-nav-open .team-select-wrap:not(.hidden),
  .sidebar.mobile-nav-open .platform-switcher:not(.hidden),
  .sidebar.mobile-nav-open .main-nav,
  .sidebar.mobile-nav-open .sidebar-bottom {
    display: flex;
  }
  


  .sidebar.mobile-nav-open .main-nav {
    /* flex: 1 0 auto; */
    margin-top: 4px;
    overflow: visible;
  }

  .sidebar.mobile-nav-open .sidebar-bottom {
    align-items: stretch;
    flex-direction: column;
    margin-top: 18px;
    width: 100%;
  }

  .sidebar.mobile-nav-open .privacy-note {
    display: flex;
    width: 100%;
  }

  .sidebar.mobile-nav-open #logout-button {
    justify-content: flex-start;
    width: 100%;
  }

  .sidebar::before {
    background: linear-gradient(90deg, rgba(36, 99, 233, 0.72), transparent);
    height: 2px;
    width: 180px;
  }

  .sidebar::after {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 90px 16px 42px;
    width: 100%;
  }

  .topbar {
    margin-bottom: 18px;
    padding-bottom: 14px;
  }

  .topbar::before {
    inset: -10px -16px -1px;
  }

  .icon-button {
    height: 38px;
    width: 38px;
  }

  .user-menu {
    background: transparent;
    border: 0;
    box-shadow: none;
    min-height: 0;
    padding: 0;
  }

  .metric-grid {
    gap: 10px;
    margin: 14px 0;
  }

  .metric-card {
    min-height: 126px;
    padding: 17px;
  }

  .metric-card > strong {
    font-size: 29px;
    margin-top: 12px;
  }

  .surface-card {
    border-radius: 19px;
    padding: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .view-panel:not(.hidden) {
    animation: none;
  }
}
