/* ========================================
   RESET & BASE STYLES
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background-color: #fafafa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

/* ========================================
   DESKTOP STYLES
   ======================================== */

/* ----- Layout Container ----- */
.container {
  width: 100%;
  max-width: 660px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto;
}

/* ----- Google Logo ----- */
.logo {
  font-size: 90px;
  font-weight: normal;
  color: #4285f4;
  margin-bottom: 30px;
  text-decoration: none;
  letter-spacing: -5px;
  cursor: pointer;
}

.logo span:nth-child(1) { color: #4285f4; }
.logo span:nth-child(2) { color: #ea4335; }
.logo span:nth-child(3) { color: #fbbc05; }
.logo span:nth-child(4) { color: #4285f4; }
.logo span:nth-child(5) { color: #34a853; }
.logo span:nth-child(6) { color: #ea4335; }

/* ----- Search Section ----- */
.search-container {
  width: 100%;
  position: relative;
  margin-bottom: 30px;
}

.search-box {
  width: 100%;
  height: 60px;
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  padding: 0 45px 0 16px;
  font-size: 26px !important;
  outline: none;
  box-shadow: 0 2px 5px 1px rgba(64, 60, 67, .16);
  transition: box-shadow .8s;
  text-align: center;
}

.search-box:hover,
.search-box:focus {
  box-shadow: 0 2px 8px 1px rgba(64, 60, 67, .24);
}

.search-button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: #4285f4;
  color: #fff;
  border: none;
  border-radius: 20px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.search-button:hover {
  background: #3367d6;
}

/* ----- Payoff & Subtitle ----- */
.payoff p {
  font-family: Arial, sans-serif;
  font-size: 24px;
  color: #777;
  text-align: center;
  margin-bottom: 40px;
}

.subtitle {
  font-size: 14px !important;
  color: #5f6368;
  margin-bottom: 30px;
  margin-top: 30px;
  text-align: center;
  font-weight: normal;
}

.subtitle a {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 500;
}

.subtitle a:hover {
  text-decoration: underline;
}

/* ----- Results Section ----- */
.results {
  width: 600px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 30px;
  margin-top: 20px;
  display: none;
}

.results.show {
  display: block;
}

.result-item {
  margin-bottom: 20px;
  padding: 15px;
  border-left: 4px solid #4285f4;
  background: #f8f9fa;
  border-radius: 0 4px 4px 0;
  position: relative;
}

.result-label {
  font-weight: bold;
  color: #202124;
  margin-bottom: 5px;
}

.result-value {
  color: #5f6368;
  word-break: break-all;
}

/* Result States */
.error {
  background: #fce8e6;
  border-left-color: #ea4335;
  color: #d93025;
}

.success {
  background: #e6f4ea;
  border-left-color: #34a853;
  color: #137333;
}

.warning {
  background: #fef7e0;
  border-left-color: #fbbc05;
  color: #ea8600;
}

/* ----- Tooltips ----- */
.tooltip-icon {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #424242;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  z-index: 10;
}

.tooltip {
  position: absolute;
  top: 40px;
  right: 15px;
  background: #333;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
  z-index: 1000;
}

.tooltip::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 20px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #333;
}

.tooltip-icon:hover + .tooltip {
  opacity: 1;
  visibility: visible;
}

.tooltip strong {
  color: #ff6b6b;
}

.tooltip .recommendation {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #555;
  color: #4ade80;
}

/* ----- Dropdown ----- */
.dropdown-icon {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #4285f4;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: transform .3s;
}

.dropdown-icon:hover {
  background: #3367d6;
}

.dropdown-icon.expanded {
  transform: translateY(-50%) rotate(180deg);
}

/* ----- HTTP Headers ----- */
.http-headers {
  max-height: 0;
  overflow: hidden;
  background: #f1f3f4;
  border-radius: 4px;
  margin-top: 10px;
  transition: max-height .3s ease;
}

.http-headers.expanded {
  max-height: 400px;
  padding: 15px;
  border: 1px solid #dadce0;
}

.http-headers pre {
  margin: 0;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #202124;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ----- Flags ----- */
.country-flag {
  width: 20px;
  height: 15px;
  margin-left: 8px;
  vertical-align: middle;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: inline-block;
}

.flag-fallback {
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
  font-size: 16px;
}

/* ----- Share Card ----- */
.share-card {
  width: 600px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 30px;
  margin-top: 30px;
}

.share-title {
  font-weight: 600;
  color: #202124;
  margin-bottom: 12px;
}

.share-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.share-link {
  flex: 1;
  min-width: 220px;
  padding: 10px;
  border: 1px solid #dfe1e5;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  color: #202124;
  background: #f8f9fa;
}

.share-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.share-btn {
  background: #4285f4;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.share-btn:hover {
  background: #3367d6;
}

.share-btn.secondary { background: #111; }
.share-btn.whatsapp { background: #25D366; }
.share-btn.mail { background: #6c757d; }
.share-btn.fb { background: #1877F2; }
.share-btn.li { background: #0A66C2; }
.share-btn.x { background: #111; }

.share-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
}

/* ----- Mail Card ----- */
.mail-card {
  width: 600px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 30px;
  margin-top: 20px;
}

.mail-title {
  font-weight: 600;
  color: #202124;
  margin-bottom: 12px;
}

.mail-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.mail-input {
  flex: 1;
  min-width: 220px;
  padding: 10px;
  border: 1px solid #dfe1e5;
  border-radius: 8px;
  font-size: 15px;
  color: #202124;
  background: #fff;
}

.mail-input:focus {
  outline: none;
  border-color: #4285f4;
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.share-btn.mail {
  background: #ea4335;
}

.share-btn.mail:hover {
  background: #d33426;
}

.mail-status {
  margin-top: 10px;
  font-size: 14px;
  min-height: 20px;
}

.mail-status.success {
  color: #137333;
}

.mail-status.error {
  color: #d93025;
}

.mail-status.loading {
  color: #5f6368;
}

/* ----- Rating Card ----- */
.rating-card {
  width: 600px;
  margin: 30px auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 30px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.rating-title {
  font-weight: 600;
  color: #202124;
  text-align: center;
  font-size: 15px;
  margin-bottom: 8px;
}

.score-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 600;
}

.score-ring {
  transform: rotate(-90deg);
}

.score-bg {
  stroke: #f2f2f2;
}

.score-fg {
  transition: stroke 0.25s ease;
}

/* Core Web Vitals Colors */
.score-green { color: #22c55e; }
.score-orange { color: #f59e0b; }
.score-red { color: #ef4444; }
.stroke-green { stroke: #22c55e; }
.stroke-orange { stroke: #f59e0b; }
.stroke-red { stroke: #ef4444; }

/* ----- Judgment Card ----- */
.judgment-card {
  width: 600px;
  margin: 30px auto 0 auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.judge-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 48px;
}

.judge-text {
  font-size: 20px;
  color: #202124;
}

.judge-text .state {
  font-weight: 700;
  text-decoration: none;
}

/* Judgment Colors */
.judge-red { color: #ef4444; }
.judge-orange { color: #f59e0b; }
.judge-green { color: #22c55e; }

.judge-bg-red { background: rgba(239, 68, 68, .12); }
.judge-bg-orange { background: rgba(245, 158, 11, .12); }
.judge-bg-green { background: rgba(34, 197, 94, .12); }

.judge-icon svg {
  width: 32px;
  height: 32px;
  display: block;
  color: inherit;
}

/* ----- Video Player ----- */
.play-button {
  background: #3f85f5;
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 40px;
}

.play-button:hover {
  background: #3f85f5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.play-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.play-icon {
  width: 0;
  height: 0;
  border-left: 12px solid white;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.video-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.video-overlay.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.video-container {
  position: relative;
  width: 90%;
  max-width: 1200px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease;
}

.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
}

.video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.close-button {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
  transition: all 0.3s ease;
}

.close-button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: rotate(90deg);
}

.close-button::before,
.close-button::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background: white;
}

.close-button::before {
  transform: rotate(45deg);
}

.close-button::after {
  transform: rotate(-45deg);
}

.demo-container {
  text-align: center;
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.demo-container h1 {
  color: #333;
  margin-bottom: 20px;
  font-size: 28px;
}

.demo-container p {
  color: #666;
  margin-bottom: 30px;
  font-size: 16px;
}

/* ----- Overlay Loader ----- */
#overlayLoader {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: saturate(120%) blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#overlayLoader.show {
  display: flex;
}

.loader-card {
  background: #111;
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  min-width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid #2b2b2b;
  border-top-color: #fff;
  animation: spin 1s linear infinite;
}

.loader-title {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.loader-sub {
  color: #c7c7c7;
  font-size: 12px;
  text-align: center;
}

/* ----- Toast Notifications ----- */
#toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10000;
  display: none;
}

.toast-msg {
  background: #111;
  color: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
  font-size: 14px;
  max-width: 320px;
}

.toast-success {
  background: #0f5132;
}

.toast-error {
  background: #842029;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========================================
   MOBILE STYLES (max-width: 768px)
   ======================================== */
@media (max-width: 768px) {

  /* ----- Layout Adjustments ----- */
  .container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 100px;
  }

  /* ----- Logo Mobile ----- */
  .logo {
    text-align: center;
  }

  /* ----- Results Mobile ----- */
  .results {
    width: 100%;
    margin:30px auto;
  }

  /* ----- Share Card Mobile ----- */
  .share-card {
    width: 100%;
    margin:30px auto;
  }

  /* ----- Mail Card Mobile ----- */
  .mail-card {
    width: 100%;
  }

  /* ----- Rating Card Mobile ----- */
  .rating-card {
    width: 100%;
  }

  .score-number {
    font-size: 32px;
  }

  /* ----- Judgment Card Mobile ----- */
  .judgment-card {
    width: 90%;
  }

  /* ----- Video Player Mobile ----- */
  .video-container {
    width: 95%;
  }

  .close-button {
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
  }
}

/* ========================================
   PWA INSTALL BANNER
   ======================================== */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
  padding: 16px;
  z-index: 9999;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  display: none;
}

.pwa-install-banner.show {
  transform: translateY(0);
}

.pwa-install-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.pwa-install-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  background: white;
}

.pwa-install-text {
  flex: 1;
  min-width: 150px;
  color: white;
}

.pwa-install-text strong {
  display: block;
  font-size: 16px;
  margin-bottom: 2px;
}

.pwa-install-text span {
  font-size: 13px;
  opacity: 0.9;
}

.pwa-install-buttons {
  display: flex;
  gap: 10px;
}

.pwa-btn-install {
  background: white;
  color: #4285f4;
  border: none;
  padding: 10px 20px;
  border-radius: 24px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.pwa-btn-install:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.pwa-btn-dismiss {
  background: transparent;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.5);
  padding: 10px 16px;
  border-radius: 24px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.pwa-btn-dismiss:hover {
  border-color: white;
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 480px) {
  .pwa-install-content {
    flex-direction: column;
    text-align: center;
  }

  .pwa-install-text {
    min-width: auto;
  }

  .pwa-install-buttons {
    width: 100%;
    justify-content: center;
  }
}
