/* job.technology — custom styles, loaded after Tailwind CDN */

/* --------------------------------------------------------------------------
   Fonts
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  --color-accent:  #1A56DB;
  --color-accent-hover: #1648c0;
  --color-accent-light: #e8f0fd;
  --color-dark:    #111111;
  --color-muted:   #6b7280;
  --color-border:  #e5e7eb;
  --color-surface: #ffffff;
  --color-bg:      #f9fafb;

  --font-base: 'DM Sans', system-ui, -apple-system, sans-serif;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  --shadow-card: 0 1px 4px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 4px 12px 0 rgba(0, 0, 0, 0.10);
}

/* Dark mode variable overrides — toggled by .dark on <html> */
html.dark {
  --color-bg:           #111318;
  --color-surface:      #1c1f26;
  --color-border:       #2e3340;
  --color-dark:         #e8eaf0;
  --color-muted:        #8b92a5;
  --color-accent:       #4d7ee8;
  --color-accent-hover: #3d6dd4;
  --color-accent-light: #1a2540;
  --shadow-card:        0 1px 4px 0 rgba(0, 0, 0, 0.30), 0 1px 2px -1px rgba(0, 0, 0, 0.24);
  --shadow-card-hover:  0 4px 12px 0 rgba(0, 0, 0, 0.40);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
html {
  font-family: var(--font-base);
  color: var(--color-dark);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-base);
  font-size: 1rem;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background-color: var(--color-accent);
  color: #fff;
  font-weight: 500;
  font-family: var(--font-base);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-accent);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  line-height: 1.5;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background-color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #fff;
  text-decoration: none;
}

.btn-primary:disabled,
.btn-primary[aria-busy="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background-color: var(--color-surface);
  color: var(--color-dark);
  font-weight: 500;
  font-family: var(--font-base);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  line-height: 1.5;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background-color: var(--color-accent-light);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

/* --------------------------------------------------------------------------
   Form inputs — custom focus ring in accent color
   -------------------------------------------------------------------------- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="search"],
select,
textarea {
  font-family: var(--font-base);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  width: 100%;
  background-color: var(--color-surface);
  color: var(--color-dark);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.375rem;
  font-size: 0.9rem;
  color: var(--color-dark);
}

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

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

/* File input styling */
input[type="file"] {
  padding: 0.375rem;
  font-family: var(--font-base);
}

/* --------------------------------------------------------------------------
   AI tool output
   -------------------------------------------------------------------------- */
.ai-output {
  background-color: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
}

.ai-output pre {
  font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  color: var(--color-dark);
  line-height: 1.7;
}

.ai-output-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

/* --------------------------------------------------------------------------
   FAQ — native details/summary accordion
   (No JS needed — uses browser-native disclosure widget)
   -------------------------------------------------------------------------- */
details.faq-item {
  border-bottom: 1px solid var(--color-border);
}

details.faq-item:first-of-type {
  border-top: 1px solid var(--color-border);
}

details.faq-item summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  cursor: pointer;
  font-weight: 500;
  font-size: 1rem;
  color: var(--color-dark);
  user-select: none;
}

details.faq-item summary::-webkit-details-marker {
  display: none;
}

details.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-muted);
  flex-shrink: 0;
  margin-left: 1rem;
  transition: transform 0.2s ease;
}

details.faq-item[open] summary::after {
  content: '\2212'; /* minus sign */
}

details.faq-item .faq-body {
  padding-bottom: 1rem;
  color: #374151;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   Tables — admin striped tables
   -------------------------------------------------------------------------- */
.table-admin {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table-admin thead tr {
  background-color: #f3f4f6;
  border-bottom: 2px solid var(--color-border);
}

.table-admin thead th {
  padding: 0.6rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.table-admin tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.1s ease;
}

.table-admin tbody tr:nth-child(even) {
  background-color: #fafafa;
}

.table-admin tbody tr:hover {
  background-color: var(--color-accent-light);
}

.table-admin tbody td {
  padding: 0.65rem 1rem;
  vertical-align: middle;
  color: #374151;
}

/* --------------------------------------------------------------------------
   Navigation utilities
   -------------------------------------------------------------------------- */
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #374151;
  font-weight: 500;
  text-decoration: none;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background-color 0.15s ease;
}

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

.nav-link.active {
  color: var(--color-accent);
}

/* Sidebar nav */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  color: #374151;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
  background-color: var(--color-accent-light);
  color: var(--color-accent);
}

