/* JobPlix Dark Theme & Overleaf Philosophy */
:root {
  --background: #1c1f26;
  --foreground: #f1f3f7;
  --card: #242832;
  --card-foreground: #f1f3f7;
  --popover: #262b36;
  --popover-foreground: #f1f3f7;
  --primary: #3b82f6;
  --primary-foreground: #ffffff;
  --secondary: #313642;
  --secondary-foreground: #f1f3f7;
  --muted: #2e333e;
  --muted-foreground: #a4abb8;
  --accent: #333845;
  --accent-foreground: #f1f3f7;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --border: #353b47;
  --border-focus: #3b82f6;
  --input: #353b47;
  --ring: #3b82f6;
  --radius: 0.5rem;

  --sidebar-background: #1f222a;
  --sidebar-foreground: #b4bac6;
  --sidebar-primary: #3b82f6;
  --sidebar-border: #313642;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  height: 100vh;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Sidebar */
aside.app-sidebar {
  width: 256px;
  background-color: var(--sidebar-background);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 40;
}

.brand-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-logo-box {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #ffffff;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
}

.brand-logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text-col {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  color: var(--muted-foreground);
}

.sidebar-action-box {
  padding: 12px;
}

.btn-tailor-cta {
  width: 100%;
  height: 36px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn-tailor-cta:hover {
  background: #2563eb;
}

.nav-list {
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--sidebar-foreground);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.12s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--foreground);
}

.nav-link.active {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-weight: 600;
}

.nav-link svg {
  width: 16px;
  height: 16px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.system-status-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted-foreground);
}

.status-dot-green {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

/* Main Area */
main.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--background);
}

header.app-topbar {
  height: 52px;
  background-color: #21252d;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.breadcrumbs {
  font-size: 13px;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumbs strong {
  color: var(--foreground);
  font-weight: 600;
}

.view-panel {
  flex-grow: 1;
  display: none;
  overflow: hidden;
}

.view-panel.active {
  display: flex;
  flex-direction: column;
}

/* Dual Pane Layout */
.overleaf-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex-grow: 1;
  height: calc(100vh - 52px);
  overflow: hidden;
}

.pane-code, .pane-preview {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.pane-code {
  border-right: 1px solid var(--border);
  background: #181a20;
}

.pane-preview {
  background: #14161b;
}

.pane-header {
  height: 44px;
  padding: 0 14px;
  background: #242832;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-tag {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--foreground);
}

.btn-overleaf-green {
  background: #10b981;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-overleaf-green:hover {
  background: #059669;
}

.btn-toolbar {
  background: #2c313d;
  color: var(--foreground);
  border: 1px solid var(--border);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-toolbar:hover {
  background: #353b47;
}

.btn-primary-sm {
  background: var(--primary);
  color: #ffffff;
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-primary-sm:hover {
  background: #2563eb;
}

/* Editor */
.editor-body {
  flex-grow: 1;
  position: relative;
  overflow: hidden;
}

.latex-textarea {
  width: 100%;
  height: 100%;
  background: #181a20;
  color: #e2e8f0;
  border: none;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
  white-space: pre;
  tab-size: 2;
}

/* Overleaf PDF Subheader Bar */
.pdf-control-bar {
  height: 38px;
  background: #1e222b;
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted-foreground);
}

.pdf-frame-wrapper {
  flex-grow: 1;
  width: 100%;
  height: 100%;
  background: #0f1115;
  overflow: hidden;
}

.pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
}

/* Scrollable page views */
.page-container {
  padding: 24px 32px;
  overflow-y: auto;
  flex-grow: 1;
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--foreground);
}

.page-desc {
  font-size: 13px;
  color: var(--muted-foreground);
  margin-top: 2px;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}

.stat-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--foreground);
  margin-top: 4px;
}

/* Table */
.card-table {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.table-custom {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table-custom th {
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
}

.table-custom td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
  vertical-align: middle;
}

.table-custom tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge-custom {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

/* Tabs for Tailor */
.tab-row {
  display: flex;
  gap: 8px;
  background: #1e222b;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab-pill {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.tab-pill.active {
  background: #2a303c;
  color: var(--foreground);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Forms */
.form-field {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 6px;
}

.input-custom, .select-custom, .textarea-custom {
  width: 100%;
  background: #1e222b;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--foreground);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.input-custom:focus, .select-custom:focus, .textarea-custom:focus {
  border-color: var(--primary);
}

.textarea-custom {
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 600px;
  background: #1e222b;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--foreground);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted-foreground);
  font-size: 18px;
  cursor: pointer;
}
