/* =============================
   Hugshi – Casino Table Theme
   Green felt, wood, chips
   ============================= */

:root {
  /* Core palette */
  --felt-deep: #053b2b;      /* main background */
  --felt-mid: #0a5c40;       /* cards / panels */
  --felt-light: #137a55;     /* highlights */

  --wood-dark: #3d2414;
  --wood-mid: #5b3720;
  --wood-border: #8b5a2b;

  --chip-red: #c73737;
  --chip-gold: #f7c948;
  --chip-black: #111111;
  --chip-cream: #f4e7c4;

  --text-main: #f8f7f2;
  --text-muted: #c2b79b;
  --text-soft: #c2b79b;

  --border-soft: rgba(0, 0, 0, 0.4);
  --border-strong: rgba(0, 0, 0, 0.7);

  --radius-lg: 14px;
  --radius-md: 9px;
  --radius-sm: 6px;

  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.55);
  --shadow-strong: 0 16px 32px rgba(0, 0, 0, 0.8);

  --transition-fast: 120ms ease-out;
  --transition-med: 180ms ease-out;

  /* Feed typography + spacing (base / default) */
  --feed-font-base: 18px;   /* post body, username */
  --feed-font-meta: 14px;   /* timestamps, muted labels */
  --feed-font-small: 12px;  /* tiny meta (comment timestamps, etc.) */

  --feed-gap-tight: 4px;
  --feed-gap-normal: 8px;
  --feed-gap-loose: 10px;
}

/* Responsive tuning for feed */
@media (max-width: 640px) {
  :root {
    --feed-font-base: 18px;
    --feed-font-meta: 14px;
    --feed-font-small: 12px;

    --feed-gap-tight: 3px;
    --feed-gap-normal: 6px;
    --feed-gap-loose: 8px;
  }
}

@media (min-width: 1200px) {
  :root {
    --feed-font-base: 16px;
    --feed-font-meta: 14px;
    --feed-font-small: 13px;

    --feed-gap-tight: 5px;
    --feed-gap-normal: 9px;
    --feed-gap-loose: 12px;
  }
}

/* Reset-ish */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* Old inline body, upgraded to felt table */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0;
  font-size: 16px;
  line-height: 1.4;
  background:
    radial-gradient(circle at 20% 0%, rgba(244, 231, 196, 0.08), transparent 60%),
    radial-gradient(circle at 80% 100%, rgba(199, 55, 55, 0.16), transparent 60%),
    radial-gradient(circle at 10% 60%, rgba(19, 122, 85, 0.45), transparent 65%),
    linear-gradient(135deg, #04261c, var(--felt-deep));
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  margin: 0;
  min-height: 100vh;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Subtle felt texture grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: soft-light;
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.24) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.24) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -1;
  min-height: 100vh;
}

/* Old inline header, turned into a wood rail */
header {
  background: linear-gradient(180deg, var(--wood-mid), #29150d);
  color: #fff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 4px solid #000;
  box-shadow: var(--shadow-soft);
  position: relative;
}

header::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.08), transparent 60%),
    radial-gradient(circle at 100% 0, rgba(0, 0, 0, 0.35), transparent 60%);
  opacity: 0.75;
  pointer-events: none;
}

header a {
  color: #fdf9ed;
  text-decoration: none;
  margin-left: 12px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.08em;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

header a:hover {
  color: var(--chip-gold);
  border-color: var(--chip-gold);
}

/* main layout – based on original inline main */
main {
  max-width: 1100px;
  margin: 18px auto 24px;
  padding: 0 12px 24px;
}

/* Cards – upgrade of original .card */
.card {
  background: radial-gradient(circle at top, rgba(19, 122, 85, 0.3), rgba(5, 59, 43, 0.96));
  border: 1px solid rgba(0, 0, 0, 0.75);
  border-radius: var(--radius-lg);
  padding: 14px 14px 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 10% 0, rgba(247, 201, 72, 0.16), transparent 60%),
    radial-gradient(circle at 90% 100%, rgba(199, 55, 55, 0.22), transparent 65%);
  opacity: 0.9;
  pointer-events: none;
  overflow: hidden;
}

