/* Shared tool page layout — matches Tools hub */

:root {
  --bs-primary: #6366f1;
  --bs-primary-rgb: 99, 102, 241;
  --bs-success: #22c55e;
  --bs-body-bg: #0a0f1a;
  --bs-body-color: #e2e8f0;
  --bs-border-color: rgba(148, 163, 184, 0.15);
  --bs-secondary-color: #94a3b8;
}

body.tool-page {
  display: block;
  min-height: 100vh;
}

/* Top nav */
.tool-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: rgba(10, 15, 26, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--hub-border);
}

.tool-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tool-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--hub-text);
  font-weight: 600;
  font-size: 0.95rem;
}

.tool-nav-brand img {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tool-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--hub-muted);
  text-decoration: none;
  border: 1px solid var(--hub-border);
  background: rgba(15, 23, 42, 0.5);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.tool-nav-link:hover {
  color: var(--hub-text);
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.1);
}

/* Main layout */
.tool-main {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  animation: hub-fade-up 0.7s ease-out both;
}

.tool-page-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.tool-page-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--hub-gradient);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.tool-page-icon i {
  font-size: 1.4rem;
  color: #fff;
}

.tool-page-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--hub-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tool-page-desc {
  margin: 0;
  color: var(--hub-muted);
  font-size: 1rem;
  line-height: 1.55;
  max-width: 560px;
}

.tool-content {
  width: 100%;
}

/* Glass panels */
.tool-page .card {
  background: var(--hub-surface);
  border: 1px solid var(--hub-border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  color: var(--hub-text);
}

.tool-page .card-header {
  background: rgba(99, 102, 241, 0.08);
  border-bottom: 1px solid var(--hub-border);
  color: var(--hub-muted);
}

.tool-page .form-control,
.tool-page .form-select {
  background: rgba(15, 23, 42, 0.6);
  border-color: var(--hub-border);
  color: var(--hub-text);
}

.tool-page .form-control:focus,
.tool-page .form-select:focus {
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--hub-primary);
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.2);
  color: var(--hub-text);
}

.tool-page .btn-primary {
  background: var(--hub-gradient);
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.tool-page .btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.tool-page .btn-success {
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
  border: none;
  font-weight: 600;
}

.tool-page .btn-dark,
.tool-page .btn-outline-secondary {
  background: rgba(15, 23, 42, 0.6);
  border-color: var(--hub-border);
  color: var(--hub-text);
}

.tool-page .btn-dark:hover,
.tool-page .btn-outline-secondary:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: var(--hub-text);
}

.tool-page .btn-outline-primary {
  border-color: rgba(99, 102, 241, 0.5);
  color: var(--hub-primary-light);
}

.tool-page .btn-outline-primary:hover,
.tool-page .btn-check:checked + .btn-outline-primary {
  background: var(--hub-gradient);
  border-color: transparent;
  color: #fff;
}

.tool-page .btn-outline-danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.tool-page .btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #fca5a5;
}

.tool-page .btn-outline-success {
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.tool-page .progress {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 50px;
  overflow: hidden;
}

.tool-page .progress-bar {
  background: var(--hub-gradient);
}

.tool-page .text-muted {
  color: var(--hub-muted) !important;
}

.tool-page .text-primary {
  color: var(--hub-primary-light) !important;
}

.tool-page .form-text {
  color: var(--hub-muted);
}

.tool-page .badge.bg-secondary {
  background: rgba(148, 163, 184, 0.2) !important;
  color: var(--hub-muted);
}

.tool-page pre {
  background: rgba(15, 23, 42, 0.5);
  color: var(--hub-muted);
  border-radius: 0 0 16px 16px;
}

/* Drop zone */
.tool-dropzone {
  cursor: pointer;
  border: 2px dashed rgba(148, 163, 184, 0.25);
  border-radius: var(--hub-radius);
  background: var(--hub-surface);
  backdrop-filter: blur(12px);
  padding: 3rem 2rem;
  text-align: center;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

.tool-dropzone:hover,
.tool-dropzone.is-dragover {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15);
}

.tool-dropzone-icon {
  font-size: 2.75rem;
  color: var(--hub-primary-light);
  opacity: 0.7;
  margin-bottom: 1rem;
  display: block;
}

.tool-dropzone-title {
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 0.35rem;
  color: var(--hub-text);
}

.tool-dropzone-hint {
  color: var(--hub-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.tool-dropzone-formats {
  color: var(--hub-muted);
  font-size: 0.78rem;
  margin: 0;
  opacity: 0.8;
}

/* Speedtest metrics */
.tool-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.tool-metric {
  text-align: center;
  padding: 1rem 0.5rem;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--hub-border);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.tool-metric.is-active,
.tool-metric.border-primary {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.tool-metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--hub-muted);
  margin-bottom: 0.35rem;
}

.tool-metric-value {
  font-size: clamp(1.35rem, 4.5vw, 1.85rem);
  font-weight: 800;
  line-height: 1;
  margin: 0.35rem 0;
  color: var(--hub-text);
}

.tool-metric-value.text-primary {
  color: var(--hub-primary-light) !important;
}

.tool-metric-unit {
  font-size: 0.78rem;
  color: var(--hub-muted);
}

.tool-stage {
  text-align: center;
  font-weight: 600;
  color: var(--hub-muted);
  margin-bottom: 1rem;
}

.tool-run-btn {
  padding: 0.75rem 2.5rem !important;
  font-weight: 700 !important;
  border-radius: 50px !important;
  background: var(--hub-gradient) !important;
  border: none !important;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35) !important;
}

.tool-run-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.45) !important;
}

/* Favicon preview */
.ah-fav-preview {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#334155 0% 25%, #1e293b 0% 50%) 50% / 16px 16px;
  border-radius: 12px;
  border: 1px solid var(--hub-border);
}

.ah-fav-preview img {
  image-rendering: pixelated;
  max-width: 100%;
  max-height: 100%;
}

.ah-fav-tile .card {
  height: 100%;
}

/* Footer */
.tool-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hub-border);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.tool-copyright {
  margin: 0;
  font-size: 0.8rem;
  color: var(--hub-muted);
  opacity: 0.7;
}

/* File list rows in img converter */
.tool-page #ah-file-list .card {
  margin-bottom: 0.5rem;
}

.tool-page #ah-file-list .card-body {
  padding: 0.65rem 1rem;
}

.tool-page #ah-panel.is-dragover {
  outline: 2px dashed rgba(99, 102, 241, 0.6);
  outline-offset: 4px;
  border-radius: 16px;
}

.reel-preview {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.reel-preview-img {
  width: 120px;
  height: auto;
  max-height: 90px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--bs-border-color);
  flex-shrink: 0;
}

.qr-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary-color);
  font-weight: 600;
}

.qr-preview-card {
  position: sticky;
  top: 5.5rem;
}

.qr-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--bs-border-color);
  max-width: 100%;
}

.qr-preview-wrap canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

@media (max-width: 991px) {
  .qr-preview-card {
    position: static;
  }
}

@media (max-width: 576px) {
  .tool-main {
    padding: 1.5rem 1rem 2.5rem;
  }

  .tool-page-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .tool-page-desc {
    margin-inline: auto;
  }

  .tool-metrics {
    gap: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool-main {
    animation: none;
  }

  .tool-run-btn:hover {
    transform: none;
  }
}
