/* =========================================================
   TRYTRACK LAYOUT.CSS
========================================================= */

.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.main-content {
  flex: 1;
  min-width: 0;
  max-width: none;
  /* sidebar is 300px, floated 20px from edge with 20px gap = 340px offset */
  margin-left: calc(var(--sidebar-width) + var(--sidebar-gap) + var(--sidebar-gap));
  padding: var(--page-pad);
  padding-bottom: calc(var(--page-pad) + 8px);
  position: relative;
  z-index: 1;
}

.main-content::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 18%, rgba(56,189,248,0.05), transparent 20%),
    radial-gradient(circle at 82% 8%, rgba(14,165,233,0.07), transparent 22%),
    radial-gradient(circle at 50% 85%, rgba(34,197,94,0.04), transparent 24%);
}

/* =========================================================
   ELITE SIDEBAR
========================================================= */

.elite-sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: var(--sidebar-gap);
  left: var(--sidebar-gap);
  bottom: var(--sidebar-gap);

  display: flex;
  flex-direction: column;

  border-radius: 28px;
  background: linear-gradient(180deg, rgba(8,15,32,0.96), rgba(3,8,20,0.97));
  border: 1px solid rgba(56,189,248,0.09);

  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);

  box-shadow:
    0 28px 70px rgba(0,0,0,0.42),
    inset 0 1px 0 rgba(255,255,255,0.035);

  overflow: hidden;
  z-index: 1000;
}

.sidebar-top {
  padding: 30px 22px 18px;
}

.sidebar-brand {
  display: flex;
  justify-content: center;
  align-items: center;
}

.sidebar-logo-image {
  width: 176px;
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(0 0 14px rgba(14,165,233,0.26))
    drop-shadow(0 0 26px rgba(14,165,233,0.10));
}

.sidebar-brand-text {
  display: none;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 20px;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-section-title {
  padding: 0 12px;
  margin-bottom: 10px;
  color: rgba(148,163,184,0.6);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  position: relative;
  min-height: 50px;

  display: flex;
  align-items: center;
  gap: 12px;

  padding: 0 14px;
  border-radius: 16px;

  color: rgba(226,232,240,0.76);
  text-decoration: none;
}

.sidebar-link:hover {
  background: rgba(56,189,248,0.07);
  color: #ffffff;
  transform: translateX(3px);
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(37,99,235,0.20), rgba(56,189,248,0.10));
  border: 1px solid rgba(56,189,248,0.13);
  color: #ffffff;
  box-shadow: 0 10px 26px rgba(37,99,235,0.16);
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: #38bdf8;
  box-shadow: 0 0 14px rgba(56,189,248,0.8);
}

.sidebar-icon {
  width: 28px;
  height: 28px;

  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  border-radius: 10px;
  background: rgba(255,255,255,0.04);

  font-size: 13px;
  font-weight: 800;
}

.sidebar-link.active .sidebar-icon {
  background: linear-gradient(135deg, rgba(37,99,235,0.32), rgba(56,189,248,0.18));
  box-shadow: 0 0 18px rgba(56,189,248,0.16);
}

.sidebar-label {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 12px;

  margin-bottom: 14px;
  padding: 12px;

  border-radius: 18px;
  background: rgba(255,255,255,0.025);
}

.sidebar-user-avatar {
  width: 42px;
  height: 42px;

  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;

  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);

  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.sidebar-user-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-user-info strong {
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.sidebar-user-info small {
  font-size: 11px;
  font-weight: 600;
}

.sidebar-connection {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #4ade80;
}

.sidebar-conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #64748b;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.sidebar-conn-online {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  animation: sidebar-pulse 2.4s ease-in-out infinite;
}

.sidebar-conn-offline {
  background: #64748b;
  box-shadow: none;
  animation: none;
}

.sidebar-connection:has(.sidebar-conn-online) {
  color: #4ade80;
}

.sidebar-connection:has(.sidebar-conn-offline) {
  color: #64748b;
}

@keyframes sidebar-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(34, 197, 94, 0.5); }
  50%       { box-shadow: 0 0 10px rgba(34, 197, 94, 0.9); }
}

.sidebar-notification-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;

  font-size: 10px;
  font-weight: 800;

  box-shadow: 0 0 12px rgba(239,68,68,0.5);
}

.sidebar-notification-badge.hidden {
  display: none;
}

.sidebar-logout-btn {
  width: 100%;
}

/* =========================================================
   PAGE HEADER
========================================================= */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;

  margin-bottom: 28px;
  padding: 30px 32px;

  border-radius: var(--radius-xl);
  border: 1px solid var(--border);

  background:
    linear-gradient(135deg, rgba(15,23,42,0.80), rgba(2,6,23,0.60)),
    radial-gradient(circle at top right, rgba(56,189,248,0.16), transparent 32%);

  box-shadow: var(--shadow-lg);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.page-header-content,
.page-header > div:first-child {
  min-width: 0;
}

.page-header h1 {
  margin: 8px 0 6px;
}

.page-header p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* =========================================================
   SECTION LAYOUTS
========================================================= */

.section-header,
.filter-toolbar,
.notification-filter-toolbar,
.notification-center-header,
.match-score-header,
.player-card-header,
.report-row-main,
.notification-header,
.preview-top,
.player-of-match-rating {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-toolbar,
.section-header {
  margin-bottom: 20px;
}

.section-header h2,
.filter-toolbar h2 {
  margin-bottom: 0;
}

.team-filter-select,
.filter-toolbar select {
  min-width: 210px;
}

/* =========================================================
   COMMON PAGE REGIONS
========================================================= */

.page-section {
  margin-bottom: 24px;
}

.page-section:last-child {
  margin-bottom: 0;
}

.two-column-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 22px;
}

.three-column-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

/* =========================================================
   MOBILE SIDEBAR
========================================================= */

.mobile-menu-btn,
.sidebar-overlay {
  display: none;
}

.mobile-menu-btn {
  border: none;
}

@media (max-width: 980px) {
  .mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;

    position: fixed !important;
    top: 18px !important;
    left: 18px !important;
    z-index: 100000 !important;

    width: 50px;
    height: 50px;

    border-radius: 14px;
    background: var(--gradient-primary);
    color: #ffffff;

    font-size: 22px;
    font-weight: 800;

    box-shadow: 0 12px 28px rgba(0,0,0,0.34);
  }

  .elite-sidebar {
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;

    width: 290px !important;
    min-width: 290px !important;
    height: 100vh !important;

    border-radius: 0 24px 24px 0;
    transform: translateX(-100%);
    transition: transform var(--ease-slow);

    z-index: var(--z-menu) !important;
  }

  .elite-sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;

    position: fixed;
    inset: 0;
    z-index: var(--z-overlay);

    background: rgba(0,0,0,0.52);

    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);

    opacity: 0;
    visibility: hidden;

    transition:
      opacity var(--ease),
      visibility var(--ease);
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .main-content {
    margin-left: 0;
    padding: 86px 18px 24px !important;
  }
}

/* =========================================================
   RESPONSIVE LAYOUT
========================================================= */

@media (max-width: 1200px) {
  .two-column-layout,
  .split-layout,
  .dashboard-analytics-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .three-column-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .notification-center-header,
  .filter-toolbar,
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .notification-filter-toolbar select,
  .notification-center-header .btn-secondary,
  .team-filter-select,
  .filter-toolbar select,
  .page-actions > * {
    width: 100%;
  }
}

@media (max-width: 580px) {
  .page-header {
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
  }
}
