/* =============================================================================
   DASHBOARD PAGE STYLES - ParlayBuilder
   ============================================================================= */

/* Import parlay-specific styles (cards, legs, results, scoreboards, etc.) */
@import url('dashboard-parlays.css');

/* =============================================================================
   DASHBOARD ROOT & LAYOUT
   ============================================================================= */

/* Dashboard root container - hidden by default */
#dashboard-root {
  display: none;
  min-height: 100vh;
  background: var(--bg-base, #0a1628);
}

#dashboard-root:empty {
  display: none;
}

/* When dashboard is active, hide everything else and show dashboard */
body.dashboard-active #dashboard-root {
  display: block !important;
}

body.dashboard-active .navbar,
body.dashboard-active #cover-page,
body.dashboard-active .workbench-layout,
body.dashboard-active .sidebar,
body.dashboard-active #main-app-wrapper {
  display: none !important;
}

/* Show landing-nav on dashboard - fixed at top */
body.dashboard-active .landing-nav {
  display: block !important;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
}

/* Keep bottom nav visible on dashboard */
body.dashboard-active .pb-bottom-nav {
  display: flex !important;
}

body.dashboard-active {
  padding-bottom: calc(var(--pb-bottom-nav-height, 64px) + max(env(safe-area-inset-bottom), 12px));
}

.dashboard-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px;
  padding-top: calc(70px + env(safe-area-inset-top, 0px) + 32px);
  padding-bottom: 100px;
}

/* =============================================================================
   LOADING, EMPTY, AND NOT LOGGED IN STATES
   ============================================================================= */

.dashboard-loading,
.dashboard-empty,
.dashboard-not-logged-in {
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-60, #b4d7c4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.dashboard-empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--ink-40, #7a9f8c);
  margin-bottom: 8px;
}

