/* ============================================================
   SSL/TLS Certificate Checker - SinapseTech
   V.1.0.0
   ============================================================ */

/* --- Design Tokens --- */
:root {
  --deep: #080b16;
  --surface-0: #0d1117;
  --surface-1: rgba(255,255,255,0.03);
  --surface-2: rgba(255,255,255,0.06);
  --surface-3: rgba(255,255,255,0.09);
  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);

  --indigo: #6366f1;
  --indigo-light: #818cf8;
  --indigo-dim: rgba(99,102,241,0.12);
  --cyan: #06b6d4;
  --cyan-light: #22d3ee;
  --cyan-dim: rgba(6,182,212,0.12);
  --emerald: #10b981;
  --emerald-light: #34d399;
  --emerald-dim: rgba(16,185,129,0.12);
  --amber: #f59e0b;
  --amber-light: #fbbf24;
  --amber-dim: rgba(245,158,11,0.12);
  --rose: #f43f5e;
  --rose-light: #fb7185;
  --rose-dim: rgba(244,63,94,0.12);

  --text-1: #f1f5f9;
  --text-2: rgba(241,245,249,0.65);
  --text-3: rgba(241,245,249,0.4);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--deep);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- Background --- */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1145 35%, #0d1f3c 65%, #0a0e1a 100%);
  background-size: 400% 400%;
  animation: bgShift 25s ease infinite;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.2;
  will-change: transform;
}

.bg-orb--1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.5), transparent 70%);
  top: -5%; left: -10%;
  animation: orb1 28s ease-in-out infinite;
}

.bg-orb--2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(6,182,212,0.4), transparent 70%);
  bottom: 10%; right: -8%;
  animation: orb2 32s ease-in-out infinite;
}

@keyframes bgShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes orb1 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(60px,40px) scale(1.1); }
}

@keyframes orb2 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(-50px,-30px) scale(1.08); }
}

/* --- Layout --- */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 0;
  background: rgba(8,11,22,0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s;
}

.logo-link:hover { opacity: 0.8; }

.logo-img {
  height: 30px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(99,102,241,0.25));
}

.header-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 9999px;
  background: var(--indigo-dim);
  border: 1px solid rgba(99,102,241,0.2);
  color: var(--indigo-light);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 0.2s;
}

.header-back:hover { color: var(--text-2); }

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 48px 24px 32px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  color: var(--cyan-light);
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 20px;
  animation: slideUp 0.6s var(--ease) both;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
  animation: slideUp 0.6s 0.08s var(--ease) both;
}

.hero h1 .grad {
  background: linear-gradient(135deg, #e0e7ff, #ffffff 40%, #a5f3fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: clamp(0.92rem, 1.5vw, 1.05rem);
  color: var(--text-2);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
  animation: slideUp 0.6s 0.16s var(--ease) both;
}

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

/* --- Main --- */
.main-area {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 48px;
  flex: 1;
  width: 100%;
}

/* --- Input Section --- */
.input-section {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
  animation: slideUp 0.6s 0.24s var(--ease) both;
}

.input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.input-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.input-label i {
  color: var(--indigo-light);
  font-size: 0.85rem;
}

.input-row {
  display: flex;
  align-items: center;
  padding: 0;
}

.input-prefix {
  padding: 14px 0 14px 20px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-3);
  white-space: nowrap;
  user-select: none;
}

.domain-input {
  flex: 1;
  padding: 14px 12px;
  background: transparent;
  border: none;
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  outline: none;
  min-width: 0;
}

.domain-input::placeholder {
  color: var(--text-3);
}

.btn-scan {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  margin: 8px 12px 8px 0;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.3s var(--ease);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(99,102,241,0.25);
}

.btn-scan:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
  filter: brightness(1.08);
}

.btn-scan:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-scan .fa-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.input-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
}

