:root {
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --clr-bg: #0b0b0b;
  --clr-fg: #ccc;
  --clr-accent: #1dc9f1;
  --clr-card-bg: rgba(255, 255, 255, 0.05);
  --clr-modal-card-bg: rgba(33, 33, 33, 1);
  --clr-border: #333;
  --transition-speed: 0.3s;
}

body {
  font-family: var(--font-main);
  color: var(--clr-fg);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  /* fallback background color */
  background-color: var(--clr-bg);
  position: relative;
}

/* Partially transparent background image with pseudo-element */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("../img/bg.webp") no-repeat center center / cover;
  opacity: 0.4; /* adjust alpha here */
  z-index: -1;
}

/* Container for all content */
.dashboard-container {
  padding: 0.2rem 1.5rem;
}

/* Header area: nav on left, user info on right */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* Navigation as cards */
.header-left {
  display: flex;
}
.nav-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.nav-card {
  background: var(--clr-card-bg);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 0 5px rgba(0,0,0,0.3);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}
.nav-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 10px rgba(0,0,0,0.6);
}
.nav-card a {
  color: var(--clr-accent);
  text-decoration: none;
  font-weight: bold;
}


/* Place user info on the right */
.header-right {
    color: #aaa;
}
.header-right p {
  font-size: 0.9rem;
  color: #aaa;
}

/* Main 3x3 Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;  /* middle is slightly wider for the globe */
  grid-template-rows: auto;
  grid-template-areas:
    "domains  globe   latest"
    "editors  globe   latest"
    "visitors pubGraph aiGens";
  gap: 1rem;
  margin-top: 1rem;
  position: relative;
  z-index: 1;
}

/* Assign each section to its grid area */
.domains   { grid-area: domains; }
.editors   { grid-area: editors; }
.visitors  { grid-area: visitors; }
.globe     { grid-area: globe; }
.latest    { grid-area: latest; }
.pubGraph  { grid-area: pubGraph; }
.aiGens    { grid-area: aiGens; }

