/* ========================================
   ApplyIQ — App (Dashboard) Styles
   ======================================== */

/* --- App Layout --- */
.app-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

.app-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.app-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 900;
  color: var(--fg);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.app-sub {
  font-size: 1rem;
  color: var(--fg-muted);
}

/* --- Tab Bar --- */
.tab-bar {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fg-muted);
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
  color: var(--fg);
}

.tab-btn.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.tab-btn svg {
  flex-shrink: 0;
}

/* --- Panel & Card --- */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.panel-header {
  margin-bottom: 1.75rem;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

.panel-desc {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

/* --- Forms --- */
.app-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.form-row--2 { grid-template-columns: 1fr 1fr; }
.form-row--3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
}

.label-hint {
  font-weight: 400;
  color: var(--fg-muted);
}

.form-textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--fg);
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.6;
}

.form-textarea::placeholder {
  color: var(--fg-muted);
  opacity: 0.6;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* --- Buttons --- */
.form-actions {
  display: flex;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

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

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-copy {
  padding: 0.35rem 0.9rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-alt);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  transition: background 0.2s, color 0.2s;
}

.btn-copy:hover {
  background: var(--accent-light);
  color: var(--accent-dark);
}

/* --- Results Box --- */
.results-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

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

.results-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
}

.results-content {
  padding: 1.25rem;
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.75;
  white-space: pre-wrap;
}

/* --- Error Box --- */
.error-box {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  color: #991B1B;
}

/* --- Spinner --- */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(26,26,46,0.2);
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* --- Nav badges --- */
.nav-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  background: var(--accent);
  color: var(--fg);
}

/* --- Application Tracker --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}

.stat-count {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card--applied { border-top: 3px solid #6366F1; }
.stat-card--interview { border-top: 3px solid #F59E0B; }
.stat-card--offer { border-top: 3px solid #10B981; }
.stat-card--rejected { border-top: 3px solid #EF4444; }

/* --- App List --- */
.app-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.app-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.2s;
}

.app-item:hover { border-color: var(--fg-muted); }

.app-item-left { flex: 1; min-width: 0; }

.app-item-company {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-item-title {
  font-size: 0.85rem;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-item-meta {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.2rem;
}

.app-item-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

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

.status-badge--applied { background: #EEF2FF; color: #4338CA; }
.status-badge--interview { background: #FEF3C7; color: #92400E; }
.status-badge--offer { background: #D1FAE5; color: #065F46; }
.status-badge--rejected { background: #FEE2E2; color: #991B1B; }

/* --- Status Selector --- */
.status-select {
  padding: 0.35rem 0.6rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg);
  cursor: pointer;
}

.status-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* --- Delete button --- */
.btn-delete {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--fg-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.btn-delete:hover {
  background: #FEE2E2;
  color: #991B1B;
}

/* --- Application link --- */
.app-link {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

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

/* --- form inputs (shared with existing textarea styles) --- */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--fg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input::placeholder { color: var(--fg-muted); opacity: 0.6; }
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* --- Download Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2.5rem 2rem 2rem;
  max-width: 440px;
  width: 100%;
  position: relative;
  box-shadow: 0 24px 60px rgba(26, 26, 46, 0.18);
  animation: modal-in 0.25s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg);
  color: var(--fg-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
  background: var(--bg-alt);
  color: var(--fg);
}

.modal-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--fg);
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 1.25rem;
}

.modal-headline {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--fg);
  line-height: 1.15;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.modal-sub {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

.modal-form-group { margin-bottom: 1rem; }

.modal-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--fg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-input::placeholder { color: var(--fg-muted); opacity: 0.6; }
.modal-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.modal-cta-primary {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: var(--fg);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.modal-cta-primary:hover { background: #2a2a4e; }
.modal-cta-primary:active { transform: scale(0.98); }
.modal-cta-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.modal-err {
  font-size: 0.85rem;
  color: #991B1B;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin-top: 0.75rem;
}

.modal-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
  color: var(--fg-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.modal-pro-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1.5rem;
}

.modal-pro-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.modal-pro-icon {
  width: 24px;
  height: 24px;
  background: var(--accent-light);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.modal-skip {
  display: block;
  width: 100%;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s;
  text-align: center;
}

.modal-skip:hover { color: var(--fg); }

/* --- Download button in results --- */
.results-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-copy--download {
  background: var(--accent-light);
  color: var(--accent-dark);
  border-color: var(--accent);
}

.btn-copy--download:hover {
  background: var(--accent);
  color: var(--fg);
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .app-main {
    padding: 1.5rem 1rem 3rem;
  }

  .panel-card {
    padding: 1.5rem;
  }
}