/* ==========================================================================
   Simohayha Browser Fingerprint Checker — Dark Theme Dashboard
   ========================================================================== */

/* Root variables */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1c2128;
  --bg-card-hover: #242a33;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --border: #30363d;
  --border-light: rgba(48, 54, 61, 0.5);
  --pass: #00ff88;
  --fail: #ff4444;
  --warn: #ffaa00;
  --info: #4488ff;
  --accent: #00ff88;
  --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   Header
   ========================================================================== */

#header {
  text-align: center;
  padding: 40px 0 30px;
}

#header h1 {
  font-size: 2em;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--accent), var(--info));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95em;
  font-weight: 400;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

#progress-section {
  margin: 10px 0 30px;
}

.progress-bar-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  height: 12px;
  overflow: hidden;
  margin: 20px 0 10px;
}

.progress-bar {
  background: linear-gradient(90deg, var(--info), var(--accent));
  height: 100%;
  transition: width 0.4s ease;
  border-radius: var(--radius-md);
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

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

#progress-text {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85em;
  font-family: var(--font-mono);
}

/* ==========================================================================
   Verdict Banner
   ========================================================================== */

#verdict-section {
  margin: 20px 0;
  animation: fadeSlideIn 0.5s ease;
}

#verdict-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 28px;
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
}

#verdict-banner.legitimate {
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid var(--pass);
  box-shadow: 0 0 30px rgba(0, 255, 136, 0.1);
}

#verdict-banner.suspicious {
  background: rgba(255, 170, 0, 0.08);
  border: 1px solid var(--warn);
  box-shadow: 0 0 30px rgba(255, 170, 0, 0.1);
}

#verdict-banner.fake {
  background: rgba(255, 68, 68, 0.08);
  border: 1px solid var(--fail);
  box-shadow: 0 0 30px rgba(255, 68, 68, 0.1);
}

#verdict-icon {
  font-size: 2.2em;
  line-height: 1;
}

#verdict-label {
  font-size: 1.5em;
  font-weight: 700;
  letter-spacing: -0.3px;
}

#verdict-banner.legitimate #verdict-label { color: var(--pass); }
#verdict-banner.suspicious #verdict-label { color: var(--warn); }
#verdict-banner.fake #verdict-label { color: var(--fail); }

#verdict-score {
  color: var(--text-secondary);
  font-size: 0.95em;
  margin-top: 2px;
}

/* ==========================================================================
   Section Titles
   ========================================================================== */

.section-title {
  font-size: 1.2em;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   Score Breakdown Bars
   ========================================================================== */

#score-breakdown {
  margin: 24px 0;
  animation: fadeSlideIn 0.5s ease 0.1s both;
}

.score-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.score-bar-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: border-color 0.2s ease;
}

.score-bar-item:hover {
  border-color: var(--text-muted);
}

.score-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.score-bar-label {
  font-size: 0.8em;
  color: var(--text-secondary);
}

.score-bar-value {
  font-size: 0.8em;
  font-weight: 600;
  font-family: var(--font-mono);
}

.score-bar-track {
  background: var(--bg-primary);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

.score-bar-fill.score-high { background: var(--pass); }
.score-bar-fill.score-mid { background: var(--warn); }
.score-bar-fill.score-low { background: var(--fail); }

.score-bar-stats {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: 0.7em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Category Cards (Collapsible)
   ========================================================================== */

#results-container {
  margin: 16px 0;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.2s ease;
  animation: fadeSlideIn 0.4s ease both;
}

.category-card:hover {
  border-color: var(--text-muted);
}

.category-header {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  gap: 12px;
  transition: background-color 0.15s ease;
}

.category-header:hover {
  background: var(--bg-card-hover);
}

.category-icon {
  font-size: 0.75em;
  color: var(--text-muted);
  width: 16px;
  text-align: center;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.category-icon.expanded {
  transform: rotate(90deg);
}

.category-header h3 {
  flex: 1;
  font-size: 0.95em;
  font-weight: 600;
}

.category-badge {
  font-size: 0.75em;
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.category-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-status.status-good { background: var(--pass); box-shadow: 0 0 6px var(--pass); }
.category-status.status-mixed { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.category-status.status-bad { background: var(--fail); box-shadow: 0 0 6px var(--fail); }
.category-status.status-neutral { background: var(--info); }

.category-body {
  padding: 0 18px;
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}

.category-body.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* ==========================================================================
   Results Tables
   ========================================================================== */

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  margin-bottom: 14px;
}

.results-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.results-table th {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 2px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-card);
}

.results-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.results-table tbody tr {
  transition: background-color 0.15s ease;
}

.results-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.results-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

.results-table tbody tr:nth-child(even):hover {
  background: rgba(255, 255, 255, 0.03);
}

.results-table td.col-id {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85em;
  width: 40px;
  white-space: nowrap;
}

.results-table td.col-name {
  font-weight: 500;
  min-width: 160px;
}

.results-table td.col-value {
  font-family: var(--font-mono);
  font-size: 0.9em;
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.results-table td.col-value:hover {
  white-space: normal;
  word-break: break-all;
}

.results-table td.col-status {
  width: 60px;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.results-table td.col-details {
  font-size: 0.9em;
  color: var(--text-secondary);
  min-width: 180px;
}

/* Status colors */
.status-pass { color: var(--pass); }
.status-fail { color: var(--fail); }
.status-warn { color: var(--warn); }
.status-info { color: var(--info); }

/* ==========================================================================
   Cross-Validation Results
   ========================================================================== */

#cross-validation-section {
  margin: 24px 0;
  animation: fadeSlideIn 0.5s ease 0.2s both;
}

#cross-validation-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.xv-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: border-color 0.2s ease;
}

.xv-item:hover {
  border-color: var(--text-muted);
}

.xv-status-badge {
  font-size: 0.75em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.xv-status-badge.pass { background: rgba(0, 255, 136, 0.15); color: var(--pass); }
.xv-status-badge.fail { background: rgba(255, 68, 68, 0.15); color: var(--fail); }
.xv-status-badge.warn { background: rgba(255, 170, 0, 0.15); color: var(--warn); }

.xv-content {
  flex: 1;
}

.xv-name {
  font-weight: 600;
  font-size: 0.9em;
  margin-bottom: 4px;
}

.xv-details {
  font-size: 0.8em;
  color: var(--text-secondary);
  line-height: 1.5;
}

.xv-severity {
  font-size: 0.7em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ==========================================================================
   Server Results
   ========================================================================== */

#server-results-section {
  margin: 24px 0;
  animation: fadeSlideIn 0.5s ease 0.3s both;
}

#server-results {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.server-result-row {
  display: flex;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-light);
  align-items: flex-start;
  gap: 12px;
}

.server-result-row:last-child {
  border-bottom: none;
}

.server-result-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.server-result-name {
  min-width: 200px;
  font-weight: 500;
  font-size: 0.85em;
  flex-shrink: 0;
}

.server-result-value {
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--text-secondary);
  word-break: break-all;
}

