/* ========================================
   HKJC Football Tracker - Custom Theme
   ======================================== */

/* Lumo Dark variable overrides */
:host {
  --lumo-body-text-color: #c9d1d9;
  --lumo-secondary-text-color: #8b949e;
  --lumo-tertiary-text-color: #6e7681;
  --lumo-error-text-color: #f85149;
  --lumo-success-text-color: #3fb950;
  --lumo-primary-text-color: #58a6ff;
  --lumo-border-color: #30363d;
  --lumo-shade: rgba(0, 0, 0, 0.5);
  --lumo-shade-20pct: rgba(255, 255, 255, 0.2);
  --lumo-primary-color-10pct: rgba(88, 166, 255, 0.1);
  --lumo-success-color-10pct: rgba(63, 185, 80, 0.1);
  --lumo-error-color-10pct: rgba(248, 81, 73, 0.1);
  --lumo-warning-color-10pct: rgba(210, 153, 34, 0.1);

  /* Custom theme variables */
  --app-bg: #0d1117;
  --app-surface: #161b22;
  --app-surface-hover: #1c2333;
  --app-border: #30363d;
  --app-text: #c9d1d9;
  --app-text-muted: #8b949e;
  --app-accent: #58a6ff;
  --app-success: #3fb950;
  --app-success-bg: rgba(63, 185, 80, 0.15);
  --app-danger: #f85149;
  --app-danger-bg: rgba(248, 81, 73, 0.15);
  --app-warning: #d29922;
  --app-warning-bg: rgba(210, 153, 34, 0.15);
  --app-info: #58a6ff;
  --app-info-bg: rgba(88, 166, 255, 0.15);
  --app-radius: 12px;
  --app-radius-sm: 8px;
}

/* ===== APP HEADER / NAV BAR ===== */
.app-header {
  background: linear-gradient(135deg, #1a1f2e 0%, #0d1117 100%) !important;
  border-bottom: 1px solid var(--app-border);
  padding: 0 24px !important;
  gap: 24px !important;
}

.app-header h3 {
  font-size: 20px !important;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.app-header [slot="prefix"] {
  margin-right: 4px !important;
  opacity: 0.7;
  font-size: 16px;
}

.app-header [slot="prefix"] svg {
  width: 16px !important;
  height: 16px !important;
}

/* ===== NAVIGATION ===== */
.nav-bar {
  display: flex !important;
  gap: 4px !important;
  padding: 8px 24px !important;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  flex-wrap: wrap;
}

.nav-btn {
  padding: 6px 14px !important;
  border-radius: var(--app-radius-sm) !important;
  font-weight: 500 !important;
  color: var(--lumo-secondary-text-color) !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  border: 1px solid transparent !important;
  font-size: 13px !important;
  background: transparent !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

.nav-btn:hover {
  background: var(--app-surface-hover) !important;
  color: var(--app-text) !important;
  border-color: var(--app-border) !important;
  transform: translateY(-1px);
}

.nav-btn-active {
  background: rgba(88, 166, 255, 0.12) !important;
  color: var(--app-accent) !important;
  border-color: rgba(88, 166, 255, 0.3) !important;
}

.nav-btn-active [slot="prefix"] svg {
  color: var(--app-accent) !important;
}

.nav-btn [slot="prefix"] svg {
  width: 14px !important;
  height: 14px !important;
  color: var(--lumo-secondary-text-color);
  transition: color 0.2s ease;
}

.nav-btn:hover [slot="prefix"] svg {
  color: var(--app-text);
}

/* ===== STAT CARDS ===== */
.stat-card {
  background: var(--app-surface) !important;
  border: 1px solid var(--app-border) !important;
  border-radius: var(--app-radius) !important;
  padding: 20px 24px !important;
  transition: all 0.2s ease !important;
  min-width: 140px;
  flex: 1;
}

.stat-card:hover {
  border-color: var(--app-text-muted);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 12px !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--app-text-muted) !important;
  font-weight: 600 !important;
  margin-bottom: 6px !important;
}

.stat-value {
  font-size: 28px !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
}

.stat-value.positive {
  color: var(--app-success) !important;
}

.stat-value.negative {
  color: var(--app-danger) !important;
}

.stat-value.neutral {
  color: var(--app-text) !important;
}

/* ===== BADGES ===== */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  background: var(--app-success-bg) !important;
  color: var(--app-success) !important;
  border: 1px solid rgba(63, 185, 80, 0.3) !important;
}

.badge-live::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--app-success);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.badge-finished {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  background: rgba(139, 148, 158, 0.12) !important;
  color: var(--app-text-muted) !important;
  border: 1px solid rgba(139, 148, 158, 0.25) !important;
}

