/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ── Base layout ─────────────────────────────────────────────────────────── */

main {
  padding: 1rem;
  max-width: 960px;
  overflow-x: hidden;
}

@media (min-width: 769px) {
  main {
    padding: 1.5rem 2rem;
  }
}

main.main--centered {
  max-width: 420px;
  margin: 4rem auto;
  padding: 1.5rem;
}

/* ── Page header row (title + actions) ───────────────────────────────────── */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0;
}

.page-header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

.page-header-actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45em 1em;
  border-radius: var(--radius-medium, 0.375rem);
  font-size: var(--text-7, 0.875rem);
  font-weight: 500;
  text-decoration: none;
  background: var(--primary);
  color: var(--primary-foreground);
  border: 1px solid var(--primary);
}

.page-header-actions a:hover {
  opacity: 0.85;
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .page-header-actions a[role="button"] {
    width: 100%;
    text-align: center;
    justify-content: center;
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-wrapper {
  width: 100%;
}

@media (max-width: 768px) {
  .table-wrapper {
    overflow-x: hidden;
  }
}

/* ── Responsive card layout (mobile) ────────────────────────────────────── */

/* Hide card cells on desktop */
@media (min-width: 769px) {
  td.card-cell {
    display: none;
  }
}

@media (max-width: 768px) {
  .responsive-table table,
  .responsive-table tbody,
  .responsive-table tr {
    display: block;
    width: 100%;
  }

  .responsive-table thead {
    display: none;
  }

  /* Hide all regular cells, show only the card cell */
  .responsive-table td {
    display: none;
  }

  .responsive-table td.card-cell {
    display: block;
    padding: 0;
  }

  /* Each tr becomes a card */
  .responsive-table tbody tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    background: var(--card);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }

  /* Deactivated: apply opacity to card, not individual cells */
  .responsive-table tr.row--deactivated {
    opacity: 0.5;
  }

  .responsive-table .row--deactivated td {
    opacity: 1;
  }
}

/* Card cell internal layout */
.card-primary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: var(--font-semibold);
  margin-bottom: 0.25rem;
}

.card-primary-value {
  flex: 1;
}

.card-primary-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.card-secondary {
  font-size: var(--text-7);
  color: var(--muted-foreground);
  margin-top: 0.15rem;
}

/* ── Pills ───────────────────────────────────────────────────────────────── */

.pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.2em 0.5em;
  border-radius: 999px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill--deactivated {
  background: var(--muted);
  color: var(--muted-foreground);
}

.row--deactivated td {
  opacity: 0.5;
}

/* ── Icons ───────────────────────────────────────────────────────────────── */

.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

a:has(.icon), a[role="button"] {
  text-decoration: none;
}

/* ── Narrow form container ───────────────────────────────────────────────── */

.form-narrow {
  max-width: 480px;
}

/* ── Reports filter form ─────────────────────────────────────────────────── */

.report-filter-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.report-filter-form input,
.report-filter-form select {
  margin: 0;
}

@media (max-width: 768px) {
  .report-filter-form input,
  .report-filter-form select,
  .report-filter-form input[type="submit"] {
    width: 100%;
    flex: 1 1 100%;
  }
}

@media (min-width: 769px) {
  .report-filter-form input[type="date"] {
    width: 10rem;
    flex-shrink: 0;
  }

  .report-filter-form select {
    flex: 1;
  }

  .report-filter-form input[type="submit"] {
    width: auto;
    flex: none;
  }
}

/* ── Reports totals / download row ──────────────────────────────────────── */

.report-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

/* ── Time entry inline form ──────────────────────────────────────────────── */

turbo-frame {
  display: block;
  min-width: 0;
  max-width: 100%;
}

.time-entry-form {
  margin-bottom: 1.5rem;
}

.time-entry-form-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.time-entry-form-row input,
.time-entry-form-row select {
  margin: 0;
}

.time-entry-description {
  flex: 1;
  min-width: 160px;
}

.time-entry-date {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.time-entry-hours {
  width: 5rem;
}

@media (max-width: 768px) {
  .time-entry-form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .time-entry-form-row input,
  .time-entry-form-row select,
  .time-entry-description,
  .time-entry-hours {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    flex: 1 1 100%;
  }

  .time-entry-form-row input[type="submit"] {
    width: 100%;
  }
}

/* ── Autocomplete ────────────────────────────────────────────────────────── */

.autocomplete-wrapper {
  position: relative;
}

.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.1);
  max-height: 12rem;
  overflow-y: auto;
}

.autocomplete-results[hidden] {
  display: none;
}

.autocomplete-results li {
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: var(--text-7);
}

.autocomplete-results li:hover,
.autocomplete-results li[aria-selected="true"] {
  background: var(--accent);
}

/* ── Topnav / sidebar controls ───────────────────────────────────────────── */

/* button_to wraps in a <form> — keep it inline in table cells and sidebars */
td form, [data-sidebar-footer] form {
  display: inline;
}

[data-sidebar-toggle],
.topnav-theme-toggle {
  background: none;
  border: none;
  padding: 0;
  box-shadow: none;
  cursor: pointer;
  color: var(--foreground);
}

