/* ==========================================================================
   Applications Page Styles
   Loaded ONLY by applications.html — do not reference these classes elsewhere.
   ========================================================================== */

/* Header — flex row with title+subtitle on left, action buttons on right */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

.subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

/* ==========================================================================
   Filters
   Breakpoint at 1100px wraps the filter row; at 780px the page header stacks.
   ========================================================================== */

.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

/* Relative wrapper so the search icon can be 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;
}

/* Filter bar inputs share a flat style overriding the base input defaults */
.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;
}

#job-search {
  width: 100%;
  padding-left: 36px;
}

/* ==========================================================================
   Table Card
   min-width: 700px prevents column crushing on narrow containers.
   The .table-wrap div handles horizontal overflow scrolling.

   IMPORTANT: td:nth-child(6) targets the Notes column specifically.
   Column order: Company(1) | Role(2) | Type(3) | Date(4) | Status(5) | Notes(6) | Actions(7)
   Adding or reordering columns in applications.html requires updating this selector.
   ========================================================================== */

.apps-card {
  overflow: hidden;
}

/* Card header with title and row count pill */
.card-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.card-header h3 {
  font-size: 18px;
  font-weight: 750;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

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

/* All data rows are clickable and open the edit modal */
tbody tr:not(.empty-row) {
  cursor: pointer;
  transition: background 0.14s ease;
}

tbody tr:not(.empty-row):hover {
  background: rgba(255, 255, 255, 0.055);
}

/* Company name gets a subtle underline hint on row hover */
tbody tr:not(.empty-row) td:first-child {
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s ease;
}

tbody tr:not(.empty-row):hover td:first-child {
  text-decoration-color: rgba(255, 255, 255, 0.32);
}

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

/* Edit/Delete button pair inside each row's last cell */
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.empty-row td {
  color: rgba(255, 255, 255, 0.72);
  padding: 18px;
}

/* ==========================================================================
   AI Quick Add Button
   Sits in the page header next to "New Application". Amber/gold themed to
   match the AI Suggest button inside the modal. Dims when AI is off.
   ========================================================================== */

.ai-quick-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.32);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(245, 158, 11, 0.07));
  color: rgb(251, 191, 36);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 0.22s ease, border-color 0.22s ease,
              box-shadow 0.22s ease, transform 0.15s ease, opacity 0.2s ease;
}

/* Shimmer sweep on hover */
.ai-quick-add-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(251, 191, 36, 0.14) 45%,
    rgba(251, 191, 36, 0.22) 50%,
    rgba(251, 191, 36, 0.14) 55%,
    transparent 100%
  );
  background-size: 250% 100%;
  background-position: -100% 0;
  transition: background-position 0.55s ease;
  pointer-events: none;
}

.ai-quick-add-btn:hover::before {
  background-position: 150% 0;
}

.ai-quick-add-btn:hover {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.13));
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.18), 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.ai-quick-add-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Dimmed state when AI features are disabled */
.ai-quick-add-btn.ai-off {
  opacity: 0.42;
  cursor: not-allowed;
}

.ai-quick-add-btn.ai-off::before {
  display: none;
}

/* ==========================================================================
   AI Quick Add Modal
   ========================================================================== */

/* Amber accent line under the modal-top header */
.quick-add-top {
  border-bottom: 1px solid rgba(251, 191, 36, 0.18) !important;
}

/* Sparkle icon + title inline */
.quick-add-header-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgb(251, 191, 36);
}

.quick-add-header-title h4 {
  color: var(--text);
}

/* Hint text below the title */
.quick-add-hint {
  margin-bottom: 16px;
  line-height: 1.55;
}

/* Textarea wrapper — positions the char count below */
.quick-add-textarea-wrap {
  display: flex;
  flex-direction: column;
}

.quick-add-textarea-wrap textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.65;
  padding: 14px 16px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.quick-add-textarea-wrap textarea:focus {
  border-color: rgba(251, 191, 36, 0.42);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.08);
}

.quick-add-textarea-wrap textarea::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

/* Character counter — sits below the textarea, right-aligned */
.char-count {
  margin-top: 7px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  transition: color 0.2s ease;
  user-select: none;
}

.char-count.near-limit {
  color: rgba(251, 191, 36, 0.85);
}

/* "Parse with AI" action button inside the quick-add modal */
.ai-parse-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 22px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.38);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(245, 158, 11, 0.12));
  color: rgb(251, 191, 36);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.ai-parse-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.28), rgba(245, 158, 11, 0.2));
  border-color: rgba(251, 191, 36, 0.6);
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.22);
}

.ai-parse-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Spin the sparkle icon while parsing is in flight */
.ai-parse-btn.is-parsing svg {
  animation: qa-spin 0.75s linear infinite;
}

@keyframes qa-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ==========================================================================
   Pagination
   Sits at the bottom of .apps-card, hidden by JS when ≤ PAGE_SIZE items exist.
   ========================================================================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Prev / next arrow buttons */
.page-arrow {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.page-arrow:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.page-arrow:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

/* Row of numbered page buttons */
.page-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.page-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.07);
}

.page-btn.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  font-weight: 700;
  cursor: default;
}

/* Ellipsis between non-adjacent page ranges */
.page-ellipsis {
  color: var(--muted);
  font-size: 13px;
  padding: 0 4px;
  user-select: none;
}

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

/* Tablet: allow filter bar to wrap to multiple lines */
@media (max-width: 1100px) {
  .filters {
    flex-wrap: wrap;
  }
}

/* Small tablet: stack page-header vertically */
@media (max-width: 780px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

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

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