.grid-section {
  background: var(--clr-card-bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  padding: 1rem;
  position: relative;
}
.grid-section h2 {
  margin-bottom: 0.5rem;
}

/* Common styling for big numeric stats */
.big-stat {
  font-size: 2.5rem;
  font-weight: bold;
  color: #fff;
  margin: 0.5rem 0;
}
.domains .big-stat {
  font-size: 1.8rem;
  margin: 0.2rem 0;
}
.domains p,
.domains .domain-sub {
  margin: 0.15rem 0;
  font-size: 0.8rem;
}

/* GLOBE */
.globe-viz {
  width: 100%;
  height: calc(100% - 70px); /* subtract space for the heading above */
  margin-top: 0.5rem;
  background: transparent;
}
.globe-viz *,
canvas {
  background: transparent;
}

/* Latest published items */
.latest-published {
  margin-top: 0.5rem;
}
.published-item {
  margin-bottom: 0.75rem;
}
.published-domain {
  font-weight: bold;
  color: #fff;
}
.published-meta {
  font-size: 0.85rem;
  color: #aaa;
}
.published-meta a {
  color: var(--clr-accent);
}

/* Top Editors row styling */
.top-editors-list {
  margin-top: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.editor-row {
  background-color: #1e1e1e;
  border-radius: 5px;
  display: flex;
  align-items: center;
  padding: 0.35rem 0.5rem;
  gap: 0.5rem;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.editor-rank {
  font-size: 1.2rem;
  font-weight: bold;
  color: #f0f0f0;
  width: 24px; /* fixed width so ranks line up */
  text-align: center;
}

.editor-avatar {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #444; /* optional border */
}

.editor-info {
  display: flex;
  flex-direction: column;
}

.editor-name {
  font-weight: bold;
  color: #fff;
  margin-bottom: 1px;
  font-size: 0.85rem;
}

.editor-contribs {
  font-size: 0.75rem;
  color: #aaa;
}

/* Graph placeholder */
.graph-placeholder {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.95rem;
  color: #999;
}

/* AI Gens */
.ai-gens-list {
  margin-top: 0.5rem;
}
.subtext {
  font-size: 0.85rem;
  color: #999;
}

/* Center the .hourly-heatmap and right-align the legend */
.heatmap-container {
  font-family: sans-serif;
  color: #ddd;
  display: flex;
  flex-direction: column;
  align-items: center; /* center the day-grids horizontally */
  margin-top: 1rem;
  position: relative;
}
.hourly-heatmap {
  display: flex;
  gap: 2rem;
  margin-bottom: 5rem; /* space above the legend */
}
/* Right-align the legend */
.heatmap-legend {
  margin-left: auto; /* push the legend to the right */
  margin-right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
/* Heatmap tooltip (absolutely positioned, hidden by default) */
.heatmap-tooltip {
  position: absolute;
  pointer-events: none;
  background-color: rgba(20, 20, 20, 0.9);
  color: #fff;
  padding: 2px 3px;
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1.4;
  transition: opacity 0.2s ease;
  opacity: 0; /* hidden by default */
  z-index: 9999;
  width:fit-content;
}

.legend-box {
  width: 14px;
  height: 14px;
  /* We'll just define the gradient steps in the script below */
  background-color: #161b22;
}
.legend-label {
  font-size: 0.8rem;
  color: #aaa;
}

/* The day-grid: 6 columns x 4 rows (24 cells) */
.day-grid {
  display: grid;
  grid-template-columns: repeat(6, 16px);
  grid-template-rows: repeat(4, 16px);
  gap: 4px;
  align-items: center;
}
.day-label {
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  text-align: center;
}
.hour-cell {
  width: 16px;
  height: 16px;
  background-color: #161b22; /* default low color */
  transition: background-color 0.2s;
}

/* Responsive adjustments */
@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "domains"
      "editors"
      "visitors"
      "globe"
      "latest"
      "pubGraph"
      "aiGens";
  }
  .globe-viz {
    height: 400px;
  }
}

/* General styles for consistency */
input, textarea {
    padding: 0.5rem;
    border: 1px solid var(--clr-border);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--clr-fg);
}

button {
    padding: 0.5rem 1rem;
    background: var(--clr-accent);
    color: #000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

/* General link styles */
a {
    color: var(--clr-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Enhanced table styles for elegant dark theme */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--clr-card-bg);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    margin: 1rem 0;
}
th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
th {
    background: var(--clr-accent);
    color: #000;
    font-weight: bold;
}
tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.05);
}
tr:hover {
    background: rgba(255, 255, 255, 0.1);
}
tr.highlight {
    background: rgba(0, 123, 255, 0.3);
}

/* Domain list specific styles */
svg {
    height: 18px;
    cursor: pointer;
    margin: 0 2px;
}
.icon {
    /* General icon class */
}
th.sortable {
    cursor: pointer;
    background: var(--clr-accent);
    color: #000;
}
th.sortable::after {
    color: var(--clr-fg);
    content: " ▲";
}
th[data-sort-order="asc"]::after {
    color: var(--clr-fg);
    content: " ▲";
}
th[data-sort-order="desc"]::after {
    color: var(--clr-fg);
    content: " ▼";
}
.edit-icon {
    cursor: pointer;
    fill: var(--clr-accent);
    width: 16px;
    height: 16px;
}
.save-btn, .cancel-btn {
    margin-right: 5px;
    cursor: pointer;
    background: var(--clr-accent);
    color: #000;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}
.action-cell {
    width: 120px;
}
.server_ip,
.language_code,
.country_code,
.ppc_type {
    width: 120px;
}
input[type="text"] {
    width: 100px;
    max-width: auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--clr-border);
    color: var(--clr-fg);
    padding: 0.25rem;
    border-radius: 4px;
}

/* Kanban styles */
.kanban-container {
    padding: 1rem;
}

.kanban-board {
    display: flex;
    gap: 1rem;
    justify-content: space-around;
    margin-bottom: 2rem;
}

.kanban-column {
    background: var(--clr-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 1rem;
    width: 30%;
    min-height: 400px;
    max-height: 600px;
    overflow-x: auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.kanban-column h2 {
    margin-bottom: 1rem;
    text-align: center;
}

.task-list {
    min-height: 300px;
}

.task-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: transform var(--transition-speed);
    height: 80px;
    overflow: hidden;
    position: relative;
}

.task-card:hover {
    transform: translateY(-2px);
}

.task-card h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
}

.task-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--clr-fg);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.delete-task {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    opacity: 0.4;
}

.task-card:hover .delete-task {
    opacity: 1;
}