.sidebar-link.active {
  background-color: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Mobile nav
   -------------------------------------------------------------------------- */
#mobile-menu {
  display: none;
}

#mobile-menu.open {
  display: block;
}

/* --------------------------------------------------------------------------
   Flash / alert messages
   -------------------------------------------------------------------------- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert-success {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.alert-danger {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert-warning {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.alert-info {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

/* --------------------------------------------------------------------------
   Loading spinner
   -------------------------------------------------------------------------- */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.spinner-dark {
  border-color: rgba(26, 86, 219, 0.2);
  border-top-color: var(--color-accent);
}

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

/* --------------------------------------------------------------------------
   Badge / status pills
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-green  { background-color: #dcfce7; color: #15803d; }
.badge-red    { background-color: #fee2e2; color: #b91c1c; }
.badge-yellow { background-color: #fef9c3; color: #854d0e; }
.badge-blue   { background-color: #dbeafe; color: #1d4ed8; }
.badge-gray   { background-color: #f3f4f6; color: #4b5563; }

/* --------------------------------------------------------------------------
   Character counter
   -------------------------------------------------------------------------- */
.char-counter {
  font-size: 0.78rem;
  color: var(--color-muted);
  text-align: right;
  margin-top: 0.2rem;
}

.char-counter.near-limit { color: #d97706; }
.char-counter.at-limit   { color: #dc2626; }

/* --------------------------------------------------------------------------
   Subscription plan cards
   -------------------------------------------------------------------------- */
.plan-card {
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  background: var(--color-surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.plan-card.featured {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.08);
}

.plan-card:hover {
  box-shadow: var(--shadow-card-hover);
}

/* --------------------------------------------------------------------------
   Misc utilities
   -------------------------------------------------------------------------- */
.text-accent { color: var(--color-accent); }
.bg-accent   { background-color: var(--color-accent); }

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.5rem 0;
}

/* Responsive table wrapper */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* --------------------------------------------------------------------------
   Collapsible sidebar
   -------------------------------------------------------------------------- */
.sidebar-collapse-btn {
  position: absolute;
  top: 12px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, background-color 0.15s ease;
  z-index: 10;
}

.sidebar-collapse-btn:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.08);
}

.sidebar-collapse-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

/* Sidebar transition */
aside[data-sidebar] {
  transition: width 0.2s ease;
}

/* Collapsed state — applied when body has .sidebar-collapsed */
body.sidebar-collapsed aside[data-sidebar] {
  width: 56px !important;
}

body.sidebar-collapsed aside[data-sidebar] .sidebar-collapse-btn {
  right: 50%;
  transform: translateX(50%);
}

body.sidebar-collapsed aside[data-sidebar] .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

body.sidebar-collapsed aside[data-sidebar] nav {
  padding-left: 6px;
  padding-right: 6px;
}

body.sidebar-collapsed aside[data-sidebar] nav a {
  font-size: 0;
  line-height: 0;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
  overflow: hidden;
}

