/*
 * 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.
 */

main {
  padding: 1.5rem 2rem;
  max-width: 960px;
}

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

.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;
}

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

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

/* Narrow form container for authenticated pages */
.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;
  }
}

/* Time entry inline form */
.time-entry-form {
  margin-bottom: 1.5rem;
}

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

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

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

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

/* 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);
}

/* 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; show it when collapsed or on mobile */
@media (min-width: 769px) {
  [data-sidebar-layout="always"]:not([data-sidebar-open]) [data-sidebar-toggle] {
    display: none;
  }
}

[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);
}

/* 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;
}

/* Pagination */
.pagy-nav {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.pagy-nav__inert {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

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

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