/* filehashes.io - Accessible Web Dashboard
   WCAG 2.1 AA compliant
   Works with screen readers (VoiceOver, NVDA, JAWS)
   Dark theme with cyan/teal accent
*/

/* CSS Custom Properties for theming */
:root {
  /* Dark mode (default - matching AfterDark ecosystem) */
  --color-bg: #0f172a;
  --color-bg-secondary: #1e293b;
  --color-text: #e2e8f0;
  --color-text-secondary: #94a3b8;
  --color-primary: #06b6d4;
  --color-primary-hover: #22d3ee;
  --color-primary-dark: #0891b2;
  --color-accent: #8b5cf6;
  --color-border: #334155;
  --color-success: #10b981;
  --color-success-bg: #064e3b;
  --color-error: #ef4444;
  --color-error-bg: #450a0a;
  --color-link: #06b6d4;
  --color-link-visited: #a78bfa;
  --color-focus: #06b6d4;
  --color-gradient-start: #06b6d4;
  --color-gradient-end: #8b5cf6;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Light mode override for users who prefer it */
@media (prefers-color-scheme: light) {
  :root {
    --color-bg: #f8fafc;
    --color-bg-secondary: #e2e8f0;
    --color-text: #0f172a;
    --color-text-secondary: #475569;
    --color-primary: #0891b2;
    --color-primary-hover: #0e7490;
    --color-border: #cbd5e1;
    --color-success: #059669;
    --color-success-bg: #d1fae5;
    --color-error: #dc2626;
    --color-error-bg: #fee2e2;
    --color-link: #0891b2;
    --color-link-visited: #7c3aed;
  }
}

/* High contrast mode */
@media (prefers-contrast: more) {
  :root {
    --color-bg: #000000;
    --color-bg-secondary: #1a1a1a;
    --color-text: #ffffff;
    --color-text-secondary: #ffffff;
    --color-primary: #00ffff;
    --color-primary-hover: #00ffff;
    --color-border: #ffffff;
    --color-success: #00ff00;
    --color-success-bg: #003300;
    --color-error: #ff0000;
    --color-error-bg: #330000;
    --color-link: #00ffff;
    --color-link-visited: #ff00ff;
    --color-focus: #ffffff;
  }
}

/* Base styles */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-primary);
  color: #ffffff;
  padding: 12px 24px;
  z-index: 1000;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* Focus styles - visible for all interactive elements */
:focus {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* Header */
header {
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 24px;
  z-index: 1000;
}

@media (prefers-color-scheme: light) {
  header {
    background: rgba(248, 250, 252, 0.95);
  }
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  text-decoration: none;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 2rem;
  line-height: 1;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-art {
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.1;
  margin: 0;
  background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: none;
}

@media (min-width: 900px) {
  .logo-art {
    display: block;
  }
  .logo-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .logo-icon {
    display: none;
  }
}

/* Navigation */
nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

nav a {
  color: var(--color-link);
  text-decoration: none;
  padding: 8px 4px;
  font-weight: 500;
}

nav a:hover {
  text-decoration: underline;
}

nav a[aria-current="page"] {
  color: var(--color-text);
  border-bottom: 3px solid var(--color-primary);
}

/* Main content */
main {
  flex: 1;
  padding: 32px 24px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 16px;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  border-bottom: none;
  padding-bottom: 0;
}

h2 {
  font-size: 1.5rem;
  margin-top: 32px;
  color: var(--color-text);
}

h3 {
  font-size: 1.25rem;
  margin-top: 24px;
}

p {
  margin: 0 0 16px;
}

.lead {
  font-size: 1.25rem;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
}

a {
  color: var(--color-link);
}

a:visited {
  color: var(--color-link-visited);
}

/* Forms */
fieldset {
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 16px;
  margin: 0 0 16px;
}

legend {
  font-weight: 600;
  padding: 0 8px;
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
textarea,
select {
  display: block;
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: var(--font-mono);
  color: var(--color-text);
  background: var(--color-bg-secondary);
  border: 2px solid var(--color-border);
  border-radius: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-secondary);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.2);
}

.help-text {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
  margin-bottom: 0;
}

/* Buttons */
button,
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

button:hover,
.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(6, 182, 212, 0.3);
}

