/* ==========================================================================
   Dashboard Page Styles
   Loaded ONLY by index.html — do not reference these classes from other pages.
   ========================================================================== */

/* Header + Filters */
.page-header {
  margin-bottom: 10px;
}

.title h1 {
  margin: 0 0 14px;
  font-size: 30px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

/* Filter bar: search + status/type dropdowns + date picker, all in one row */
.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

/* Relative container so the search icon can be absolutely positioned inside */
.search-input-container {
  flex: 1;
  position: relative;
}

.search-input-container img {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  width: 18px;
  filter: invert(1);
  opacity: 0.85;
  pointer-events: none;
}

/* Override base input styles for the filter row — flat/borderless look */
.filters input[type="text"],
.filters select,
.filters input[type="date"] {
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

/* Extra left padding to leave room for the search icon */
#job-search {
  width: 100%;
  padding-left: 36px;
}

/* ==========================================================================
   Dashboard Info Cards
   5-column stat card row. Each card has a unique gradient via .card1–.card5.
   ========================================================================== */

.info-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--gap);
  margin-top: 12px;
}

.stat-card {
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow-soft);
}

.stat-card h4 {
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.88);
}

.stat-card h3 {
  font-size: 22px;
  font-weight: 800;
}

/* Card gradients correspond to: Total | Interviewing | Offer | Rejected | Pending */
.stat-card.card1 {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.08));
}

.stat-card.card2 {
  background: linear-gradient(180deg, rgba(45, 189, 177, 0.62), rgba(45, 189, 177, 0.46));
}

.stat-card.card3 {
  background: linear-gradient(180deg, rgba(107, 196, 123, 0.62), rgba(107, 196, 123, 0.46));
}

.stat-card.card4 {
  background: linear-gradient(180deg, rgba(200, 95, 82, 0.62), rgba(200, 95, 82, 0.46));
}

.stat-card.card5 {
  background: linear-gradient(180deg, rgba(60, 123, 216, 0.62), rgba(60, 123, 216, 0.46));
}

/* ==========================================================================
   Chart
   The canvas (#dashLineCanvas) is drawn by dashboard.js using the raw
   Canvas 2D API (no Chart.js library). dashboard.js re-draws on window resize.
   ========================================================================== */

.visual-graph {
  margin-top: 18px;
  padding: 18px 18px 16px;
  border-radius: var(--r-lg);
  min-height: 230px;
}

.graph-title {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

#dashLineCanvas {
  display: block;
  width: 100%;
  height: 170px;
}

/* ==========================================================================
   Recent Applications Table
   min-width: 520px prevents the table from collapsing below a readable size.
   The .table-wrap div handles horizontal overflow scrolling.

   IMPORTANT: td:nth-child(5) targets the Notes column specifically.
   The column order in index.html is: Company | Role | Date | Status | Notes.
   If you reorder or add columns in index.html, update this nth-child selector.
   ========================================================================== */

.recent-applications-card {
  margin-top: 18px;
  overflow: hidden;
}

.recent-applications h3 {
  padding: 14px 18px;
  font-size: 18px;
  font-weight: 750;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Horizontal scroll wrapper — allows narrow viewports to scroll the table */
.table-wrap {
  overflow-x: auto;
}

/* min-width prevents column crushing on narrow containers */
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

thead {
  background: rgba(255, 255, 255, 0.06);
}

th,
td {
  text-align: left;
  padding: 13px 18px;
  font-size: 14px;
  white-space: nowrap;
}

tbody tr:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Clickable row hover — glow effect */
.recent-applications tbody tr:not(.empty-row) {
  cursor: pointer;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}

.recent-applications tbody tr:not(.empty-row):hover {
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Notes column (5th): truncate long text with ellipsis.
   Column order: Company(1) | Role(2) | Date(3) | Status(4) | Notes(5)
   Changing column order in index.html will break this selector. */
td:nth-child(5) {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Three-dots overflow menu button on each row */
.threedots {
  padding: 6px 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
}

.threedots:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Empty state row when no applications exist */
.empty-row td {
  color: rgba(255, 255, 255, 0.72);
  padding: 18px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet: collapse stat cards to 2 columns; allow filter bar to wrap */
@media (max-width: 1100px) {
  .info-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .filters {
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   Mobile (≤480px)
   ========================================================================== */

@media (max-width: 480px) {
  /* Stat cards: horizontal snap-scroll row instead of wrapping grid.
     5 cards at 152px each; user swipes to reveal all. */
  .info-cards {
    grid-template-columns: repeat(5, 152px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
    scrollbar-width: none;
  }

  .info-cards::-webkit-scrollbar {
    display: none;
  }

  .stat-card {
    scroll-snap-align: start;
    min-height: 84px;
  }

  /* Prevent iOS auto-zoom on input focus (triggers when font-size < 16px) */
  .filters input[type="text"],
  .filters select,
  .filters input[type="date"] {
    font-size: 16px;
  }

  #job-search {
    font-size: 16px;
  }

  /* Chart: shorter on small screens to leave more room for the table */
  #dashLineCanvas {
    height: 130px;
  }

  /* Recent apps heading: tighten */
  .recent-applications h3 {
    font-size: 16px;
  }
}