.delete-task:hover {
    background: #d00;
}

.add-task {
    background: var(--clr-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 1rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.add-task form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.add-task input,
.add-task textarea {
    width: auto;
    padding: 0.5rem;
    border: 1px solid var(--clr-border);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--clr-fg);
}

.add-task textarea {
    height: 10rem;
}

.add-task button {
    padding: 0.5rem;
    background: var(--clr-accent);
    color: #000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

/* Projects list styles */
.projects-container {
    padding: 1rem;
}

.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.project-card {
    background: var(--clr-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 1rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition-speed);
}

.project-card:hover {
    transform: translateY(-3px);
}

.project-card h3 {
    margin: 0 0 0.5rem 0;
    color: #fff;
}

.project-card p {
    margin: 0 0 1rem 0;
    color: #aaa;
}

.view-project-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--clr-accent);
    color: #000;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.3s;
}

.view-project-btn:hover {
    background: #ffb;
}

.create-project {
    background: var(--clr-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 1rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
}

.create-project form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.create-project input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--clr-border);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--clr-fg);
}

.create-project button {
    padding: 0.5rem 1rem;
    background: var(--clr-accent);
    color: #000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.project-description {
    font-style: italic;
    font-weight: normal;
    font-size: 11px;
    text-align: left;
    width: 100%;
    margin: 10px 0;
    color: var(--clr-fg);
    padding: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background: var(--clr-modal-card-bg);
    margin: 10% auto;
    padding: 20px;
    border-radius: 6px;
    width: 80%;
    max-width: 1024px;
    max-height: 50vh;
    overflow-y: auto;
    color: var(--clr-fg);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-header h2 {
    margin-top: 0;
    color: #fff;
    flex: 1;
}

#modal-age {
    color: #aaa;
    font-size: 0.9rem;
    margin-top: 5px;
    margin-right: 20px;
}

.modal-content p {
    line-height: 1.5;
    white-space: pre-wrap;
    margin-bottom: 1rem;
}

#modal-history {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 1rem;
}

#modal-history h3 {
    margin: 0 0 0.5rem 0;
    color: #fff;
    font-size: 1.1rem;
}

#modal-history p {
    margin: 0.25rem 0;
    font-size: 0.85rem;
    color: #ccc;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .kanban-board {
        flex-direction: column;
    }
    .kanban-column {
        width: 100%;
        margin-bottom: 1rem;
    }
    .projects-list {
        grid-template-columns: 1fr;
    }
    .modal-content {
        width: 90%;
        margin: 20% auto;
    }
}

/* welcome / login */
.welcome-section {
    text-align: center;
    margin-top: 20%;
}

.welcome-section h1 {
    color: #fff;
}

.welcome-section p {
    color: #aaa;
    font-size: 1.2rem;
}

.welcome-section a {
    color: var(--clr-accent);
}

.welcome-section label {
    color: var(--clr-fg);
    margin-bottom: 0.5rem;
}

/* articles */

/* Form grid styles for articles page */
.grid-section {
  padding: 2rem;
}
form {
  display: grid;
  gap: 2rem; /* Increased gap for spacing */
  padding: 1rem 0;
}
.row {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem; /* Add spacing between rows */
}
/* Top row: League on left, Kickoff Time on right */
.top-row {
  grid-template-columns: 1fr 1fr;
  align-items: end;
}
/* Teams row: Home on left, Away on right */
.teams-row {
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.teams-row > div {
  display: grid;
  gap: 1rem;
}
/* Reasoning and Model row */
.reasoning-model {
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.full-width {
  grid-column: 1 / -1;
}
label {
  margin-bottom: 0.5rem;
  font-weight: bold;
}
select {
  appearance: none; /* Remove default styling */
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--clr-card-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem;
  border-radius: 4px;
  color: var(--clr-fg);
  background-image: url('data:image/svg+xml;utf8,<svg fill="white" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>'); /* Custom arrow */
  background-repeat: no-repeat;
  background-position: left -3px center;
  background-size: 16px;
}
/* Ensure inputs/textarea use global styles but adjust height */
textarea {
  resize: vertical;
  min-height: 160px; /* Doubled height */
}
@media (max-width: 768px) {
  .top-row, .teams-row, .reasoning-model, .halftime-fields {
    grid-template-columns: 1fr;
  }
}
