/* === CSS Variables === */
:root {
  --font-mono: 'JetBrains Mono', monospace;
  --font-serif: 'Source Serif 4', Georgia, serif;

  --color-bg: #fafaf9;
  --color-surface: #ffffff;
  --color-border: #e7e5e4;
  --color-border-hover: #d6d3d1;
  --color-text: #1c1917;
  --color-text-muted: #78716c;
  --color-accent: #0d9488;
  --color-accent-hover: #0f766e;
  --color-accent-light: #ccfbf1;
  --color-error: #dc2626;
  --color-error-bg: #fef2f2;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --transition: 150ms ease;
}

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

/* === Layout === */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === Header === */
.header {
  text-align: center;
  margin-bottom: 3rem;
}

.logo {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

/* === Main === */
.main {
  flex: 1;
}

/* === Dropzone === */
.dropzone {
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.dropzone.drag-over {
  transform: scale(1.01);
  box-shadow: var(--shadow-md);
}

.dropzone-icon {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  transition: color var(--transition);
}

.dropzone:hover .dropzone-icon,
.dropzone.drag-over .dropzone-icon {
  color: var(--color-accent);
}

.dropzone-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.dropzone-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* === Status Messages === */
.status {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  animation: slideIn 200ms ease;
}

.status.loading {
  background: var(--color-accent-light);
  color: var(--color-accent-hover);
}

.status.error {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.status.loading::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  margin-right: 0.75rem;
  animation: spin 600ms linear infinite;
  vertical-align: middle;
}

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

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

/* === Results === */
.results {
  margin-top: 2rem;
  animation: fadeIn 300ms ease;
}

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

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.portfolio-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  word-break: break-word;
}

.file-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.625rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

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

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

/* === File List === */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.file-item:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-sm);
}

.file-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 500;
  color: var(--color-text);
  word-break: break-word;
}

.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

.file-actions {
  flex-shrink: 0;
}

/* === Footer === */
.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.footer a {
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--transition);
}

.footer a:hover {
  color: var(--color-accent);
}

.footer .sep {
  margin: 0 0.5rem;
  opacity: 0.4;
}

/* === Responsive === */
@media (max-width: 600px) {
  .container {
    padding: 2rem 1rem;
  }

  .dropzone {
    padding: 2rem 1.5rem;
  }

  .results-header {
    flex-direction: column;
    align-items: stretch;
  }

  .results-header .btn {
    justify-content: center;
  }

  .file-item {
    flex-wrap: wrap;
  }

  .file-actions {
    width: 100%;
    margin-top: 0.75rem;
  }

  .file-actions .btn {
    width: 100%;
    justify-content: center;
  }
}