.badge-scheduled {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  background: var(--app-info-bg) !important;
  color: var(--app-info) !important;
  border: 1px solid rgba(88, 166, 255, 0.3) !important;
}

.badge-won {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  background: var(--app-success-bg) !important;
  color: var(--app-success) !important;
  border: 1px solid rgba(63, 185, 80, 0.3) !important;
}

.badge-lost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  background: var(--app-danger-bg) !important;
  color: var(--app-danger) !important;
  border: 1px solid rgba(248, 81, 73, 0.3) !important;
}

.badge-pending {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  background: var(--app-warning-bg) !important;
  color: var(--app-warning) !important;
  border: 1px solid rgba(210, 153, 34, 0.3) !important;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* ===== PULSE ANIMATION FOR LIVE ROWS ===== */
.row-live-pulse {
  animation: row-pulse 2s ease-in-out infinite;
}

@keyframes row-pulse {
  0%, 100% { background-color: transparent; }
  50% { background-color: rgba(63, 185, 80, 0.06); }
}

/* ===== GRID STYLING ===== */
.v-grid {
  border: 1px solid var(--app-border) !important;
  border-radius: var(--app-radius) !important;
  overflow: hidden;
}

.v-grid-header {
  background: var(--app-surface) !important;
  border-bottom: 1px solid var(--app-border) !important;
}

.v-grid-header cell {
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px !important;
  color: var(--app-text-muted) !important;
  padding: 12px 16px !important;
}

.v-grid-row:hover {
  background: var(--app-surface-hover) !important;
}

.v-grid-row:nth-child(even) {
  background: rgba(22, 27, 34, 0.5) !important;
}

.v-grid-row:nth-child(even):hover {
  background: var(--app-surface-hover) !important;
}

/* ===== WARNING BANNER ===== */
.warning-banner {
  background: var(--app-warning-bg) !important;
  border: 1px solid rgba(210, 153, 34, 0.3) !important;
  border-radius: var(--app-radius) !important;
  padding: 14px 20px !important;
  font-size: 14px !important;
  color: var(--app-warning) !important;
  line-height: 1.5 !important;
}

/* ===== SEARCH INPUT ===== */
.search-input {
  border-radius: var(--app-radius-sm) !important;
  border: 1px solid var(--app-border) !important;
  background: var(--app-surface) !important;
  color: var(--app-text) !important;
  padding: 8px 14px !important;
  font-size: 14px !important;
  transition: border-color 0.2s ease !important;
}

.search-input:focus {
  border-color: var(--app-accent) !important;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2) !important;
}

.search-input input {
  background: transparent !important;
  color: var(--app-text) !important;
}

.search-input::part(input-field) {
  background: transparent !important;
}

