*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.4);
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  /* Add unified color variables used by toast and other components */
  --success-color: #22c55e;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    "Calibri",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Background Effects */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-gradient::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.08) 0%,
    transparent 50%
  );
  animation: float 20s ease-in-out infinite;
}

.bg-gradient::after {
  content: "";
  position: absolute;
  bottom: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle,
    rgba(139, 92, 246, 0.08) 0%,
    transparent 50%
  );
  animation: float 25s ease-in-out infinite reverse;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(30px, 30px);
  }
}

/* Main Container */
.container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
header {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.logo-text {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.3px;
  font-family: raleway, sans-serif;
}

.nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 15px;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.social-links {
  display: flex;
  gap: 12px;
  align-items: center;
}

.social-links a {
  color: var(--text-secondary);
  font-size: 16px;
  transition: color 0.2s ease;
}

.social-links a:hover {
  color: var(--accent-primary);
}

/* Hero Section */
.hero {
  padding: 16px 0 14px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.hero-badge-dot {
  width: 5px;
  height: 5px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.hero h1 {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 8px;
  background: linear-gradient(
    135deg,
    var(--text-primary) 0%,
    rgba(255, 255, 255, 0.7) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto 16px;
  line-height: 1.4;
}

/* Search Section */
.search-section {
  max-width: 480px;
  margin: 0 auto;
}

.search-box {
  position: relative;
  margin-bottom: 8px;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  padding-right: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
  transition: all 0.3s ease;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.main-btn {
  padding: 10px 20px;
  background: var(--gradient-primary);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 10px 20px;
  background: var(--gradient-primary);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
}
.main-btn:hover {
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}
.search-btn:hover {
  transform: translateY(-50%) scale(1.02);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.search-btn:active {
  transform: translateY(-50%) scale(0.98);
}

/* search-select removed: validation is auto-detected */

.search-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* small help icon inside search box */
.search-help {
  position: absolute;
  right: 86px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
}

.search-help:hover,
.search-help:focus {
  color: var(--accent-primary);
  outline: none;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.search-help-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 280px;
  max-width: 420px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.12);
  z-index: 20;
  font-size: 13px;
}

.search-help-popup .search-help-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-help-popup .search-help-text code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-family: monospace;
}

.search-help-close {
  margin-left: auto;
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}

.search-help-close:hover,
.search-help-close:focus {
  color: var(--accent-primary);
  outline: none;
}

.search-error {
  margin-top: 6px;
  font-size: 12px;
  color: var(--error-color);
}

.search-input.invalid {
  border-color: var(--error-color);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.search-hint code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  border: 1px solid var(--border-color);
}

/* Results Section */
.results-section {
  margin-top: 20px;
  display: none;
}

.results-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Certificate Card */
.certificate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.certificate-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.certificate-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 100px;
  color: #22c55e;
  font-size: 11px;
  font-weight: 500;
}

.certificate-status-icon {
  width: 12px;
  height: 12px;
}

.certificate-actions {
  display: flex;
  gap: 6px;
}

.btn-secondary {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.certificate-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.detail-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.detail-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.detail-value.highlight {
  color: var(--accent-primary);
}

/* Certificate Preview with Overlay Protection */
.certificate-preview {
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  min-height: 200px;
}

/* Loading indicator */
.certificate-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  z-index: 5;
  gap: 12px;
}

.certificate-loading.hidden {
  display: none;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.certificate-loading span {
  font-size: 12px;
  color: var(--text-muted);
}

.certificate-preview img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

.certificate-preview::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 40px,
    rgba(99, 102, 241, 0.02) 40px,
    rgba(99, 102, 241, 0.02) 80px
  );
  pointer-events: none;
  z-index: 1;
}

.certificate-preview::after {
  content: "jaktestowac.pl";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 48px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
  letter-spacing: 8px;
}

.certificate-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  cursor: default;
}

/* Error State */
.error-state {
  text-align: center;
  padding: 32px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}

.error-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-state h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.error-state p {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 32px 20px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Footer */
footer {
  padding: 16px 0;
  border-top: 1px solid var(--border-color);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-social {
  display: flex;
  gap: 14px;
}

.footer-social a {
  color: var(--text-muted);
  font-size: 16px;
  transition: color 0.2s ease;
}

.footer-social a:hover {
  color: var(--accent-primary);
}

.footer-copyright {
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.footer-copyright a {
  color: var(--accent-primary);
  text-decoration: none;
}

.footer-copyright a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 12px;
  }

  .nav-links {
    gap: 12px;
  }

  .social-links {
    gap: 16px;
  }

  .hero {
    padding: 24px 0 20px;
  }

  .search-input {
    padding-right: 56px;
    padding-bottom: 56px;
  }

  .search-help {
    right: 14px;
    top: 5px;
    transform: none;
    z-index: 10;
  }

  .search-btn {
    right: 6px;
    left: 6px;
    bottom: 6px;
    top: auto;
    transform: none;
    width: calc(100% - 12px);
  }

  .search-btn:hover {
    transform: scale(1.02);
  }

  .certificate-header {
    flex-direction: column;
  }

  .certificate-actions {
    width: 100%;
  }

  .certificate-actions .btn-secondary {
    flex: 1;
    justify-content: center;
  }

  .samples-grid {
    grid-template-columns: 1fr;
  }

  .certificate-preview::after {
    font-size: 24px;
  }
}

/* Prevent image dragging and context menu */
.no-select {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.main-header {
  font-size: 24px !important;
  font-weight: 700 !important;
  margin-bottom: 16px !important;
}

/* Toast notification */
.toast {
  position: fixed;
  top: 40px;
  right: 24px;
  left: auto;
  transform: translateY(-100px);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast i {
  margin-right: 8px;
  color: var(--success-color);
}

.toast.success i {
  color: var(--success-color);
}

.toast.error i {
  color: var(--error-color);
}

.toast.warning i {
  color: var(--warning-color);
}

.toast-message {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}