.card-header {
  position: relative;
  z-index: 1;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--chip-cream);
}

.card-body,
.card-footer {
  position: relative;
  z-index: 1;
}

/* Buttons – upgrade of original .btn */
.btn {
  display: inline-block;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  background: radial-gradient(circle at 20% 0, #f96d6d, var(--chip-red));
  color: #fffdf3;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(0, 0, 0, 0.9);
  cursor: pointer;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  box-shadow:
    0 2px 0 #2a1111,
    0 6px 12px rgba(0, 0, 0, 0.65);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    filter var(--transition-fast);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 3px 0 #2a1111,
    0 10px 18px rgba(0, 0, 0, 0.8);
  filter: brightness(1.05);
}

.btn:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 #2a1111,
    0 4px 8px rgba(0, 0, 0, 0.7);
}

/* Alternate button: chip-gold */
.btn-gold {
  background: radial-gradient(circle at 15% 0, #fff5cf, var(--chip-gold));
  color: #3a2502;
}

/* Tables – upgrade of original table styles */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.7);
}

thead th {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 12px;
  color: var(--text-soft);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.9));
}

tbody tr:nth-child(odd) {
  background-color: rgba(5, 59, 43, 0.9);
}

tbody tr:nth-child(even) {
  background-color: rgba(10, 92, 64, 0.88);
}

tbody tr:hover {
  background-color: rgba(15, 118, 80, 0.95);
}

/* Muted text – original .muted */
.muted {
  color: var(--text-soft);
}

/* --- Community feed layout & typography --- */

#community-feed {
  margin-top: var(--feed-gap-loose);
}

#community-feed h2 {
  margin-bottom: var(--feed-gap-tight);
  margin-block-end: 0.83em;
}

.feed-muted {
  opacity: 0.75;
  font-size: var(--feed-font-meta);
}

.feed-new-post-card {
  margin-bottom: var(--feed-gap-normal);
}

.feed-new-post-textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  font-size: var(--feed-font-base);
}

.feed-new-post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--feed-gap-normal);
  font-size: var(--feed-font-meta);
  margin-top: var(--feed-gap-tight);
}

@media (max-width: 640px) {
  .feed-new-post-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .feed-new-post-footer label {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .feed-new-post-footer button {
    margin-left: auto;
  }
}

.feed-post-list {
  display: flex;
  flex-direction: column;
  gap: var(--feed-gap-loose);
}

/* Each post is a card; .card already provides background / border / radius */
/* Header bar that visually fuses with the top of the card */
.feed-post-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: -14px -14px var(--feed-gap-tight) -14px; /* overlap card padding */
  padding: 8px 14px;
  background: linear-gradient(180deg, var(--wood-mid), #29150d);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border-bottom: 1px solid rgba(0,0,0,0.55);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.5);
}

.feed-post-username {
  font-weight: 600;
  font-size: var(--feed-font-base);
}

.feed-post-time {
  font-size: var(--feed-font-meta);
}

.feed-post-body {
  font-size: var(--feed-font-base);
  line-height: 1.4;
  white-space: pre-line;
  margin: 0 0 var(--feed-gap-tight) 0;    /* tight space under body */
}

/* Thumbnail styling inside card */
.feed-post-image {
  margin-top: var(--feed-gap-tight);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px;
}

.feed-post-image img {
  display: block;
  width: 100%;
  height: auto;                 /* keep aspect ratio */
  max-width: 100%;
  max-height: 25vh;             /* never taller than half the viewport */
  object-fit: contain;          /* scale down to fit within card */
  background: rgba(0, 0, 0, 0.15);
  vertical-align: middle;
}

/* Footer: likes + comment count */
.feed-post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--feed-gap-tight);
  font-size: var(--feed-font-meta);
}