/* ===== FILTER BUTTON ===== */
.filter-chip {
  padding: 6px 16px !important;
  border-radius: 20px !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  border: 1px solid var(--app-border) !important;
  background: var(--app-surface) !important;
  color: var(--app-text-muted) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.filter-chip-active {
  background: rgba(88, 166, 255, 0.12) !important;
  color: var(--app-accent) !important;
  border-color: rgba(88, 166, 255, 0.3) !important;
}

.filter-chip:hover {
  border-color: var(--app-text-muted);
  color: var(--app-text);
}

/* ===== DIALOG STYLING ===== */
:host([theme~="dialog-custom"]) {
  border-radius: var(--app-radius) !important;
  overflow: hidden;
}

:host([theme~="dialog-custom"]) [part="header"] {
  background: var(--app-surface) !important;
  border-bottom: 1px solid var(--app-border) !important;
  padding: 16px 24px !important;
}

:host([theme~="dialog-custom"]) [part="content"] {
  background: var(--app-bg) !important;
  padding: 0 !important;
}

:host([theme~="dialog-custom"]) [part="overlay"] {
  background: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(4px);
}

/* ===== FORM FIELDS ===== */
.form-field {
  width: 100% !important;
}

.form-field::part(label) {
  font-weight: 600 !important;
  color: var(--app-text) !important;
}

.form-field::part(input-field) {
  background: var(--app-surface) !important;
  border-color: var(--app-border) !important;
  color: var(--app-text) !important;
}

.form-field::part(error-message) {
  color: var(--app-danger) !important;
}

/* ===== NAV BUTTONS (for H3-based nav, fallback) ===== */
.nav-btn {
  padding: 8px 18px !important;
  border-radius: var(--app-radius-sm) !important;
  font-weight: 500 !important;
  color: var(--lumo-secondary-text-color) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  border: 1px solid transparent !important;
  font-size: 14px !important;
  margin: 0 !important;
}

.nav-btn:hover {
  background: var(--app-surface-hover) !important;
  color: var(--app-text) !important;
  border-color: var(--app-border) !important;
}

.nav-btn-active {
  background: rgba(88, 166, 255, 0.12) !important;
  color: var(--app-accent) !important;
  border-color: rgba(88, 166, 255, 0.3) !important;
}

/* ===== PRIMARY BUTTON ===== */
.primary-btn {
  border-radius: var(--app-radius-sm) !important;
  transition: all 0.2s ease !important;
}

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

/* ===== FILTER BAR ===== */
.filter-bar {
  gap: 8px !important;
  margin-bottom: 12px;
}

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 16px;
}

/* ===== CONTENT AREA ===== */
.content-area {
  background: var(--app-bg);
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--app-surface);
}

::-webkit-scrollbar-thumb {
  background: var(--app-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--app-text-muted);
}

/* ===== NOTIFICATION TOAST ===== */
.v-notification {
  border-radius: var(--app-radius-sm) !important;
  background: var(--app-surface) !important;
  color: var(--app-text) !important;
  border: 1px solid var(--app-border) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
  padding: 12px 16px !important;
  font-size: 14px !important;
}

/* ===== SMOOTH SCROLLING ===== */
html {
  scroll-behavior: smooth;
}

/* ===== APP BODY ===== */
:host {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== APP ROOT ===== */
.app-root {
  background: var(--app-bg);
  min-height: 100vh;
}

.content-area {
  background: var(--app-bg);
  overflow-y: auto;
}

/* ===== BUTTON HOVER EFFECTS ===== */
.nav-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.nav-btn:hover {
  background: var(--app-surface-hover) !important;
  color: var(--app-text) !important;
  border-color: var(--app-border) !important;
  transform: translateY(-1px);
}

.stat-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.stat-card:hover {
  border-color: var(--app-text-muted);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ===== BADGE HOVER ===== */
.badge-live, .badge-finished, .badge-scheduled, .badge-won, .badge-lost, .badge-pending {
  transition: all 0.2s ease !important;
}

.badge-live:hover {
  background: rgba(63, 185, 80, 0.25) !important;
}

.badge-won:hover {
  background: rgba(63, 185, 80, 0.25) !important;
}

.badge-lost:hover {
  background: rgba(248, 81, 73, 0.25) !important;
}

.badge-pending:hover {
  background: rgba(210, 153, 34, 0.25) !important;
}


.v-notification[position="bottom-start"] {
  margin: 16px !important;
}


/* ===== SECTION TITLE ===== */
.section-title {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: var(--app-text) !important;
  margin-bottom: 16px !important;
  letter-spacing: -0.01em;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--app-text-muted) !important;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state-text {
  font-size: 16px;
  font-weight: 500;
}

.empty-state-sub {
  font-size: 14px;
  margin-top: 8px;
  opacity: 0.7;
}

/* ===== RECENT ACTIVITY ===== */
.activity-item {
  padding: 12px 16px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.2s ease;
}

.activity-item:hover {
  border-color: var(--app-text-muted);
}

/* ===== TOAST CUSTOM ===== */
.toast-custom {
  border-radius: var(--app-radius-sm) !important;
  border: 1px solid var(--app-border) !important;
  background: var(--app-surface) !important;
  color: var(--app-text) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}
