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

:root {
  --bg-deep: #121218;
  --bg-sidebar: #1A1A22;
  --bg-card: #1E1E28;
  --border: #2E2E3A;
  --accent: #F5A623;
  --accent-dim: rgba(245, 166, 35, 0.1);
  --text-primary: #F0F0F5;
  --text-muted: #8A8A9A;
  --text-dim: #5A5A6A;
  --green: #00D4AA;
  --green-bright: #10B981;
  --red: #EF4444;
  --font-mono: 'JetBrains Mono', monospace;
  --font-display: 'Oswald', sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font-mono);
  background: var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ── App Layout ── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px 28px;
  gap: 32px;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.logo-image {
  width: 160px;
  height: 44px;
  object-fit: contain;
}

.logo-subtitle {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 5px;
}

/* Navigation */
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: normal;
  color: var(--text-muted);
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.nav-item .nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--text-primary);
  font-weight: 500;
}

.nav-item.active .nav-dot {
  background: var(--accent);
}

/* Sidebar Bottom */
.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.version-info {
  font-size: 12px;
  color: var(--text-dim);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.status-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 48px;
}

/* Tabs */
.tab-panel {
  display: none;
  flex-direction: column;
  gap: 40px;
}

.tab-panel.active {
  display: flex;
}

/* Header */
.header {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.accent-bar {
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}

.title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
}

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

/* Input Section */
.input-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.url-input {
  width: 100%;
  height: 120px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease;
}

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

.url-input:focus {
  border-color: var(--accent);
}

.batch-input {
  height: 180px;
}

/* Buttons */
.button-row {
  display: flex;
  gap: 12px;
}

.btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

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

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-primary:active {
  filter: brightness(0.95);
}

.btn-prefix {
  font-weight: 600;
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-weight: normal;
}

.btn-outline:hover {
  border-color: var(--text-dim);
  color: var(--text-primary);
}

/* ── Results ── */
.results-section,
.error-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hidden {
  display: none !important;
}

.results-divider {
  height: 1px;
  background: var(--border);
}

.results-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.results-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.results-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Cards */
.decoded-url-card,
.meta-card,
.error-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.decoded-url {
  font-size: 14px;
  color: var(--accent);
  word-break: break-all;
  text-decoration: none;
  transition: opacity 0.15s;
}

.decoded-url:hover {
  opacity: 0.8;
}

.card-value {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-all;
}

.card-value.accent {
  color: var(--accent);
}

.metadata-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meta-card {
  gap: 6px;
}

/* Error */
.error-card {
  border-color: rgba(239, 68, 68, 0.3);
}

.error-label {
  font-size: 12px;
  color: var(--red);
}

.error-message {
  font-size: 13px;
  color: var(--red);
}

/* Decode Steps */
.decode-steps {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px 24px;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  transition: background 0.3s;
}

.step-text {
  font-size: 12px;
  color: var(--accent);
}

.step-arrow {
  font-size: 12px;
  color: var(--text-dim);
}

.step.active .step-dot {
  background: var(--green-bright);
  box-shadow: 0 0 6px var(--green-bright);
}

.step.active .step-text {
  color: var(--green-bright);
}

/* ── Batch Results ── */
.batch-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.batch-result-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.batch-result-index {
  font-size: 11px;
  color: var(--text-dim);
}

.batch-result-url {
  font-size: 14px;
  color: var(--accent);
  word-break: break-all;
  text-decoration: none;
}

.batch-result-url:hover {
  opacity: 0.8;
}

.batch-result-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.batch-meta-item {
  font-size: 12px;
  color: var(--text-muted);
}

.batch-meta-item span {
  color: var(--text-primary);
}

.batch-result-error {
  font-size: 13px;
  color: var(--red);
}

/* ── History ── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-empty {
  padding: 40px;
  text-align: center;
}

.history-empty-text {
  font-size: 13px;
  color: var(--text-dim);
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-time {
  font-size: 11px;
  color: var(--text-dim);
}

.history-original {
  font-size: 13px;
  color: var(--accent);
  word-break: break-all;
  text-decoration: none;
}

.history-original:hover {
  opacity: 0.8;
}

.history-inky {
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.history-meta-row span {
  font-size: 11px;
  color: var(--text-dim);
}

.history-meta-row span strong {
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.results-section:not(.hidden),
.error-section:not(.hidden) {
  animation: fadeIn 0.25s ease;
}

@keyframes stepPulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.step.processing .step-dot {
  background: var(--accent);
  animation: stepPulse 0.6s ease infinite;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .app {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    flex-direction: row;
    padding: 16px 20px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 24px;
    align-items: center;
    justify-content: space-between;
  }

  .sidebar-top {
    flex-direction: row;
    align-items: center;
    gap: 24px;
  }

  .logo {
    flex-direction: row;
    gap: 12px;
  }

  .logo-image {
    width: 120px;
    height: 33px;
  }

  .nav {
    flex-direction: row;
  }

  .sidebar-bottom {
    display: none;
  }

  .main-content {
    padding: 24px;
  }

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

  .decode-steps {
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .nav-item .nav-label {
    font-size: 11px;
  }

  .nav-item {
    padding: 8px 10px;
    gap: 8px;
  }

  .main-content {
    padding: 20px 16px;
  }

  .title {
    font-size: 24px;
  }
}

/* Scrollbar */
.main-content::-webkit-scrollbar {
  width: 6px;
}

.main-content::-webkit-scrollbar-track {
  background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.main-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}
