/* Renoweb — minimal tool UI */

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

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #6e6e6e;
  --text-tertiary: #999999;
  --border: #e6e6e4;
  --border-hover: #d4d4d2;
  --accent: #1a1a1a;
  --accent-hover: #333333;
  --danger: #d93030;
  --danger-bg: #fff3f3;
  --warning-bg: #fff9ed;
  --success-bg: #edfaf3;
  --info-bg: #f3f5f7;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 1.5rem 2rem 0;
  max-width: 960px;
  margin: 0 auto;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.logo-sub {
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

/* Main */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem;
}

/* Input row */
.input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.url-input {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.url-input::placeholder {
  color: var(--text-tertiary);
}

/* Buttons */
.action-btn {
  padding: 0.7rem 1.2rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.action-btn:hover {
  background: #f5f5f4;
  border-color: var(--border-hover);
}

.action-btn.primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.action-btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

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

.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Status bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--info-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.status-icon {
  font-size: 1rem;
}

.status-text {
  font-weight: 600;
}

.status-url {
  color: var(--text-secondary);
  margin-left: auto;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  width: 120px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Error */
.error-msg {
  padding: 0.65rem 1rem;
  background: var(--danger-bg);
  border: 1px solid rgba(217,48,48,0.15);
  border-radius: 6px;
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* Done */
.done-msg {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* Projects */
.projects {
  margin-top: 2.5rem;
}

.projects-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.projects-head h2 {
  font-size: 1rem;
  font-weight: 700;
}

.projects-count {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.empty {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

/* Project row */
.project-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.project-row:last-child {
  border-bottom: none;
}

.project-row.row-active {
  background: var(--info-bg);
  box-shadow: inset 3px 0 0 var(--accent);
}

.project-url {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
}

.project-url:hover {
  color: #175ea8;
  text-decoration: underline;
}

.project-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.badge-done { background: var(--success-bg); color: #1a7a3a; }
.badge-error { background: var(--danger-bg); color: var(--danger); }
.badge-mirroring { background: var(--info-bg); color: #4a5f8a; }
.badge-renovating { background: var(--warning-bg); color: #9a6d0a; }

.project-meta {
  color: var(--text-tertiary);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.project-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
  flex-shrink: 0;
}

.pa-btn {
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}

.pa-btn:hover {
  background: #f5f5f4;
  border-color: var(--border-hover);
}

.pa-btn.view { color: #175ea8; }
.pa-btn.view:hover { background: #eef4fb; border-color: #c4d9f0; }
.pa-btn.retry { color: #8a6d1a; }
.pa-btn.retry:hover { background: #faf5e6; border-color: #e4d6a8; }
.pa-btn.danger { color: var(--danger); border-color: transparent; }
.pa-btn.danger:hover { background: var(--danger-bg); border-color: rgba(217,48,48,0.2); }
.pa-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Utilities */
.hidden { display: none !important; }

/* Mobile */
@media (max-width: 640px) {
  .topbar {
    padding: 1rem 1rem 0;
  }

  .main {
    padding: 1rem;
  }

  .input-row {
    flex-direction: column;
  }

  .status-bar {
    flex-wrap: wrap;
  }

  .project-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .project-actions {
    margin-left: 0;
    width: 100%;
  }
}
