/* Graphite Mono Theme - from 21st.dev */
:root {
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(0.995 0 0);
  --card-foreground: oklch(0.145 0 0);
  --primary: oklch(0.205 0 0);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.87 0 0);
  --secondary-foreground: oklch(0.145 0 0);
  --muted: oklch(0.95 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.95 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.95 0 0);
  --input: oklch(0.97 0 0);
  --ring: oklch(0.708 0 0);
  --radius: 1rem;
  --font-sans: 'DM Sans', ui-sans-serif, sans-serif, system-ui;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.025em;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--foreground);
  background: var(--accent);
}

.nav-link.active {
  color: var(--primary-foreground);
  background: var(--primary);
}

/* Container */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Hero */
.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--muted-foreground);
  font-size: 1rem;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Form */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--foreground);
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.75);
  background: var(--input);
  color: var(--foreground);
  font-size: 0.9375rem;
  font-family: var(--font-mono);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px oklch(0.708 0 0 / 0.15);
}

.form-group input::placeholder {
  color: var(--muted-foreground);
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.375rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: calc(var(--radius) * 0.75);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: var(--font-sans);
}

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

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--primary-foreground);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Result Section */
.result-card {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.result-header h2 {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
}

.result-section {
  margin-bottom: 1.25rem;
}

.result-section h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}

.about-me-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--foreground);
}

/* Skills Grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.skill-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--muted);
  border-radius: calc(var(--radius) * 0.5);
  font-size: 0.8125rem;
}

.skill-name {
  font-weight: 500;
}

.skill-pct {
  font-family: var(--font-mono);
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.result-actions {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Status Badge */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.completed, .status-badge.success {
  background: oklch(0.92 0.05 145);
  color: oklch(0.3 0.1 145);
}

.status-badge.pending {
  background: oklch(0.92 0.05 80);
  color: oklch(0.4 0.1 80);
}

.status-badge.processing {
  background: oklch(0.92 0.05 252);
  color: oklch(0.3 0.1 252);
}

.status-badge.failed {
  background: oklch(0.92 0.05 27);
  color: oklch(0.4 0.1 27);
}

/* Error Card */
.error-card {
  border-color: oklch(0.85 0.1 27);
  text-align: center;
}

.error-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: oklch(0.92 0.05 27);
  color: oklch(0.4 0.1 27);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}

.error-card h3 {
  margin-bottom: 0.5rem;
}

.error-card p {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* Cover Letter Preview */
.cover-letter-preview {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--foreground);
}

.cover-letter-preview p {
  margin-bottom: 0.75rem;
}

.cover-letter-preview p:last-child {
  margin-bottom: 0;
}

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

.btn-secondary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Container Wide (records page) */
.container-wide {
  max-width: 1100px;
}

/* Records Table */
.table-card {
  padding: 0;
  overflow: hidden;
}

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

.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.records-table thead {
  background: var(--muted);
  border-bottom: 1px solid var(--border);
}

.records-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.records-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.records-table tbody tr:last-child td {
  border-bottom: none;
}

.records-table tbody tr:hover {
  background: var(--accent);
}

.cell-id {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.cell-title {
  max-width: 220px;
}

.job-title-text {
  font-weight: 600;
  display: block;
}

.cell-subtitle {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.cell-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.375rem;
}

.skill-tag-mini {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: var(--muted);
  border-radius: calc(var(--radius) * 0.5);
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
}

.cell-url {
  max-width: 180px;
}

.cell-url .url-link {
  font-size: 0.75rem;
}

.cell-status {
  white-space: nowrap;
}

.error-text-sm {
  font-size: 0.6875rem;
  color: var(--destructive);
  margin-top: 0.25rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.cell-actions {
  white-space: nowrap;
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.cell-detail {
  text-align: center;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.5);
  background: transparent;
  cursor: pointer;
  color: var(--muted-foreground);
  font-size: 1rem;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--accent);
  color: var(--foreground);
  border-color: var(--ring);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.5);
  background: transparent;
  color: var(--foreground);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover:not(.page-btn-disabled):not(.page-btn-active) {
  background: var(--accent);
  border-color: var(--ring);
}

.page-btn-active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  cursor: default;
}

.page-btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-info {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
}

/* Detail Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  transform: translateY(10px);
  transition: transform 0.2s;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 0.5);
  background: transparent;
  cursor: pointer;
  color: var(--muted-foreground);
  font-size: 1.25rem;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--destructive);
  color: white;
  border-color: var(--destructive);
}

.modal-field {
  margin-bottom: 1.25rem;
}

.modal-field-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 0.375rem;
}

.modal-field-value {
  font-size: 0.9375rem;
  line-height: 1.6;
}

.modal-field-value.url-link {
  font-size: 0.8125rem;
}

.modal-skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}

.modal-cover-letter {
  font-size: 0.9375rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* Text muted utility */
.text-muted {
  color: var(--muted-foreground);
}

/* Records Page */
.records-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.record-card {
  transition: box-shadow 0.2s;
}

.record-card:hover {
  box-shadow: 0 2px 8px oklch(0 0 0 / 0.06);
}

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

.record-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.record-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
}

.record-meta {
  text-align: right;
}

.record-time {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
}

.record-body {
  margin-bottom: 1rem;
}

.record-field {
  margin-bottom: 0.75rem;
}

.field-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.field-value {
  font-size: 0.875rem;
  line-height: 1.5;
}

.url-link {
  color: oklch(0.3 0.1 252);
  text-decoration: none;
  word-break: break-all;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.url-link:hover {
  text-decoration: underline;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.skill-tag {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background: var(--muted);
  border-radius: calc(var(--radius) * 0.5);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.error-text {
  color: var(--destructive);
}

.error-field .field-value {
  color: var(--destructive);
}

.record-actions {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* Empty State */
.empty-card {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-card h3 {
  margin-bottom: 0.5rem;
}

.empty-card p {
  color: var(--muted-foreground);
}

.empty-card a {
  color: var(--foreground);
  font-weight: 600;
}

/* Responsive */
@media (max-width: 640px) {
  .navbar {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
  }

  .container {
    padding: 1.5rem 1rem 3rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .record-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }
}