.input-hint {
  font-size: 0.72rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-hint i {
  font-size: 0.7rem;
}

/* --- Loading --- */
.loading-section {
  text-align: center;
  padding: 48px 24px;
  animation: slideUp 0.4s var(--ease) both;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--indigo-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

.loading-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
}

.loading-sub {
  font-size: 0.82rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* --- Section Divider --- */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 16px;
}

.section-divider-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  white-space: nowrap;
}

.section-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- Overview Card --- */
.overview-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 8px;
  animation: slideUp 0.5s var(--ease) both;
}

.overview-shield {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  transition: all 0.4s var(--ease);
}

.overview-shield--valid {
  background: var(--emerald-dim);
  color: var(--emerald-light);
  box-shadow: 0 0 40px rgba(16,185,129,0.15);
}

.overview-shield--warning {
  background: var(--amber-dim);
  color: var(--amber-light);
  box-shadow: 0 0 40px rgba(245,158,11,0.15);
}

.overview-shield--error {
  background: var(--rose-dim);
  color: var(--rose-light);
  box-shadow: 0 0 40px rgba(244,63,94,0.15);
}

.overview-body {
  min-width: 0;
  flex: 1;
}

.overview-status {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.overview-status--valid { color: var(--emerald-light); }
.overview-status--warning { color: var(--amber-light); }
.overview-status--error { color: var(--rose-light); }

.overview-domain {
  font-size: 0.88rem;
  font-family: var(--font-mono);
  color: var(--text-2);
  margin-bottom: 6px;
  word-break: break-all;
}

.overview-summary {
  font-size: 0.8rem;
  color: var(--text-3);
  line-height: 1.5;
}

/* --- Details Grid --- */
.details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.detail-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: border-color 0.3s var(--ease);
}

.detail-card:hover {
  border-color: var(--border-hover);
}

.detail-card--wide {
  grid-column: 1 / -1;
}

.detail-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.detail-icon--indigo {
  background: var(--indigo-dim);
  color: var(--indigo-light);
}

.detail-icon--cyan {
  background: var(--cyan-dim);
  color: var(--cyan-light);
}

.detail-icon--emerald {
  background: var(--emerald-dim);
  color: var(--emerald-light);
}

.detail-icon--amber {
  background: var(--amber-dim);
  color: var(--amber-light);
}

.detail-icon--rose {
  background: var(--rose-dim);
  color: var(--rose-light);
}

.detail-body {
  min-width: 0;
  flex: 1;
}

.detail-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-1);
  word-break: break-word;
  line-height: 1.5;
}

.detail-value--sans {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.8;
}

.san-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-2);
}

/* --- Timeline Card --- */
.timeline-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 8px;
}

.timeline-header {
  margin-bottom: 12px;
}

.timeline-dates {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-date i {
  font-size: 0.7rem;
}

.timeline-remaining {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.timeline-remaining--emerald { color: var(--emerald-light); }
.timeline-remaining--amber { color: var(--amber-light); }
.timeline-remaining--rose { color: var(--rose-light); }

.timeline-bar {
  height: 10px;
  border-radius: 9999px;
  background: var(--surface-3);
  overflow: hidden;
  margin-bottom: 10px;
}

.timeline-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.8s var(--ease);
  min-width: 2px;
}

.timeline-fill--emerald {
  background: linear-gradient(90deg, var(--emerald), var(--emerald-light));
}

.timeline-fill--amber {
  background: linear-gradient(90deg, var(--amber), var(--amber-light));
}

.timeline-fill--rose {
  background: linear-gradient(90deg, var(--rose), var(--rose-light));
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
}

.timeline-label {
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* --- Rating Card --- */
.rating-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.rating-grade-container {
  text-align: center;
  flex-shrink: 0;
}

.rating-grade {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.rating-grade--a {
  background: var(--emerald-dim);
  color: var(--emerald-light);
  border: 2px solid rgba(16,185,129,0.3);
}

.rating-grade--b {
  background: var(--cyan-dim);
  color: var(--cyan-light);
  border: 2px solid rgba(6,182,212,0.3);
}

.rating-grade--c {
  background: var(--amber-dim);
  color: var(--amber-light);
  border: 2px solid rgba(245,158,11,0.3);
}

.rating-grade--d {
  background: rgba(251,146,60,0.12);
  color: #fb923c;
  border: 2px solid rgba(251,146,60,0.3);
}

.rating-grade--f {
  background: var(--rose-dim);
  color: var(--rose-light);
  border: 2px solid rgba(244,63,94,0.3);
}

.rating-score {
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-weight: 500;
}

.rating-details {
  flex: 1;
  min-width: 0;
}

.rating-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.rating-item:last-child {
  border-bottom: none;
}

.rating-item-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
}

.rating-item-icon--pass {
  background: var(--emerald-dim);
  color: var(--emerald-light);
}

.rating-item-icon--partial {
  background: var(--amber-dim);
  color: var(--amber-light);
}

.rating-item-icon--fail {
  background: var(--rose-dim);
  color: var(--rose-light);
}

.rating-item-text {
  font-size: 0.82rem;
  color: var(--text-2);
  flex: 1;
}

.rating-item-points {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-3);
  white-space: nowrap;
}

/* --- Info Card --- */
.info-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 32px;
}

