/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:       #4e5d85;
  --accent-hover: #3d4c72;
  --accent-light: #edf0f6;
  --bg:           #f5f6f9;
  --card:         #ffffff;
  --text:         #1c2033;
  --muted:        #676e85;
  --border:       #dfe2ec;
  --green:        #2e7d52;
  --red:          #b91c1c;
  --radius:       6px;
}

html { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main.container {
  padding-top: 2rem;
  padding-bottom: 4rem;
}

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}

.site-name,
.site-name:hover {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  text-decoration: none;
}

.site-name-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.site-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-subtitle {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

.site-logo {
  width: 30px;
  height: 30px;
  display: block;
  flex-shrink: 0;
}

nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

nav a {
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
}

nav a:hover { color: var(--accent); text-decoration: none; }

.btn-post {
  background: var(--accent) !important;
  color: white !important;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.8125rem !important;
  transition: background 0.15s;
}

.btn-post:hover { background: var(--accent-hover) !important; }

/* Flash messages */
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Page header */
.page-header { margin-bottom: 1.75rem; }

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.page-header .subtitle {
  color: var(--muted);
  margin-top: 0.2rem;
  font-size: 0.9rem;
}

/* Search bar */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-bar input[type="text"] {
  flex: 1;
  min-width: 180px;
}

.search-bar input,
.search-bar select {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
}

.search-bar input:focus,
.search-bar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(92, 75, 189, 0.1);
}

.search-bar button {
  padding: 0.55rem 1.1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.search-bar button:hover { background: var(--accent-hover); }

.clear-link {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Job count */
.job-count {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

/* Job list */
.job-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.job-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.job-card:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 10px rgba(92, 75, 189, 0.09);
  text-decoration: none;
}

/* Company logo */
.job-logo {
  flex-shrink: 0;
  width: 40px;
  align-self: center;
}

.company-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid var(--border);
  background: white;
  display: block;
  padding: 3px;
}

.company-logo-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  border: 1px solid var(--border);
  flex-shrink: 0;
  user-select: none;
}

.job-card-main { flex: 1; min-width: 0; }

.job-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.company { font-weight: 500; color: var(--text); }
.sep { color: var(--border); }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-remote { background: #e0f2fe; color: #0369a1; }
.badge-type   { background: var(--accent-light); color: var(--accent); }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.tag {
  padding: 0.1rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Job card side */
.job-card-side { text-align: right; flex-shrink: 0; }

.salary {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 0.25rem;
}

.posted-date {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
  font-size: 0.875rem;
}

.page-info { color: var(--muted); }

/* Breadcrumb */
.breadcrumb {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

/* Job detail */
.job-detail {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
}

.job-detail-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.job-detail-header-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.job-logo-lg {
  width: 56px;
  flex-shrink: 0;
}

.job-logo-lg .company-logo {
  width: 56px;
  height: 56px;
  border-radius: 10px;
}

.job-logo-lg .company-logo-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  font-size: 1.4rem;
}

.job-detail-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.3rem;
}

.detail-salary { margin-top: 0.5rem; font-size: 1rem; }
.salary-label  { font-weight: 400; color: var(--muted); font-size: 0.85rem; }

.job-description {
  font-size: 0.9375rem;
  line-height: 1.8;
  margin-bottom: 2rem;
  color: var(--text);
}

.job-apply {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.job-apply h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.apply-links { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.btn-apply {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  background: var(--green);
  color: white;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-apply:hover { opacity: 0.88; text-decoration: none; }

.btn-apply-email {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 0.9rem;
  text-decoration: none;
}

.btn-apply-email:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.job-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.job-actions { display: flex; gap: 0.5rem; align-items: center; }

.inline-form { display: inline; }

.btn-edit {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.12s, color 0.12s;
}

.btn-edit:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.btn-delete {
  padding: 0.3rem 0.8rem;
  border: 1px solid #fecaca;
  background: white;
  color: var(--red);
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}

.btn-delete:hover { background: var(--red); color: white; border-color: var(--red); }

/* Forms */
.form-page { max-width: 640px; }

.form-page h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.75rem;
}

.form-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: 0.25rem;
  margin-bottom: 1rem;
}

.form-group { margin-bottom: 1.1rem; }

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.req { color: var(--red); }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.575rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(92, 75, 189, 0.1);
}

.form-group textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.65;
}

