/* ============================================
   JobTracker — CSS DESIGN SYSTEM
   Aesthetic: Industrial-Editorial / Dark Luxe
============================================ */

:root {
  --bg:          #0d0f14;
  --surface:     #13161e;
  --surface2:    #1a1e29;
  --border:      #252a38;
  --text:        #e8eaf0;
  --muted:       #636b85;
  --accent:      #e8c547;
  --accent-dim:  #e8c54722;
  --accent2:     #5b8dee;
  --green:       #3ecf8e;
  --red:         #f06060;
  --orange:      #f0904a;

  --sidebar-w:   240px;
  --radius:      10px;
  --radius-sm:   6px;
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --transition:   0.18s ease;
}

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

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============================================
   SIDEBAR
============================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 16px;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.logo-icon {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.5px;
  color: var(--text);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.93rem;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  width: 100%;
}

.nav-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.nav-icon {
  font-size: 1rem;
  width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.api-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  transition: background var(--transition);
}

.status-dot.connected { background: var(--green); box-shadow: 0 0 6px var(--green); }

.status-text {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ============================================
   MAIN CONTENT AREA
============================================ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 40px 44px;
  min-height: 100vh;
  max-width: 1100px;
}

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.22s ease; }

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

/* ── VIEW HEADER ── */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 36px;
  gap: 16px;
}

.view-header h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ============================================
   BUTTONS
============================================ */
.btn-primary {
  background: var(--accent);
  color: #0d0f14;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.3px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover { background: #f0d060; transform: translateY(-1px); box-shadow: 0 4px 20px #e8c54744; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-danger {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-danger:hover { background: var(--red); color: #fff; }

/* ============================================
   DASHBOARD STATS
============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.stat-card:hover::before { transform: scaleX(1); }
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.stat-num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--text);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.stat-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.interview-fill { background: var(--accent2); }
.offer-fill { background: var(--green); }
.rejected-fill { background: var(--red); }

/* ============================================
   JOB LIST / CARDS
============================================ */
.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.job-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  cursor: pointer;
  animation: cardIn 0.2s ease;
}

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

.job-card:hover { border-color: var(--accent); background: var(--surface2); }

.job-info { display: flex; flex-direction: column; gap: 4px; }

.job-company {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.job-role {
  font-size: 0.88rem;
  color: var(--muted);
}

.job-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.job-date, .job-location {
  font-size: 0.78rem;
  color: var(--muted);
}

.job-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-Applied  { background: #5b8dee22; color: var(--accent2); border: 1px solid #5b8dee44; }
.badge-Interview { background: #e8c54722; color: var(--accent); border: 1px solid #e8c54744; }
.badge-Offer    { background: #3ecf8e22; color: var(--green);  border: 1px solid #3ecf8e44; }
.badge-Rejected { background: #f0606022; color: var(--red);    border: 1px solid #f0606044; }

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all var(--transition);
}

.action-btn:hover.edit-btn { color: var(--accent); background: var(--accent-dim); }
.action-btn:hover.del-btn  { color: var(--red); background: #f0606015; }

/* ============================================
   FILTER + SEARCH
============================================ */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn.active, .filter-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.search-bar {
  margin-bottom: 20px;
}

.search-bar input {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: var(--font-body);
  transition: border-color var(--transition);
  outline: none;
}

.search-bar input:focus { border-color: var(--accent); }

/* ============================================
   COVER LETTER
============================================ */
.cover-letter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  min-height: 520px;
}

.cl-form-panel, .cl-output-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.panel-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.btn-generate {
  margin-top: 8px;
  width: 100%;
  justify-content: center;
  padding: 13px;
  font-size: 0.95rem;
}

.cl-output-panel {
  position: relative;
}

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

.output-actions { display: flex; gap: 8px; }

.output-body {
  flex: 1;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.cl-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--muted);
  gap: 12px;
}

.placeholder-icon { font-size: 2.5rem; color: var(--border); }
.placeholder-note { font-size: 0.78rem; opacity: 0.6; margin-top: 4px; }

/* ============================================
   SETTINGS
============================================ */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-section {
  padding: 28px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-section:last-child { border-bottom: none; }

.settings-section h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.settings-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}

.api-key-row {
  display: flex;
  gap: 10px;
}

.api-key-row input {
  flex: 1;
}

.api-key-note {
  font-size: 0.8rem;
  color: var(--muted);
}

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

.danger-zone h3 { color: var(--red); }

/* ============================================
   FORMS (shared)
============================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group:last-child { margin-bottom: 0; }

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-group input,
.form-group textarea,
.form-group select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23636b85' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ============================================
   MODAL
============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
}

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

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

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all var(--transition);
}

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

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--border);
}

/* ============================================
   EMPTY STATE
============================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 14px;
  color: var(--border);
}

.empty-state p {
  font-size: 0.9rem;
  line-height: 1.7;
}

.empty-state strong { color: var(--text); }

/* ============================================
   SPINNER
============================================ */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid #0d0f1444;
  border-top-color: #0d0f14;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.hidden { display: none !important; }

/* ============================================
   TOAST
============================================ */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 9999;
  animation: toastIn 0.2s ease;
}

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

.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red);   color: var(--red); }

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 900px) {
  .cover-letter-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .sidebar { width: 60px; padding: 20px 8px; }
  .logo-text, .nav-btn span:not(.nav-icon), .sidebar-footer .status-text { display: none; }
  .main { margin-left: 60px; padding: 24px 18px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

/* ===== AUTH SCREEN (added for backend integration) ===== */
#authScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
}
.auth-card .logo {
  justify-content: center;
  margin-bottom: 24px;
}
.auth-toggle-text {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-dim, #999);
}
.auth-toggle-text a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}
.auth-error {
  color: var(--red, #e05555);
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}
.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