.topnav-theme-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--text-7);
}

.topnav-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Hide the hamburger when the sidebar is visible */
@media (min-width: 769px) {
  [data-sidebar-layout="always"]:not([data-sidebar-open]) [data-sidebar-toggle] {
    display: none;
  }
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

[data-sidebar-nav] {
  display: flex;
  flex-direction: column;
  height: 100%;
}

[data-sidebar-nav] ul {
  flex: 1;
}

.sidebar-account-name {
  display: block;
  font-weight: 600;
  padding: 1rem 1rem 0.75rem;
  margin-bottom: 0.5rem;
}

.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-username {
  font-size: 0.95rem;
  font-weight: 600;
}

.sign-out-link {
  background: none;
  border: none;
  padding: 0;
  box-shadow: none;
  cursor: pointer;
  color: var(--foreground);
  text-decoration: none;
  font-size: var(--text-7);
}

/* ── Table action columns ────────────────────────────────────────────────── */

/* Icon-only ghost buttons: strip padding and align to surrounding content */
td .ghost, [data-sidebar-footer] .ghost {
  padding: 0;
  vertical-align: middle;
  line-height: 1;
}


/* Action columns: right-align and space out icon buttons */
td.actions {
  text-align: right;
  white-space: nowrap;
}

/* Icon links in action columns use foreground colour, not --primary */
td.actions a, .card-primary-actions a {
  color: var(--foreground);
}

td.actions a:hover, .card-primary-actions a:hover {
  opacity: 0.6;
}

td.actions a, td.actions form {
  margin-left: 0.5rem;
}


/* ── Pagination ──────────────────────────────────────────────────────────── */

.pagy-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  gap: 1rem;
}

.pagy-nav__stats {
  font-size: var(--text-7, 0.875rem);
  color: var(--muted-foreground);
}

/* series_nav output: <nav class="pagy series-nav"><a>...</a></nav> */
nav.pagy.series-nav {
  display: flex;
}

nav.pagy.series-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.25em 0.6em;
  border: 1px solid var(--border);
  margin-left: -1px;
  font-size: var(--text-7, 0.875rem);
  text-decoration: none;
  color: var(--foreground);
  background: transparent;
  line-height: 1.5;
}

nav.pagy.series-nav a:first-child {
  border-radius: var(--radius-medium, 0.375rem) 0 0 var(--radius-medium, 0.375rem);
  margin-left: 0;
}

nav.pagy.series-nav a:last-child {
  border-radius: 0 var(--radius-medium, 0.375rem) var(--radius-medium, 0.375rem) 0;
}

nav.pagy.series-nav a[href]:hover {
  background: var(--muted);
  z-index: 1;
  position: relative;
}

nav.pagy.series-nav a[aria-current="page"] {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  z-index: 1;
  position: relative;
}

nav.pagy.series-nav a[aria-disabled="true"] {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ── Global font override ─────────────────────────────────────────────────── */

:root {
  --font-sans: "Noto Sans", system-ui, sans-serif;
  --font-serif: "Merriweather", Georgia, serif;
  --primary: #4d7c0f;
  --primary-foreground: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #84cc16;
    --primary-foreground: #1a2e05;
  }
}

:root[style*="color-scheme: dark"] {
  --primary: #84cc16;
  --primary-foreground: #1a2e05;
}

:root[style*="color-scheme: light"] {
  --primary: #4d7c0f;
  --primary-foreground: #ffffff;
}

body {
  font-family: var(--font-sans);
}

/* ── Marketing page ──────────────────────────────────────────────────────── */

.marketing-body {
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  margin: 0;
}

.mkt-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
}

.mkt-nav__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--foreground);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
}

.mkt-nav__right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mkt-nav__signin {
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.mkt-nav__signin:hover {
  color: var(--foreground);
}

.mkt-theme-toggle {
  background: none;
  border: none;
  padding: 0;
  box-shadow: none;
  cursor: pointer;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--text-7);
}

.mkt-theme-toggle:hover {
  color: var(--foreground);
}

.mkt-hero {
  text-align: center;
  padding: 5rem 1.5rem 4rem;
  max-width: 680px;
  margin: 0 auto;
}

.mkt-hero__icon {
  margin-bottom: 2rem;
}

.mkt-hero__headline {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  color: var(--foreground);
}

.mkt-hero__sub {
  font-size: 1.1rem;
  color: var(--muted-foreground);
  margin: 0 0 2.5rem;
  line-height: 1.6;
}

.mkt-hero__actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.mkt-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75em 1.75em;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
}

.mkt-btn:hover {
  opacity: 0.85;
  text-decoration: none;
}

.mkt-btn--primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.mkt-btn--ghost {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}

.mkt-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
  border-top: 1px solid var(--border);
}

.mkt-feature {
  text-align: center;
}

.mkt-feature__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  background: var(--muted);
  color: var(--foreground);
  margin-bottom: 1rem;
}

.mkt-feature h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--foreground);
}

.mkt-feature p {
  font-size: 0.9rem;
  color: var(--muted-foreground);
  margin: 0;
  line-height: 1.6;
}

.mkt-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted-foreground);
}
