/* ==========================================================
   PTDL Dark Theme Stylesheet
   ========================================================== */
:root {
  --bg-0: #0d1117;
  --bg-1: #161b22;
  --bg-2: #1f2632;
  --fg-0: #f0f6fc;
  --fg-1: #c9d1d9;
  --accent: #2677f8; /* blue */
  --accent-hover: #1755db;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 10px 25px rgba(0,0,0,0.35);
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--fg-0);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--fg-0); }

a {color: #03548a;}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Layout */
.app-header {
  background: var(--bg-1);
  box-shadow: var(--shadow);
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
}
.accent { color: var(--accent); }

.container {
  max-width: 860px;
  margin: 2rem auto 4rem;
  padding: 0 1rem;
}

.card {
  background: var(--bg-1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,0,0,0.4);
}

.input-card h2 { margin-bottom: 1rem; }
.fetch-form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

input[type="url"] {
  flex: 1 1 300px;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--bg-2);
  background: var(--bg-2);
  color: var(--fg-0);
  font-size: 1rem;
}
input[type="url"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.btn.primary {
  background: var(--accent);
  color: var(--fg-0);
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost {
  background: transparent;
  color: var(--fg-1);
}
.btn.ghost:hover {
  background: var(--bg-2);
}

.hint {
  margin-top: 0.75rem;
  color: var(--fg-1);
  font-size: 0.85rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

thead {
  background: var(--bg-2);
}

th, td {
  padding: 0.75rem 0.9rem;
  text-align: left;
}

tbody tr:nth-child(odd) { background: rgba(255,255,255,0.02); }
tbody tr:hover { background: rgba(255,255,255,0.06); }

.actions-col { width: 110px; }

.copy-btn {
  font-size: 0.8rem;
  padding: 0.45rem 0.8rem;
}

.hidden { display: none !important; }

/* Loading overlay */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}
.spinner {
  width: 60px;
  height: 60px;
  border: 6px solid var(--bg-2);
  border-top: 6px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Toasts */
#toastContainer {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 200;
}
.toast {
  background: var(--bg-2);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--fg-0);
  min-width: 200px;
  max-width: 320px;
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(10px);
  animation: toast-in 0.25s forwards;
}
@keyframes toast-in {
  to { opacity: 1; transform: translateY(0); }
}

.app-footer {
  text-align: center;
  padding: 2rem 1rem 3rem;
  color: var(--fg-1);
  font-size: 0.85rem;
}