/* ====================================================================
   BrowserBeast v1.0.1 — Popup Styling
   Blue / Steel / Black — Browser Capture Engine
   ==================================================================== */

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

:root {
  --beast-blue: #0EA5E9;
  --beast-blue-dark: #0284C7;
  --beast-blue-light: #38BDF8;
  --beast-blue-glow: rgba(14, 165, 233, 0.35);
  --beast-steel: #94A3B8;
  --beast-steel-light: #CBD5E1;
  --bg: #0C0F14;
  --bg-card: #131820;
  --bg-card-2: #1A2030;
  --bg-input: #0A0D12;
  --border: rgba(14, 165, 233, 0.18);
  --border-soft: rgba(255, 255, 255, 0.08);
  --border-blue: rgba(14, 165, 233, 0.35);
  --text: #E2E8F0;
  --text-dim: #94A3B8;
  --text-faint: #64748B;
  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.4);
  --error: #EF4444;
  --error-bg: rgba(239, 68, 68, 0.12);
  --error-border: rgba(239, 68, 68, 0.5);
  --amber: #F59E0B;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --amber-border: rgba(245, 158, 11, 0.48);
}

body {
  width: 420px;
  min-height: 480px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Roboto", sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0.005em;
}

.container {
  display: flex;
  flex-direction: column;
  min-height: 480px;
}

/* --- Header --- */
.header {
  padding: 14px 18px 12px;
  background:
    radial-gradient(ellipse at top right, rgba(14, 165, 233, 0.12), transparent 55%),
    radial-gradient(ellipse at bottom left, rgba(56, 189, 248, 0.08), transparent 60%),
    linear-gradient(135deg, #111820 0%, #0C0F14 100%);
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.header-logo {
  filter: drop-shadow(0 2px 8px var(--beast-blue-glow));
  flex-shrink: 0;
}

.header-text {
  flex: 1;
}

.title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.title-data {
  color: var(--beast-steel-light);
}

.title-beast {
  color: var(--beast-blue);
}

.title-tm {
  font-size: 9px;
  color: var(--text-faint);
  font-weight: 400;
  vertical-align: super;
}

.tagline {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.header-share-btn {
  background: none;
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 150ms, color 150ms;
}

.header-share-btn:hover {
  border-color: var(--beast-blue);
  color: var(--beast-blue);
}

/* --- Status strip --- */
.status-strip {
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-soft);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  flex-shrink: 0;
}

.status-dot.busy { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.status-dot.error { background: var(--error); box-shadow: 0 0 10px var(--error); }

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

/* --- Stages --- */
.stage {
  padding: 16px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage.hidden { display: none; }

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  font-weight: 600;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* --- Capture grid --- */
.capture-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.capture-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px 12px;
  background: var(--bg-card);
  border: 2px solid var(--border-soft);
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: border-color 180ms ease, background 180ms ease, transform 120ms ease, box-shadow 180ms ease;
}

.capture-btn:hover {
  border-color: var(--beast-blue);
  background: rgba(14, 165, 233, 0.06);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--beast-blue-glow);
}

.capture-btn:active {
  transform: translateY(0) scale(0.98);
}

.capture-btn:disabled {
  opacity: 0.5;
  cursor: progress;
  transform: none;
}

.capture-btn .btn-icon {
  color: var(--beast-blue);
}

.capture-btn .btn-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.capture-btn .btn-desc {
  font-size: 10px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.3;
}

/* Highlighted Text emphasis when selection exists */
.capture-btn.has-selection {
  border-color: var(--beast-blue-light);
  background: rgba(14, 165, 233, 0.08);
  box-shadow: 0 0 18px var(--beast-blue-glow), inset 0 0 0 1px rgba(14, 165, 233, 0.15);
  animation: selectionPulse 2s ease-in-out infinite;
}

@keyframes selectionPulse {
  0%, 100% { box-shadow: 0 0 18px var(--beast-blue-glow), inset 0 0 0 1px rgba(14, 165, 233, 0.15); }
  50% { box-shadow: 0 0 26px rgba(14, 165, 233, 0.45), inset 0 0 0 1px rgba(14, 165, 233, 0.25); }
}

/* Busy shimmer */
.capture-btn.busy {
  position: relative;
  overflow: hidden;
}

.capture-btn.busy::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.15), transparent);
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.hint {
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  min-height: 16px;
}

.hint.selection-detected {
  color: var(--beast-blue-light);
  font-weight: 600;
}

/* --- Ghost button (New Capture) --- */
.ghost-btn {
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-dim);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 150ms, color 150ms;
}

.ghost-btn:hover { border-color: var(--beast-blue); color: var(--beast-blue); }

/* --- Quality indicator --- */
.indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.02);
  font-size: 13px;
  font-weight: 600;
}