button:focus,
.button:focus {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

button:active,
.button:active {
  transform: translateY(0);
}

.button-outline {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.button-outline:hover {
  background: var(--color-primary);
  color: #ffffff;
  transform: none;
  box-shadow: none;
}

/* Alerts */
.alert {
  padding: 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  border-left: 4px solid;
}

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

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

/* Results */
.result {
  padding: 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  border: 2px solid var(--color-border);
}

.result-found {
  border-color: var(--color-success);
}

.result-not-found {
  border-color: var(--color-border);
}

.result-status {
  margin-top: 0;
}

/* Hash details */
.hash-details {
  margin: 16px 0 0;
}

.hash-details dt {
  font-weight: 600;
  margin-top: 12px;
}

.hash-details dd {
  margin: 4px 0 0;
}

.hash-value {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  word-break: break-all;
  background: var(--color-bg-secondary);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Code blocks */
.code-block {
  background: var(--color-bg-secondary);
  padding: 16px;
  border-radius: 4px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
}

.code-block code {
  display: block;
  white-space: pre;
}

code {
  font-family: var(--font-mono);
  background: var(--color-bg-secondary);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.875em;
}

/* Feature grid */
.feature-grid {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

@media (min-width: 600px) {
  .feature-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

.feature {
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-secondary);
  transition: transform 0.2s, border-color 0.2s;
}

.feature:hover {
  transform: translateY(-4px);
  border-color: var(--color-primary);
}

.feature h3 {
  margin-top: 0;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feature h3::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.2em;
  background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
  border-radius: 2px;
}

.feature p {
  margin-bottom: 16px;
  color: var(--color-text-secondary);
}

.feature a {
  font-weight: 600;
}

/* API endpoints */
.api-endpoints dt {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  margin-top: 16px;
}

.api-endpoints dd {
  margin: 4px 0 0;
  color: var(--color-text-secondary);
}

/* Footer */
footer {
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: 24px;
  text-align: center;
  margin-top: auto;
}

footer p {
  margin: 8px 0;
  color: var(--color-text-secondary);
}

footer a {
  color: var(--color-link);
}

/* Lists */
ul, ol {
  padding-left: 24px;
}

li {
  margin-bottom: 8px;
}

/* Sections */
section {
  margin-top: 32px;
}

section:first-child {
  margin-top: 0;
}

/* API Documentation */
.api-endpoint {
  margin: 32px 0;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-secondary);
}

.api-endpoint h3 {
  margin-top: 0;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--color-primary);
}

.api-endpoint h4 {
  margin-top: 20px;
  margin-bottom: 12px;
  font-size: 1rem;
}

.param-list {
  margin: 16px 0;
}

.param-list dt {
  margin-top: 12px;
  font-family: var(--font-mono);
}

.param-list dd {
  margin: 4px 0 0 0;
  color: var(--color-text-secondary);
}

.required {
  color: var(--color-error);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 8px;
}

.optional {
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-style: italic;
  margin-left: 8px;
}

details {
  margin-top: 16px;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-primary);
  padding: 8px 0;
}

details summary:hover {
  text-decoration: underline;
}

details[open] summary {
  margin-bottom: 12px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  background: var(--color-bg-secondary);
  font-weight: 600;
  color: var(--color-text);
}

tr:hover {
  background: rgba(6, 182, 212, 0.05);
}

.rate-limit-table,
.platform-table {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

/* Command list */
.command-list dt {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-primary);
}

.command-list dd {
  margin: 4px 0 0 0;
  color: var(--color-text-secondary);
}

/* Error codes */
.error-codes dt {
  margin-top: 12px;
  font-family: var(--font-mono);
}

.error-codes dd {
  margin: 4px 0 0 0;
  color: var(--color-text-secondary);
}

/* Note callout */
.note {
  padding: 16px;
  background: rgba(6, 182, 212, 0.1);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 8px 8px 0;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

/* Download list */
.download-list {
  list-style: none;
  padding: 0;
}

.download-list li {
  margin: 8px 0;
}

.download-list a {
  font-weight: 600;
}

/* User dashboard styles */
.dashboard-grid {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card {
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-secondary);
}

.stat-card h3 {
  margin: 0 0 8px;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-gradient-start), var(--color-gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.api-key-display {
  font-family: var(--font-mono);
  padding: 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  word-break: break-all;
  position: relative;
}

.api-key-display .key-prefix {
  color: var(--color-primary);
}

.api-key-display .key-hidden {
  color: var(--color-text-secondary);
}

.copy-button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 12px;
  font-size: 0.875rem;
}

/* Upload history table */
.upload-table {
  font-size: 0.875rem;
}

.upload-table .hash-cell {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-new {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-seen {
  background: rgba(6, 182, 212, 0.2);
  color: var(--color-primary);
}

.badge-flagged {
  background: var(--color-error-bg);
  color: var(--color-error);
}

/* OS/Arch badges */
.os-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

/* Print styles */
@media print {
  header, footer {
    display: none;
  }

  main {
    padding: 0;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  .code-block, code {
    border: 1px solid #000;
    background: #fff;
  }
}