.server-subsection-title {
  padding: 10px 18px 6px;
  font-size: 0.9em;
  color: var(--accent);
  border-bottom: 1px solid var(--border-light);
  background: rgba(0, 255, 136, 0.03);
}

.server-result-status {
  font-weight: 700;
  font-size: 0.8em;
  text-transform: uppercase;
  flex-shrink: 0;
  min-width: 50px;
}

.server-error {
  padding: 18px;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9em;
}

/* ==========================================================================
   Download Button
   ========================================================================== */

/* Start Section */
#start-section {
  text-align: center;
  margin: 60px 0 40px;
  animation: fadeSlideIn 0.5s ease 0.2s both;
}

#start-btn {
  display: inline-block;
  padding: 18px 60px;
  background: linear-gradient(135deg, var(--accent), #00cc66);
  color: #0a0a0f;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.2em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
}

#start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 255, 136, 0.4);
}

#start-btn:active {
  transform: translateY(0);
}

.start-hint {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.85em;
}

#download-section {
  text-align: center;
  margin: 40px 0 20px;
  animation: fadeSlideIn 0.5s ease 0.4s both;
}

#download-btn {
  display: inline-block;
  padding: 14px 40px;
  background: linear-gradient(135deg, var(--info), #6644ff);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 15px rgba(68, 136, 255, 0.3);
}

#download-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(68, 136, 255, 0.4);
}

#download-btn:active {
  transform: translateY(0);
}

/* ==========================================================================
   Footer
   ========================================================================== */

#footer {
  text-align: center;
  padding: 30px 0 10px;
  color: var(--text-muted);
  font-size: 0.8em;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.loading-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
}

.text-pass { color: var(--pass); }
.text-fail { color: var(--fail); }
.text-warn { color: var(--warn); }
.text-info { color: var(--info); }

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  #header {
    padding: 24px 0 20px;
  }

  #header h1 {
    font-size: 1.4em;
  }

  .subtitle {
    font-size: 0.82em;
  }

  #verdict-banner {
    padding: 16px 18px;
    gap: 12px;
  }

  #verdict-icon {
    font-size: 1.6em;
  }

  #verdict-label {
    font-size: 1.2em;
  }

  .score-categories {
    grid-template-columns: 1fr;
  }

  .category-header {
    padding: 12px 14px;
    gap: 8px;
  }

  .category-header h3 {
    font-size: 0.85em;
  }

  .category-body {
    padding: 0 10px;
  }

  .results-table {
    font-size: 0.75em;
  }

  .results-table td.col-value {
    max-width: 150px;
  }

  .results-table td.col-details {
    min-width: 100px;
  }

  .xv-item {
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
  }

  .server-result-row {
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
  }

  .server-result-name {
    min-width: unset;
  }

  #download-btn {
    padding: 12px 28px;
    font-size: 0.9em;
  }
}

@media (max-width: 480px) {
  .results-table th:nth-child(1),
  .results-table td.col-id {
    display: none;
  }

  .results-table td.col-details {
    display: none;
  }

  .category-badge {
    display: none;
  }
}