.indicator-icon {
  font-size: 14px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.indicator.good {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.indicator.good .indicator-icon {
  background: var(--success);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.indicator.warn {
  border-color: var(--amber-border);
  background: var(--amber-bg);
}

.indicator.warn .indicator-icon {
  background: var(--amber);
  color: #fff;
  font-size: 11px;
}

.indicator.bad {
  border-color: var(--error-border);
  background: var(--error-bg);
}

.indicator.bad .indicator-icon {
  background: var(--error);
  color: #fff;
  font-size: 11px;
}

/* --- Capture Mode Tiles (preview) --- */
.capture-mode-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-faint);
  transition: border-color 200ms, background 200ms, color 200ms;
}

.mode-tile.active {
  border-color: var(--beast-blue);
  background: rgba(14, 165, 233, 0.08);
  color: var(--text);
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.15);
}

.mode-tile.active svg {
  color: var(--beast-blue);
}

.mode-tile-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mode-tile-label {
  font-size: 11px;
  font-weight: 700;
}

.mode-tile-desc {
  font-size: 9px;
  color: var(--text-faint);
}

/* --- Metadata grid --- */
.metadata-grid {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
}

.meta-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  font-size: 12px;
  line-height: 1.5;
  padding: 3px 0;
}

.meta-row + .meta-row {
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.meta-label {
  color: var(--text-faint);
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding-top: 1px;
}

.meta-value {
  color: var(--text);
  overflow-wrap: anywhere;
}

.meta-url {
  color: var(--beast-blue-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

/* --- Warnings and notes --- */
.private-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.45;
  border: 1px solid var(--error-border);
  background: rgba(127, 29, 29, 0.35);
  color: #FCA5A5;
}

.private-warning.hidden { display: none; }

.pw-icon {
  font-size: 16px;
  color: var(--error);
  flex-shrink: 0;
  margin-top: 1px;
}

.pw-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pw-text strong {
  color: #FCA5A5;
  font-weight: 700;
}

.pw-text span {
  color: #FDA4AF;
  font-size: 10px;
}

.quality-warning {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.45;
  border: 1px solid var(--amber-border);
  background: var(--amber-bg);
  color: #FDE68A;
  font-weight: 600;
}

.quality-warning.hidden { display: none; }

.selection-note {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.45;
  border: 1px solid rgba(14, 165, 233, 0.35);
  background: rgba(14, 165, 233, 0.08);
  color: #BAE6FD;
  font-weight: 500;
}

.selection-note.hidden { display: none; }

/* --- Content preview --- */
.content-heading {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.content-preview {
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  color: #D8E3F0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  padding: 10px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
}

/* Scrollbar styling */
.content-preview::-webkit-scrollbar {
  width: 6px;
}
.content-preview::-webkit-scrollbar-track {
  background: transparent;
}
.content-preview::-webkit-scrollbar-thumb {
  background: rgba(14, 165, 233, 0.25);
  border-radius: 3px;
}
.content-preview::-webkit-scrollbar-thumb:hover {
  background: rgba(14, 165, 233, 0.4);
}

/* --- Export actions --- */
.export-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-btn {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-card-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 130ms ease, box-shadow 180ms ease, border-color 160ms ease, background 180ms ease;
}

.action-btn:hover { border-color: var(--beast-blue); }

.action-btn:active {
  transform: translateY(1px) scale(0.985);
}

.action-btn.full-width {
  width: 100%;
}

.action-btn.primary {
  background: linear-gradient(135deg, var(--beast-blue-dark), var(--beast-blue));
  border: none;
  color: #fff;
  padding: 12px;
  font-size: 13px;
}

.action-btn.primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 16px var(--beast-blue-glow);
}

.action-btn.review {
  border-color: rgba(56, 189, 248, 0.42);
  background: rgba(14, 165, 233, 0.1);
  color: #E0F2FE;
}

.action-btn.review:hover {
  border-color: var(--beast-blue-light);
  background: rgba(14, 165, 233, 0.16);
  box-shadow: 0 3px 12px rgba(14, 165, 233, 0.18);
}

.action-btn.secondary {
  background: var(--bg-card-2);
  color: var(--text-dim);
}

.action-btn.secondary:hover {
  color: var(--text);
  border-color: var(--beast-blue);
}

.action-btn.danger {
  color: #FCA5A5;
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.06);
}

.action-btn.danger:hover {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.12);
}

.btn-icon-inline {
  font-size: 13px;
}

/* --- Copy feedback --- */
@keyframes copyPulse {
  0% { transform: scale(0.98); }
  55% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.action-btn.copy-feedback-pulse {
  animation: copyPulse 260ms ease;
}

.action-btn.copy-feedback-active {
  border-color: rgba(14, 165, 233, 0.85) !important;
  background: linear-gradient(135deg, var(--beast-blue-dark), var(--beast-blue)) !important;
  color: #ECFDF5 !important;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.35), 0 6px 14px var(--beast-blue-glow);
}

/* --- Footer --- */
.footer {
  padding: 10px 18px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: var(--text-faint);
}

.footer-version { font-weight: 600; color: var(--text-dim); }

.footer-by a {
  color: var(--beast-blue);
  text-decoration: none;
}

.footer-by a:hover { text-decoration: underline; }