.info-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--indigo-dim);
  color: var(--indigo-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.info-content h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
}

.info-content p {
  font-size: 0.84rem;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 8px;
}

.info-content p:last-child {
  margin-bottom: 0;
}

.info-content strong {
  color: var(--text-1);
}

/* --- Footer --- */
.site-footer {
  margin-top: auto;
  padding: 24px;
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-3);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-link {
  font-size: 0.75rem;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover { color: var(--text-2); }

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface-0);
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-1);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  transition: all 0.4s var(--ease);
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-text { font-size: 0.85rem; flex: 1; min-width: 0; }

/* --- Version --- */
.version-number {
  position: fixed;
  bottom: 10px;
  left: 10px;
  color: var(--text-3);
  font-size: 0.65rem;
  z-index: 101;
  font-family: var(--font-mono);
}

/* --- Focus --- */
.btn-scan:focus-visible,
.domain-input:focus-visible,
.logo-link:focus-visible,
.header-back:focus-visible,
.footer-link:focus-visible {
  outline: 2px solid var(--indigo-light);
  outline-offset: 2px;
  border-radius: 8px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .details-grid {
    grid-template-columns: 1fr;
  }

  .detail-card--wide {
    grid-column: auto;
  }

  .overview-card {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 24px 20px;
  }

  .rating-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }

  .hero {
    padding: 36px 20px 24px;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .timeline-dates {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.4rem;
  }

  .hero p {
    font-size: 0.88rem;
  }

  .input-row {
    flex-wrap: wrap;
  }

  .input-prefix {
    padding: 10px 0 0 16px;
    font-size: 0.8rem;
  }

  .domain-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .btn-scan {
    width: calc(100% - 24px);
    justify-content: center;
    margin: 8px 12px 12px;
  }

  .overview-shield {
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
    border-radius: 14px;
  }

  .rating-grade {
    width: 64px;
    height: 64px;
    font-size: 1.8rem;
  }

  .detail-card {
    padding: 14px 12px;
    gap: 10px;
  }

  .detail-icon {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Print --- */
@media print {
  .bg-scene, .toast, .version-number, .header, .input-section, .loading-section { display: none; }
  body { background: white; color: black; }
  .overview-card, .detail-card, .timeline-card, .rating-card, .info-card {
    border: 1px solid #ccc;
    background: white;
  }
  .overview-status, .detail-value, .detail-label, .timeline-remaining,
  .rating-grade, .rating-item-text, .info-content p, .info-content h3 {
    color: black !important;
    -webkit-text-fill-color: black !important;
  }
  .section-divider-label { color: #333 !important; }
  .section-divider-line { background: #ccc; }
  .page { min-height: auto; }
}
