/* ============================================================
   ipkoto — Design System & Styles
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Colors */
  --bg-primary: #07070d;
  --bg-secondary: #0e0e1a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --border-card: rgba(255, 255, 255, 0.07);
  --border-card-hover: rgba(255, 255, 255, 0.14);

  --text-primary: #e8e6f0;
  --text-secondary: #9590ab;
  --text-muted: #5e5a72;

  --accent-purple: #6c5ce7;
  --accent-purple-light: #a855f7;
  --accent-cyan: #00d2ff;
  --accent-blue: #3a7bd5;

  --success: #00e676;
  --warning: #ffa726;
  --danger: #ff5252;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6c5ce7, #a855f7);
  --gradient-secondary: linear-gradient(135deg, #00d2ff, #3a7bd5);
  --gradient-hero: linear-gradient(135deg, #6c5ce7 0%, #a855f7 50%, #00d2ff 100%);

  /* Shadows */
  --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px rgba(108, 92, 231, 0.15);

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 600px 400px at 20% 20%, rgba(108, 92, 231, 0.08), transparent),
    radial-gradient(ellipse 500px 350px at 80% 80%, rgba(0, 210, 255, 0.06), transparent),
    radial-gradient(ellipse 400px 300px at 50% 50%, rgba(168, 85, 247, 0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(108, 92, 231, 0.4);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(108, 92, 231, 0.6);
}

/* ---------- Layout ---------- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.header {
  padding: 32px 0 16px;
  text-align: center;
}

.logo-container {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.logo-img {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(108, 92, 231, 0.4));
  transition: var(--transition-smooth);
}

.logo-container:hover .logo-img {
  filter: drop-shadow(0 0 24px rgba(108, 92, 231, 0.6));
  transform: scale(1.05);
}

.logo-text {
  font-size: 36px;
  font-weight: 800;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.header-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 400;
  margin-top: 4px;
}

.header-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ---------- Hero IP Section ---------- */
.hero-section {
  margin: 32px 0;
  text-align: center;
}

.hero-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(108, 92, 231, 0.5), rgba(0, 210, 255, 0.5), transparent);
}

.hero-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.ip-display {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  margin-bottom: 24px;
}

.ip-block {
  text-align: center;
  min-width: 200px;
}

.ip-block-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ip-block-label.ipv4 {
  color: var(--accent-purple-light);
}

.ip-block-label.ipv6 {
  color: var(--accent-cyan);
}

.ip-value {
  font-size: 32px;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  word-break: break-all;
}

.ip-value.loading {
  color: var(--text-muted);
  font-size: 16px;
}

.ip-isp {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
  min-height: 18px;
}

.ip-copy-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  margin-top: 8px;
  transition: var(--transition-fast);
  font-family: 'Inter', sans-serif;
}

.ip-copy-btn:hover {
  background: rgba(108, 92, 231, 0.2);
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

.ip-copy-btn.copied {
  background: rgba(0, 230, 118, 0.15);
  border-color: var(--success);
  color: var(--success);
}

/* ---------- Privacy Score ---------- */
.privacy-score-container {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.score-ring {
  position: relative;
  width: 120px;
  height: 120px;
}

.score-ring svg {
  transform: rotate(-90deg);
  width: 120px;
  height: 120px;
}

.score-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 8;
}

.score-ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.5s ease;
}

.score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  font-weight: 800;
}

.score-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.score-detail {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 400px;
  text-align: center;
}

/* ---------- Section Grid ---------- */
.sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 32px 0;
}

.section-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
}

.section-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-card-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.section-card.full-width {
  grid-column: 1 / -1;
}

.section-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--section-accent, rgba(108,92,231,0.3)), transparent);
}

.section-card.accent-purple { --section-accent: rgba(108, 92, 231, 0.4); }
.section-card.accent-cyan { --section-accent: rgba(0, 210, 255, 0.4); }
.section-card.accent-green { --section-accent: rgba(0, 230, 118, 0.4); }
.section-card.accent-orange { --section-accent: rgba(255, 167, 38, 0.4); }
.section-card.accent-red { --section-accent: rgba(255, 82, 82, 0.4); }

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.section-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.accent-purple .section-icon {
  background: rgba(108, 92, 231, 0.15);
}
.accent-cyan .section-icon {
  background: rgba(0, 210, 255, 0.15);
}
.accent-green .section-icon {
  background: rgba(0, 230, 118, 0.15);
}
.accent-orange .section-icon {
  background: rgba(255, 167, 38, 0.15);
}
.accent-red .section-icon {
  background: rgba(255, 82, 82, 0.15);
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------- Data Table ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition-fast);
}