.dashboard-empty h2,
.dashboard-not-logged-in h2 {
  margin: 0;
  font-size: 22px;
  color: var(--ink-100, #ffffff);
}

.dashboard-empty p,
.dashboard-not-logged-in p {
  margin: 0;
  color: var(--ink-50, #9ab8a8);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.dashboard-page .btn {
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-page .btn-primary {
  background: var(--theme-gradient-primary, linear-gradient(135deg, #00F5D4 0%, #00D3BD 50%, #00AD84 100%));
  color: #000;
}

.dashboard-page .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 211, 189, 0.3);
}

/* =============================================================================
   OVERVIEW CARDS (Quick Stats)
   ============================================================================= */

.dashboard-overview {
  margin-bottom: 18px;
}

.overview-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.overview-card {
  position: relative;
  background: #0c1a2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px;
  padding-left: 64px;
  text-align: left;
  transition: all 0.2s ease;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.overview-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.overview-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.overview-icon.profit {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

.overview-icon.total {
  background: rgba(231, 76, 175, 0.15);
  color: #e74caf;
}

.overview-icon.legshit {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

.overview-icon.weekly {
  background: rgba(230, 126, 34, 0.15);
  color: #e67e22;
}

.overview-icon.active {
  background: rgba(241, 196, 15, 0.15);
  color: #f1c40f;
}

.overview-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink-100, #ffffff);
  line-height: 1.2;
  margin-bottom: 2px;
}

.overview-value.positive {
  color: #2ecc71;
}

.overview-value.negative {
  color: #e74c3c;
}

.overview-label {
  font-size: 11px;
  color: var(--ink-50, #9ab8a8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =============================================================================
   ANALYTICS SECTION
   ============================================================================= */

.dashboard-analytics {
  margin-bottom: 32px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.analytics-card {
  background: #0c1a2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 20px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.analytics-card-wide {
  grid-column: span 2;
}

.analytics-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-80, #e8ffe9);
  margin: 0 0 16px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.analytics-card-title i {
  color: var(--theme-accent, #00D3BD);
  font-size: 16px;
}

/* Parlay Analytics Stats */
.analytics-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.analytics-stat {
  text-align: center;
  padding: 12px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.analytics-stat-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--theme-accent, #00D3BD);
  margin-bottom: 4px;
}

.analytics-stat-label {
  display: block;
  font-size: 11px;
  color: var(--ink-50, #9ab8a8);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* No data message */
.no-data {
  text-align: center;
  padding: 24px;
  color: var(--ink-50, #9ab8a8);
  font-size: 14px;
}

/* Section title */
.section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-100, #ffffff);
  margin: 0 0 20px 0;
}

/* Parlays section wrapper */
.dashboard-parlays-section {
  margin-top: 0;
}

/* =============================================================================
   TWO-COLUMN LAYOUT (Parlays + Analytics)
   ============================================================================= */

.dashboard-main-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Large screens: side-by-side layout */
@media (min-width: 1200px) {
  .dashboard-page {
    max-width: 1200px;
  }

  .dashboard-main-content {
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
  }

  .dashboard-parlays-section {
    flex: 1;
    min-width: 0;
  }

  .dashboard-analytics {
    flex: 1;
    min-width: 0;
    position: sticky;
    top: 24px;
    margin-bottom: 0 !important;
  }

  /* Analytics grid becomes single column in sidebar */
  .dashboard-analytics .analytics-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-analytics .analytics-card-wide {
    grid-column: span 1;
  }

  /* Smaller stats in sidebar */
  .dashboard-analytics .analytics-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =============================================================================
   RESPONSIVE - Medium screens (tablets)
   ============================================================================= */

@media (min-width: 768px) and (max-width: 1199px) {
  .dashboard-page {
    max-width: 1000px;
  }

  /* Analytics stays in 2-column grid on medium screens */
  .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =============================================================================
   MOBILE DASHBOARD TABS
   ============================================================================= */

/* Hidden on desktop */
.mobile-dashboard-tabs {
  display: none;
}

/* =============================================================================
   RESPONSIVE - Small screens (mobile)
   ============================================================================= */

@media (max-width: 1000px) {

  .dashboard-page {
    padding: 12px;
    padding-top: calc(70px + env(safe-area-inset-top, 0px) + 30px);
    padding-bottom: 140px;
  }

  /* Mobile tab bar */
  .mobile-dashboard-tabs {
    display: flex;
    position: sticky;
    top: calc(70px + env(safe-area-inset-top, 0px));
    z-index: 10;
    gap: 4px;
    padding: 4px;
    background: #0c1a2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 8px;
  }

  .mobile-tab-btn {
    flex: 1;
    padding: 14px 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-50);
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
  }

  .mobile-tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  /* Pulsating red dot on Live tab when live parlays exist */
  .mobile-tab-btn.has-live::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e74c3c;
    margin-right: 5px;
    vertical-align: middle;
    position: relative;
    top: -1px;
    animation: mobile-live-pulse 1.5s ease-in-out infinite;
  }

  @keyframes mobile-live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
  }

  /* Hide overview cards on mobile (shown inside Analytics tab) */
  #dashboard-overview {
    display: none;
  }

  /* When analytics tab is active: show analytics, hide parlays section */
  body.mobile-tab-analytics .dashboard-parlays-section {
    display: none;
  }

  body.mobile-tab-analytics .dashboard-analytics {
    display: block !important;
  }

  /* When parlay tab is active: show parlays, hide analytics sidebar */
  body.mobile-tab-parlays .dashboard-analytics {
    display: none;
  }

  body.mobile-tab-parlays .dashboard-parlays-section {
    display: block;
  }

  /* Overview cards inside mobile analytics tab */
  .mobile-analytics-overview .overview-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }

  .mobile-analytics-overview .overview-card {
    padding: 14px;
    padding-left: 56px;
  }

  .mobile-analytics-overview .overview-card-active {
    display: block;
  }

  .dashboard-overview {
    margin-bottom: 20px;
  }

  /* Main content gap on mobile */
  .dashboard-main-content {
    gap: 20px;
  }

  .dashboard-analytics {
    margin-bottom: 0;
  }

  /* Overview cards responsive */
  .overview-cards {
    grid-template-columns: repeat(4, 1fr);
  }

  .overview-card {
    padding: 18px;
    padding-left: 62px;
  }

  .overview-card-active {
    display: none;
  }

  .overview-icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
    left: 14px;
  }

  .overview-value {
    font-size: 26px;
  }

  .overview-label {
    font-size: 12px;
  }

  /* Analytics grid responsive */
  .analytics-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .analytics-card {
    padding: 16px;
  }

  .analytics-card-title {
    font-size: 18px;
    margin-bottom: 20px;
  }

  .analytics-card-wide {
    grid-column: span 1;
  }

  .analytics-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .analytics-stat-value {
    font-size: 26px;
  }

  .analytics-stat-label {
    font-size: 13px;
  }
}