/* Comments section */
.feed-post-comments {
  margin-top: var(--feed-gap-normal);
  padding-top: var(--feed-gap-tight);
  border-top: 1px solid rgba(0, 0, 0, 0.35);
  font-size: var(--feed-font-meta);
}

.feed-comment {
  margin-bottom: var(--feed-gap-tight);
}

.feed-comment-header {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 0;  /* header sits right above text */
}

.feed-comment-username {
  font-weight: 600;
}

.feed-comment-time {
  font-size: var(--feed-font-small);
}

.feed-comment-content {
  margin-top: 1px;
  white-space: pre-line;
}

/* New comment form */
.feed-comment-form {
  margin-top: var(--feed-gap-normal);
  display: flex;
  gap: var(--feed-gap-tight);
  align-items: center;
  font-size: var(--feed-font-meta);
}

.feed-comment-input {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: var(--feed-font-meta);
}

/* Inline form – original form.inline */
form.inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Inputs to match table theme */
input,
select,
textarea {
  background: radial-gradient(circle at top, rgba(5, 59, 43, 0.95), rgba(0, 0, 0, 0.95));
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.9);
  padding: 7px 9px;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
  color: rgba(244, 231, 196, 0.55);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--chip-gold);
  box-shadow: 0 0 0 1px rgba(247, 201, 72, 0.7);
}

/* Simple chip-style badge for Yes/No or metadata */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  border: 1px solid rgba(0, 0, 0, 0.85);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.9);
}

.badge-red {
  background: radial-gradient(circle at 20% 0, #f96d6d, var(--chip-red));
  color: #fff4e9;
}

.badge-gold {
  background: radial-gradient(circle at 25% 0, #fff6d3, var(--chip-gold));
  color: #3b2505;
}

.badge-dark {
  background: radial-gradient(circle at 20% 0, #444444, #111111);
  color: #f4e7c4;
}

/* Chart container theme – for your line charts */
.chart-panel {
  background: radial-gradient(circle at 15% 0, rgba(244, 231, 196, 0.08), rgba(5, 59, 43, 0.96));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0, 0, 0, 0.85);
  padding: 10px 10px 4px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.chart-panel::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 0 0, rgba(247, 201, 72, 0.18), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(199, 55, 55, 0.2), transparent 60%);
  opacity: 0.8;
  pointer-events: none;
}

.chart-panel-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.chart-panel-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--chip-cream);
}

.chart-panel-meta {
  font-size: 11px;
  color: var(--text-soft);
}

.chart-panel-body {
  position: relative;
  z-index: 1;
}

/* Legend & swatches – to sync with Chart.js line colors */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.chart-legend-item.is-hidden {
  opacity: 0.4;
  text-decoration: line-through;
}
.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.95);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}
.chart-legend-item {
  cursor: pointer;
  transition: transform 0.15s ease;
}
.chart-legend-item:hover {
  transform: translateY(-1px);
}
.chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.9);
}
.chart-legend-label-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-name {
  white-space: nowrap;
}

.chart-legend-odds {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--chip-cream);
  opacity: 0.9;
}

.swatch-red   { background: var(--chip-red); }
.swatch-gold  { background: var(--chip-gold); }
.swatch-black { background: var(--chip-black); }
.swatch-cream { background: var(--chip-cream); }
.swatch-green { background: var(--felt-light); }

/* =========================================
   Link colors — casino table palette
   ========================================= */
a {
  color: var(--chip-cream);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast), text-shadow var(--transition-fast);
}

a:hover {
  color: var(--chip-cream);
  text-shadow:
    0 0 4px rgba(247, 201, 72, 0.6),
    0 0 10px rgba(247, 201, 72, 0.4);
}

a:active {
  color: var(--chip-red);
  text-shadow: none;
}

a:visited {
  color: var(--chip-cream);
}