.data-table tr:last-child {
  border-bottom: none;
}

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

.data-table td {
  padding: 10px 0;
  font-size: 13px;
  vertical-align: top;
}

.data-table td:first-child {
  color: var(--text-secondary);
  font-weight: 500;
  width: 40%;
  padding-right: 16px;
  white-space: nowrap;
}

.data-table td:last-child {
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-all;
}

/* ---------- Status Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-safe {
  background: rgba(0, 230, 118, 0.12);
  color: var(--success);
  border: 1px solid rgba(0, 230, 118, 0.2);
}

.badge-warning {
  background: rgba(255, 167, 38, 0.12);
  color: var(--warning);
  border: 1px solid rgba(255, 167, 38, 0.2);
}

.badge-danger {
  background: rgba(255, 82, 82, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 82, 82, 0.2);
}

.badge-info {
  background: rgba(0, 210, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 210, 255, 0.2);
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ---------- Map Container (Google Maps) ---------- */
.map-container {
  width: 100%;
  height: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-card);
  margin-top: 16px;
}

#map {
  height: 100%;
  width: 100%;
  background: var(--bg-secondary);
}



/* Map placeholder when key is not set */
.map-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.map-placeholder .map-placeholder-icon {
  font-size: 48px;
  opacity: 0.4;
}

/* ---------- Activate Button ---------- */
.activate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: 'Inter', sans-serif;
  margin-top: 12px;
}

.activate-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 0 24px rgba(108, 92, 231, 0.3);
}

.activate-btn:active {
  transform: scale(0.98);
}

.activate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.activate-btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.activate-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

/* ---------- WebRTC Results ---------- */
.webrtc-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.webrtc-ip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.webrtc-ip-item .ip-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  word-break: break-all;
  margin-bottom: 4px;
}

.ip-isp {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
  min-height: 18px;
}

.webrtc-ip-item .ip-text {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 14px;
  font-weight: 500;
}

.webrtc-ip-item .ip-type {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---------- DNS Results ---------- */
.dns-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dns-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.dns-item .dns-server {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 14px;
}

.dns-item .dns-provider {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---------- Loading States ---------- */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
  display: inline-block;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(108, 92, 231, 0.2);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 48px 0 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 48px;
}

.footer-text {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-text a {
  color: var(--accent-purple-light);
  text-decoration: none;
  transition: var(--transition-fast);
}

.footer-text a:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.footer-brand-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.footer-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(108, 92, 231, 0.3));
}

.footer-brand {
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Reveal Animation ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.hero-card {
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ---------- Tooltip ---------- */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-card);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: var(--transition-fast);
  z-index: 100;
  max-width: 280px;
  white-space: normal;
  text-align: center;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ---------- Flag Emoji ---------- */
.country-flag {
  font-size: 20px;
  margin-right: 4px;
  vertical-align: middle;
}

/* ---------- Geolocation prompt ---------- */
.geo-prompt {
  text-align: center;
  padding: 16px;
}

.geo-prompt p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ---------- Connection Bars ---------- */
.connection-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
  margin-left: 8px;
  display: inline-flex;
  vertical-align: middle;
}

.connection-bar {
  width: 4px;
  border-radius: 2px;
  background: var(--text-muted);
  transition: var(--transition-fast);
}

.connection-bar.active {
  background: var(--success);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .app-container {
    padding: 0 16px;
  }

  .sections-grid {
    grid-template-columns: 1fr;
  }

  .hero-card {
    padding: 32px 20px;
  }

  .ip-value {
    font-size: 22px;
  }

  .logo-text {
    font-size: 28px;
  }

  .ip-display {
    flex-direction: column;
    gap: 20px;
  }

  .data-table td:first-child {
    width: auto;
    white-space: normal;
  }

  .section-card {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .ip-value {
    font-size: 18px;
  }

  .score-ring {
    width: 100px;
    height: 100px;
  }

  .score-ring svg {
    width: 100px;
    height: 100px;
  }

  .score-value {
    font-size: 26px;
  }
}
