/* ============================================
   CV Parser MVP - Design System
   Premium, Modern, Professional
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800&family=Geist+Mono:wght@400;500;700&display=swap');

:root {
  /* Color Palette - Refined & Professional */
  --primary: #0f62fe;
  --primary-light: #6fa6ff;
  --primary-dark: #0043ce;
  --primary-faint: #eef4ff;
  
  --secondary: #161616;
  --secondary-light: #393939;
  --secondary-lighter: #525252;
  
  --accent: #24a148;
  --accent-light: #42be65;
  --accent-faint: #dffcf0;
  
  --danger: #da1e28;
  --danger-light: #ff8389;
  --danger-faint: #fee5e6;
  
  --warning: #f1c21b;
  --warning-faint: #fffacd;
  
  --bg-primary: #ffffff;
  --bg-secondary: #f4f4f4;
  --bg-tertiary: #e8e8e8;
  
  --text-primary: #161616;
  --text-secondary: #525252;
  --text-tertiary: #8d8d8d;
  --text-inverse: #ffffff;
  
  --border: #e0e0e0;
  --border-subtle: #f1f1f1;
  
  --shadow-xs: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 4px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.16);
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 24px;
  font-weight: 700;
}

h3 {
  font-size: 18px;
  font-weight: 700;
}

h4 {
  font-size: 16px;
  font-weight: 600;
}

p {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 14px;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
  position: relative;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

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

.text-small {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Layout */
.wrap {
  width: min(1200px, 100% - 40px);
  margin: 40px auto;
}

.brand-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.brand-logo {
  height: 34px;
  width: auto;
  display: block;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

/* Card Component */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.card:hover {
  border-color: #d0d0d0;
  box-shadow: var(--shadow-md);
}

.card-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-header h1,
.card-header h2 {
  margin-bottom: 4px;
}

.card-header p {
  margin: 0;
  font-size: 13px;
}

/* Session info */
.session-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--primary-faint);
  border-radius: var(--radius-lg);
  border: 1px solid #d0e0ff;
}

.session-info strong {
  color: var(--primary-dark);
  font-weight: 600;
}

/* Forms */
label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 13px;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
}

input[type="file"] {
  padding: 12px;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Buttons */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  margin: 0;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--primary);
  color: var(--text-inverse);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

button:hover,
.btn:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

button:active,
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button:disabled,
.btn:disabled {
  background: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #d8d8d8;
  border-color: var(--border);
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #ae1a1f;
  box-shadow: var(--shadow-md);
}

.btn-success {
  background: var(--accent);
}

.btn-success:hover {
  background: #18783b;
}

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

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

.row-between {
  justify-content: space-between;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  position: relative;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Flash Messages */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn var(--transition-base);
}

.flash.success {
  background: var(--accent-faint);
  color: #0a6838;
  border: 1px solid #a7d8b8;
}

.flash.error {
  background: var(--danger-faint);
  color: #ae1a1f;
  border: 1px solid #ffb3b6;
}

.flash.warning {
  background: var(--warning-faint);
  color: #b8860b;
  border: 1px solid #ffe680;
}

.flash.info {
  background: var(--primary-faint);
  color: var(--primary-dark);
  border: 1px solid #a6c5ff;
}

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 13px;
}

th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 700;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color var(--transition-fast);
}

tbody tr:hover {
  background: var(--bg-secondary);
}

/* Code / Pre */
pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 16px;
  border-radius: var(--radius-lg);
  overflow: auto;
  font-family: 'Geist Mono', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 16px;
}

code {
  font-family: 'Geist Mono', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  background: var(--bg-secondary);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  word-break: break-word;
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* Tags */
.tag {
  display: inline-block;
  padding: 4px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  background: var(--primary-faint);
  color: var(--primary-dark);
  border: 1px solid #a6c5ff;
  font-size: 12px;
  font-weight: 500;
}

.tag.secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-color: var(--border);
}

.tag.success {
  background: var(--accent-faint);
  color: #0a6838;
  border-color: #a7d8b8;
}

.tag.danger {
  background: var(--danger-faint);
  color: #ae1a1f;
  border-color: #ffb3b6;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(2px);
  animation: fadeIn var(--transition-base);
}

.overlay.show {
  display: flex;
}

/* Loader */
.loader-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-xl);
  min-width: 320px;
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

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

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
  animation: fadeIn var(--transition-base);
}

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

.modal {
  width: min(600px, 90vw);
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 28px;
  border: 1px solid var(--border);
  animation: slideUp var(--transition-base);
}

.modal h3 {
  margin-bottom: 8px;
}

.modal p {
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* Info Grid */
.info-modal-content {
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--bg-secondary);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.info-box {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
}

.info-box strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

/* Toast */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 1001;
  font-size: 13px;
  max-width: 400px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Utility Classes */
.error {
  color: var(--danger);
  font-weight: 600;
}

.success {
  color: var(--accent);
  font-weight: 600;
}

.warning {
  color: #b8860b;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .wrap {
    width: 100% - 24px;
    margin: 24px 12px;
  }

  .card {
    padding: 20px;
  }

  h1 { font-size: 24px; }
  h2 { font-size: 18px; }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal {
    width: 95vw;
  }

  button,
  .btn {
    width: 100%;
  }

  .row {
    flex-direction: column;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 10px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
