:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --secondary: #64748b;
  --bg-gradient: linear-gradient(135deg, #f0f6ff 0%, #f8fafc 50%, #eef2ff 100%);
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 35px -10px rgba(15, 23, 42, 0.12);
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.app-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  font-size: 28px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-top: 2px;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--surface-subtle);
  border-color: var(--text-light);
}

.btn-github {
  background: #24292f;
  color: white;
}

.btn-github:hover {
  background: #000000;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Main Content Layout */
.main-content {
  padding: 32px 24px 60px;
  flex: 1;
}

.grid {
  display: grid;
  gap: 24px;
}

.grid-2-col {
  grid-template-columns: 1fr 1fr;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-icon {
  font-size: 24px;
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.card-body {
  padding: 24px;
  flex: 1;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Form Controls */
.form-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.label-hint {
  font-weight: normal;
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 4px;
}

.form-textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-main);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-textarea:focus, .form-input:focus, .select-preset:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.select-preset {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 13px;
  background: white;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.divider span {
  padding: 0 10px;
}

/* File Upload Drag & Drop Boxes */
.file-upload-box {
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  background: var(--surface-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.file-upload-box:hover, .file-upload-box.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.file-upload-box input[type="file"] {
  display: none;
}

.upload-box-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.upload-icon {
  font-size: 28px;
}

.upload-main-text {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
}

.upload-sub-text {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.selected-file-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 12px;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
}

/* Skills Preset Tags */
.skills-preset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.preset-tag {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.preset-tag:hover {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.preset-tag.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Uploaded Files List */
.file-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.file-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  color: var(--text-light);
  font-size: 11px;
}

.file-remove-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
}

.file-remove-btn:hover {
  background: var(--danger-bg);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.action-buttons .btn-primary {
  flex: 1;
}

.mt-4 {
  margin-top: 24px;
}

/* Status Banner */
.status-banner {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
  animation: slideDown 0.3s ease;
}

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

.status-banner.success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #065f46;
}

.status-banner.error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #991b1b;
}

.status-banner.info {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: #1e40af;
}

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

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.metric-icon {
  font-size: 32px;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

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

/* Chart Container */
.chart-container {
  padding: 24px;
  position: relative;
}

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

/* Table */
.table-responsive {
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.results-table th {
  background: var(--surface-subtle);
  padding: 14px 16px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}

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

.results-table tr:hover {
  background: #f8fafc;
}

/* Ranking Badges */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 14px;
}

.rank-1 {
  background: #fef3c7;
  color: #b45309;
  border: 2px solid #fde68a;
}

.rank-2 {
  background: #f1f5f9;
  color: #475569;
  border: 2px solid #cbd5e1;
}

.rank-3 {
  background: #ffedd5;
  color: #c2410c;
  border: 2px solid #fed7aa;
}

.rank-other {
  background: #f8fafc;
  color: var(--text-light);
  border: 1px solid var(--border);
}

/* Progress bar inside table */
.score-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}

.score-pill-high {
  background: #dcfce7;
  color: #15803d;
}

.score-pill-mid {
  background: #fef3c7;
  color: #b45309;
}

.score-pill-low {
  background: #fee2e2;
  color: #b91c1c;
}

/* Skill Chips */
.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
}

.chip-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.chip-missing {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid var(--border);
  text-decoration: line-through;
}

/* Info Section */
.info-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.info-block {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.info-block h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.info-block p {
  font-size: 13px;
  color: var(--text-muted);
}

.info-block code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #e11d48;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 750px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

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

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}

.resume-preview-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: monospace;
  font-size: 13px;
  max-height: 400px;
  overflow-y: auto;
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border);
  background: white;
  padding: 24px 0;
  margin-top: auto;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 10px;
  align-items: center;
}

.footer-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 900px) {
  .grid-2-col {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .info-grid {
    grid-template-columns: 1fr;
  }
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 600px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .action-buttons {
    flex-direction: column;
  }
  .footer-content {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}