/* Tooltip shell for chart hover (positioned in JS) */
.chart-tooltip {
  position: absolute;
  min-width: 120px;
  max-width: 220px;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 10px;
  border: 1px solid rgba(247, 201, 72, 0.75);
  background: radial-gradient(circle at top, rgba(247, 201, 72, 0.25), rgba(0, 0, 0, 0.95));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 1),
    0 0 16px rgba(247, 201, 72, 0.7);
  pointer-events: none;
  color: var(--text-main);
  z-index: 999;
}

/* === Base layout polish (header + flash messages) === */

/* Hugshi logo link in header */
.brand-link {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fdf9ed;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
  transition: color 0.15s ease;
}

.brand-link:visited {
  color: #fdf9ed;
}

.brand-link:hover {
  color: var(--chip-gold);
}

.toolbar {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fdf9ed;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}
/* Flash messages */
.flash {
  border-left: 6px solid transparent;
  font-size: 14px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.flash-danger {
  border-left-color: #f96d6d; /* red */
}

.flash-success {
  border-left-color: #2fa72f; /* green */
}

.flash-info,
.flash-warning,
.flash-other {
  border-left-color: #39f; /* blue */
}

/* Chart canvas hover height, legend always visible */
.chart-card {
  overflow: hidden;
}

.chart-card .chart-canvas-wrap {
  overflow: hidden;
  transition: height 0.25s ease;
}

.chart-card .chart-canvas-wrap #oddsChart {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.chart-card #chartLegend {
  margin-top: 6px;
}

/* ========================================
   Mobile Betting Experience
   ======================================== */

/* Desktop: Hide mobile elements */
@media (min-width: 641px) {
  .mobile-only,
  .mobile-multiplier-btn,
  .mobile-action-row {
    display: none !important;
  }

  .desktop-multiplier-display {
    display: inline;
  }

  .multiplier-cell {
    text-align: center;
    font-weight: 700;
    color: var(--chip-gold);
  }
}

/* Mobile: Hide desktop, show mobile */
@media (max-width: 640px) {
  .desktop-only,
  .desktop-multiplier-display {
    display: none !important;
  }

  /* Multiplier button */
  .mobile-multiplier-btn {
    display: inline-block;
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: radial-gradient(circle at 15% 0, #fff5cf, var(--chip-gold));
    color: #3a2502;
    font-weight: 700;
    font-size: 15px;
    border: 1px solid rgba(0, 0, 0, 0.9);
    cursor: pointer;
    box-shadow: 0 2px 0 #4a3a1b, 0 4px 8px rgba(0, 0, 0, 0.65);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  }

  .mobile-multiplier-btn:hover,
  .mobile-multiplier-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 0 #4a3a1b, 0 6px 12px rgba(0, 0, 0, 0.8);
  }

  /* 3-button panel */
  .mobile-action-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    background: rgba(5, 59, 43, 0.6);
    border-radius: var(--radius-md);
  }

  .mobile-action-panel .btn {
    width: 100%;
    text-align: center;
    font-size: 14px;
  }

  /* Prevent layout shifts when mobile panels open */
  .mobile-action-row,
  .bet-detail-row,
  .position-detail-row {
    background-color: transparent !important;
  }

  .mobile-action-row:hover,
  .bet-detail-row:hover,
  .position-detail-row:hover {
    background-color: transparent !important;
  }

  /* Tighter spacing */
  th, td {
    padding: 6px 4px;
    font-size: 13px;
  }

  thead th {
    font-size: 11px;
  }
}

/* Position details for users with both YES and NO positions */
.position-details-both {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  text-align: center;
}

.position-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.payout-header {
  margin-bottom: 6px;
  font-weight: 600;
}

.stats-pair {
  display: flex;
  justify-content: center;
  gap: 8px;
}

@media (max-width: 640px) {
  .position-details-both {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .payout-header {
    margin-bottom: 8px;
  }
}

/* Sell buttons container - responsive layout */
.sell-buttons-container {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: center;
}

@media (max-width: 640px) {
  .sell-buttons-container {
    flex-direction: column;
    align-items: stretch;
  }
}