.form-hint {
  font-size: 0.775rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.btn-submit {
  padding: 0.65rem 2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-submit:hover { background: var(--accent-hover); }

/* Auth forms */
.auth-page {
  max-width: 400px;
  margin: 1rem auto;
}

.auth-page h1 {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.3rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.auth-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
}

.auth-footer {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 1.25rem;
}

/* Account settings */
.account-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.account-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.account-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.account-section .form-group { margin-bottom: 0.65rem; }

.btn-save {
  padding: 0.45rem 1.1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.15rem;
}

.btn-save:hover { background: var(--accent-hover); }

.unverified-badge {
  color: var(--red);
  font-size: 0.8rem;
}

.pending-email-notice {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--accent-light);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Profile */
.profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.profile-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
}

.profile-meta {
  color: var(--muted);
  font-size: 0.8125rem;
  margin-top: 0.2rem;
}

.profile-jobs h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}

.profile-job-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.4rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.profile-job-row.inactive { opacity: 0.45; }

.job-title-small { font-weight: 500; font-size: 0.9rem; }
.job-company-small { font-size: 0.8rem; color: var(--muted); margin-top: 0.1rem; }

.badge-inactive {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  background: #f3f4f6;
  color: var(--muted);
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 0.4rem;
}

/* Footer */
.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  margin-top: 2rem;
}

.site-footer p {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* About page */
.about-page { max-width: 720px; }

.about-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.about-logo {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.about-hero h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.3rem;
}

.about-tagline {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.5;
}

.about-body {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.about-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  color: var(--text);
}

.about-section p {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 0.85rem;
}

.about-section p:last-child { margin-bottom: 0; }

.about-section ul {
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.about-section li {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text);
}

.about-cta {
  background: var(--accent-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
}

.about-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.btn-about-primary {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-about-primary:hover { background: var(--accent-hover); text-decoration: none; }

.btn-about-secondary {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.btn-about-secondary:hover {
  background: var(--accent);
  color: white;
  text-decoration: none;
}

/* Footer links */
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover { color: var(--accent); }

/* Responsive */
@media (max-width: 600px) {
  .job-card         { flex-direction: column; }
  .job-card-side    { text-align: left; }
  .form-row         { grid-template-columns: 1fr; }
  .job-detail       { padding: 1.25rem 1.25rem; }
  nav               { gap: 0.75rem; }
  .about-hero       { flex-direction: column; gap: 1rem; }
  .about-logo       { width: 56px; height: 56px; }
  .about-cta        { padding: 1.25rem 1.25rem; }
  .account-settings { grid-template-columns: 1fr; }
  .site-logo        { width: 24px; height: 24px; }
  .site-title       { font-size: 0.8rem; }
  .site-subtitle    { display: none; }
}

/* ---- Dark mode ---- */
[data-theme="dark"] {
  --accent:       #7b8ec8;
  --accent-hover: #8fa0d4;
  --accent-light: #1e2338;
  --bg:           #0f1117;
  --card:         #1a1d27;
  --text:         #e2e4ed;
  --muted:        #8b92a8;
  --border:       #2d3147;
  --green:        #22c55e;
  --red:          #ef4444;
}

[data-theme="dark"] .flash-success { background: #052e16; color: #86efac; border-color: #166534; }
[data-theme="dark"] .flash-error   { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
[data-theme="dark"] .badge-remote  { background: #0c4a6e; color: #7dd3fc; }
[data-theme="dark"] .badge-inactive { background: #2d3147; }
[data-theme="dark"] .btn-delete    { border-color: #7f1d1d; background: var(--card); }
[data-theme="dark"] .btn-edit      { background: var(--card); }
[data-theme="dark"] .btn-apply-email { background: var(--card); }
[data-theme="dark"] .tag           { background: var(--accent-light); }
[data-theme="dark"] .job-apply     { background: var(--accent-light); }
[data-theme="dark"] .about-cta     { background: var(--accent-light); }

/* Theme toggle button */
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  padding: 0.15rem 0.1rem;
  color: var(--text);
  line-height: 1;
  display: flex;
  align-items: center;
}

.theme-icon-dark               { display: none; }
.theme-icon-light              { display: inline; }
[data-theme="dark"] .theme-icon-dark  { display: inline; }
[data-theme="dark"] .theme-icon-light { display: none; }