body.sidebar-collapsed aside[data-sidebar] nav a svg,
body.sidebar-collapsed aside[data-sidebar] nav a .sidebar-letter-icon {
  font-size: 0.7rem;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* The injected `.sidebar-letter-icon` span carries an inline
   `display: none` so it never flashes into view outside the
   collapsed state. Override it here only when the sidebar is
   actually collapsed. !important is required because inline
   styles beat stylesheet rules by default. */
body.sidebar-collapsed aside[data-sidebar] nav a .sidebar-letter-icon {
  display: inline-flex !important;
}

body.sidebar-collapsed aside[data-sidebar] nav a span:not(.sidebar-letter-icon) {
  display: none;
}

/* Hide the profile name / bottom link text */
body.sidebar-collapsed aside[data-sidebar] [data-sidebar-bottom] {
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
}

body.sidebar-collapsed aside[data-sidebar] [data-sidebar-bottom] a {
  font-size: 0;
  line-height: 0;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
}

/* Keep the avatar / icon visible */
body.sidebar-collapsed aside[data-sidebar] [data-sidebar-bottom] a div,
body.sidebar-collapsed aside[data-sidebar] [data-sidebar-bottom] a svg {
  font-size: 0.75rem;
}

body.sidebar-collapsed aside[data-sidebar] [data-sidebar-bottom] a span {
  display: none;
}

/* Admin panel label */
body.sidebar-collapsed aside[data-sidebar] [data-sidebar-heading] {
  display: none;
}


/* Badge in collapsed mode stays visible */
body.sidebar-collapsed aside[data-sidebar] nav a .ml-auto {
  display: none;
}

/* Main content margin shift */
body.sidebar-collapsed .sidebar-main-content {
  margin-left: 56px !important;
}

/* Footer margin shift */
footer.sidebar-footer-offset {
  transition: margin-left 0.2s ease;
}

body.sidebar-collapsed footer.sidebar-footer-offset {
  margin-left: 56px !important;
}

/* --------------------------------------------------------------------------
   reCAPTCHA — hide floating badge (attribution text shown inline per policy)
   -------------------------------------------------------------------------- */
.grecaptcha-badge { visibility: hidden; }

/* Only apply collapse on lg+ screens */
@media (max-width: 1023px) {
  body.sidebar-collapsed aside[data-sidebar] {
    width: revert !important;
  }
  body.sidebar-collapsed .sidebar-main-content {
    margin-left: revert !important;
  }
  body.sidebar-collapsed footer.sidebar-footer-offset {
    margin-left: revert !important;
  }
  .sidebar-collapse-btn {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Dark mode component overrides
   -------------------------------------------------------------------------- */

/* FAQ answer body */
html.dark details.faq-item .faq-body {
  color: #a0a8b8;
}

/* Alert variants */
html.dark .alert-success {
  background-color: #0d2218;
  border-color: #1a4a30;
  color: #6ee7a0;
}
html.dark .alert-danger {
  background-color: #2a1010;
  border-color: #5c2020;
  color: #f87171;
}
html.dark .alert-warning {
  background-color: #271d06;
  border-color: #5c4209;
  color: #fbbf24;
}
html.dark .alert-info {
  background-color: #0f1d3a;
  border-color: #1e3a6e;
  color: #93c5fd;
}

/* Badge variants */
html.dark .badge-green  { background-color: #0d2218; color: #6ee7a0; }
html.dark .badge-red    { background-color: #2a1010; color: #f87171; }
html.dark .badge-yellow { background-color: #271d06; color: #fbbf24; }
html.dark .badge-blue   { background-color: #0f1d3a; color: #93c5fd; }
html.dark .badge-gray   { background-color: #232730; color: #9ca3af; }

/* Admin table */
html.dark .table-admin thead tr {
  background-color: #181c24;
  border-bottom-color: #2e3340;
}
html.dark .table-admin thead th { color: #9ca3af; }
html.dark .table-admin tbody tr { border-bottom-color: #2e3340; }
html.dark .table-admin tbody tr:nth-child(even) { background-color: #161920; }
html.dark .table-admin tbody tr:hover { background-color: #1a2540; }
html.dark .table-admin tbody td { color: #b0b8cc; }

/* Nav link */
html.dark .nav-link { color: #b0b8cc; }

/* Sidebar nav links (dark sidebars stay dark — only light pages use these) */
html.dark .sidebar-link { color: #b0b8cc; }
html.dark .sidebar-link:hover { background-color: #1a2540; color: #93c5fd; }
html.dark .sidebar-link.active { background-color: #1a2540; color: #93c5fd; }

/* AI output block */
html.dark .ai-output { background-color: #161920; }

/* --------------------------------------------------------------------------
   AI tool prose output — applied to #output-area by _ai_stream.html after
   the stream completes (renderMarkdownLite). Gives every AI tool's panel
   proper markdown rendering (headings / lists / bold / hr) without each
   template having to define its own typography.
   -------------------------------------------------------------------------- */
.ai-prose h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111111;
  margin-top: 0;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #d1d5db;
}
.ai-prose h2 {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.25rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}
.ai-prose h2:first-child { margin-top: 0; }
.ai-prose h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #374151;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}
.ai-prose p { margin-bottom: 0.5rem; }
.ai-prose ul { list-style-type: disc; padding-left: 1.5rem; margin-bottom: 0.75rem; }
.ai-prose ol { list-style-type: decimal; padding-left: 1.5rem; margin-bottom: 0.75rem; }
/* Slightly wider gap between list items — AI outputs frequently produce
   paragraph-length items where 0.2rem reads cramped. */
.ai-prose li { margin-bottom: 0.5rem; }
.ai-prose li:last-child { margin-bottom: 0; }
.ai-prose strong { font-weight: 600; }
.ai-prose hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1rem 0;
}
.ai-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}
.ai-prose th, .ai-prose td {
  border: 1px solid #d1d5db;
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.ai-prose th {
  background-color: #f3f4f6;
  font-weight: 600;
  color: #374151;
}
.ai-prose td { color: inherit; }

html.dark .ai-prose h1 { color: #f3f4f6; border-bottom-color: #374151; }
html.dark .ai-prose h2 { color: #d1d5db; border-bottom-color: #374151; }
html.dark .ai-prose h3 { color: #d1d5db; }
html.dark .ai-prose hr { border-top-color: #374151; }
html.dark .ai-prose th { background-color: #1f2937; color: #d1d5db; border-color: #374151; }
html.dark .ai-prose td { border-color: #374151; }

/* --------------------------------------------------------------------------
   Dark mode — global Tailwind color class overrides
   Catches hardcoded text-gray-* / bg-* / border-* classes that don't have
   explicit dark: variants in templates.
   -------------------------------------------------------------------------- */

/* Text — !important ensures these beat Tailwind CDN's dynamically injected styles */
html.dark .text-gray-900 { color: #f3f4f6 !important; }
html.dark .text-gray-800 { color: #e5e7eb !important; }
html.dark .text-gray-700 { color: #d1d5db !important; }
html.dark .text-gray-600 { color: #9ca3af !important; }
html.dark .text-gray-500 { color: #6b7280 !important; }
html.dark .text-black    { color: #f3f4f6 !important; }
html.dark .text-dark     { color: var(--color-dark) !important; } /* custom Tailwind color #111111 */

/* Backgrounds */
html.dark .bg-white   { background-color: #1c1f26 !important; }
html.dark .bg-gray-50 { background-color: #161920 !important; }
html.dark .bg-gray-100 { background-color: #1e2128 !important; }
html.dark .bg-gray-200 { background-color: #252933 !important; }
/* bg-dark / border-dark must stay near-black in BOTH modes (they're
   the brand "dark feature card" surface, not page text). The :root
   --color-dark above is intentionally flipped in dark mode for text
   color, so without these overrides the v4 build emits
   .bg-dark { background-color: var(--color-dark) } which inherits
   the flipped value and renders the cards as light gray in dark mode. */
html.dark .bg-dark     { background-color: #111 !important; }
html.dark .hover\:bg-dark:hover { background-color: #111 !important; }

/* Borders */
html.dark .border-gray-100 { border-color: #2e3340 !important; }
html.dark .border-gray-200 { border-color: #2e3340 !important; }
html.dark .border-gray-300 { border-color: #3d4455 !important; }
html.dark .border-dark     { border-color: #111 !important; }

/* Divide utilities */
html.dark .divide-gray-100 > * + * { border-color: #2e3340 !important; }
html.dark .divide-gray-200 > * + * { border-color: #2e3340 !important; }

/* Exceptions: sidebar (bg-gray-900) and footer are intentionally dark — restore their text */
html.dark aside .text-gray-900,
html.dark aside .text-gray-800,
html.dark aside .text-gray-700 { color: inherit !important; }

html.dark aside .bg-white,
html.dark aside .bg-gray-50,
html.dark aside .bg-gray-100 { background-color: inherit !important; }

html.dark footer .text-gray-900,
html.dark footer .text-gray-800 { color: inherit !important; }

html.dark footer .bg-white,
html.dark footer .bg-gray-50 { background-color: inherit !important; }
