/*
 * MioIP.info - Light Theme
 * ===================================
 * To activate, change the <link> in index.php:
 *   <link rel="stylesheet" href="styles-light.css" />
 *
 * Palette: warm off-white background, slate text,
 * teal-ocean primary (#0e7490), soft sage accent.
 * Professional and easy on the eyes in daylight.
 */

/* ── Color Palette ── */
:root {
  --color-background:           #f8f9fb;
  --color-foreground:           #1e293b;
  --color-card:                 #ffffff;
  --color-card-foreground:      #1e293b;
  --color-primary:              #0e7490;
  --color-primary-foreground:   #ffffff;
  --color-secondary:            #f1f5f9;
  --color-secondary-foreground: #475569;
  --color-muted:                #f1f5f9;
  --color-muted-foreground:     #64748b;
  --color-accent:               #0d9488;
  --color-accent-foreground:    #ffffff;
  --color-border:               #e2e8f0;
  --color-input:                #e2e8f0;
  --color-ring:                 #0e7490;

  /* Guide modal */
  --guide-bg:                   #ffffff;
  --guide-border:               #e2e8f0;
  --guide-heading:              #1e293b;
  --guide-subheading:           #0e7490;
  --guide-text:                 #475569;
  --guide-strong:               #1e293b;
  --guide-overlay-bg:           rgba(15, 23, 42, 0.3);

  /* Toast */
  --toast-bg:                   rgba(239, 68, 68, 0.08);
  --toast-color:                #dc2626;
  --toast-border:               rgba(239, 68, 68, 0.2);
}

/* ── Base ── */
* {
  border-color: var(--color-border);
}

body {
  background-color: var(--color-background);
  color: var(--color-foreground);
  font-family: 'Inter', system-ui, sans-serif;
}

/* ── Animations ── */
.reveal-ip {
  animation: revealUp 0.7s ease-out forwards;
}

.reveal-hostname {
  animation: revealUp 0.5s ease-out 0.2s forwards;
  opacity: 0;
}

@keyframes revealUp {
  from { opacity: 0; transform: translateY(1rem); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── IP Display: fluid sizing, wraps for IPv6 ── */
.ip-display {
  font-size: clamp(2.75rem, 9vw, 4.5rem);
  overflow-wrap: break-word;
  max-width: 100%;
}

/* ── Copy Button States ── */
.copy-btn .fa-check { display: none; }
.copy-btn.copied .fa-copy { display: none; }
.copy-btn.copied .fa-check { display: inline; color: var(--color-accent); }

/* ── Toggle Loading Pulse ── */
@keyframes togglePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
.toggle-loading {
  animation: togglePulse 0.8s ease-in-out infinite;
}

/* ── Toggle Error Flash ── */
.toggle-error {
  background: rgba(239, 68, 68, 0.7) !important;
  color: white !important;
}

/* ── Hero Glow (softer, warmer for light bg) ── */
.hero-glow {
  position: absolute;
  top: -10rem;
  left: 50%;
  height: 20rem;
  width: 600px;
  transform: translateX(-50%);
  border-radius: 9999px;
  background: rgba(14, 116, 144, 0.06);
  filter: blur(48px);
}

/* ── Toast Notification ── */
.ip-toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% - 5rem);
  font-size: 0.75rem;
  white-space: nowrap;
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--toast-bg);
  color: var(--toast-color);
  border: 1px solid var(--toast-border);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.ip-toast.visible {
  opacity: 1;
}

/* ── Guide Modal Overlay ── */
.guide-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--guide-overlay-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: center;
  align-items: start;
  padding: 2rem 1rem;
  overflow-y: auto;
}
.guide-overlay.open {
  display: flex;
}

/* ── Guide Modal Content ── */
.guide-content {
  background: var(--guide-bg);
  border: 1px solid var(--guide-border);
  border-radius: 1rem;
  max-width: 48rem;
  width: 100%;
  padding: 2rem;
  position: relative;
  margin: 2rem 0;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.1);
}
.guide-content h2 {
  color: var(--guide-heading);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.guide-content h3 {
  color: var(--guide-subheading);
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.guide-content p {
  color: var(--guide-text);
  font-size: 0.875rem;
  line-height: 1.7;
  margin-bottom: 0.75rem;
}
.guide-content ul {
  color: var(--guide-text);
  font-size: 0.875rem;
  line-height: 1.7;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}
.guide-content li {
  margin-bottom: 0.5rem;
}
.guide-content strong {
  color: var(--guide-strong);
}

/* ── Light-specific: subtle card shadow ── */
.group.rounded-xl {
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.group.rounded-xl:hover {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

/* ── Detail Cards: pointer cursor on truncated values ── */
#detail-cards-grid > div {
  cursor: pointer;
  user-select: none;
}

/* ── Card Popover / Clone ── */
.card-popover-clone {
  position: relative;
  z-index: 80;
  background: var(--color-card);
  border: 1px solid var(--color-primary);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(14, 116, 144, 0.15);
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.card-popover-clone.card-popover-visible {
  opacity: 1;
  transform: scale(1);
}

/* Value text: no truncation, word-wrap */
.card-popover-value {
  white-space: normal;
  word-break: break-all;
  overflow-wrap: break-word;
  line-height: 1.6;
}

/* Copy button inside popover */
.card-popover-copy {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  color: var(--color-muted-foreground);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  font-size: 0.875rem;
}
.card-popover-copy:hover {
  color: var(--color-foreground);
  background: var(--color-secondary);
}

/* Mobile: fixed modal centered */
.card-popover-mobile {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: calc(100vw - 2rem);
  max-width: 24rem;
  min-height: 5rem;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 110;
}
.card-popover-mobile.card-popover-visible {
  transform: translate(-50%, -50%) scale(1);
}

/* Dim overlay (mobile) */
.card-popover-dim {
  position: fixed;
  inset: 0;
  z-index: 105;
  background: var(--guide-overlay-bg);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.card-popover-dim.card-popover-dim-visible {
  opacity: 1;
}

/* ── Small-screen IP fix (≤ 420px logical width) ── */
@media (max-width: 420px) {
  .ip-display {
    box-sizing: border-box;
    width: 100vw;
    max-width: 100vw;
    position: relative;
    left: 50%;
    margin-left: -50vw;
    margin-right: 0;
    text-align: center !important;
    display: block;
    text-wrap: nowrap !important;
    white-space: nowrap !important;
    font-size: 10vw;
    letter-spacing: -0.07em !important;
    padding: 0;
  }
#hostname-display {
    word-break: normal !important;
    overflow-wrap: break-word !important;
  }
}
/* ══════════════════════════════════════════════════════════════════
   Tab system + VPN panel (aggiunte beta)
   ══════════════════════════════════════════════════════════════════ */

/* ── Scrollbar stabile (evita layout shift al cambio tab) ── */
html { scrollbar-gutter: stable; }

/* ── Tab Menu ─────────────────────────────────────────────── */
.tab-btn {
  position: relative;
  /* padding: 0.625rem 1.25rem; */
  padding: 0.41rem 0.97rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-muted-foreground);
  transition: color 0.2s, background 0.2s;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  white-space: nowrap;
  border: none;
  background: none;
}
.tab-btn:hover {
  color: var(--color-secondary-foreground, var(--color-foreground));
  background: color-mix(in srgb, var(--color-secondary) 50%, transparent);
}
.tab-btn.active {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 1rem;
  right: 1rem;
  height: 2px;
  background: var(--color-primary);
  border-radius: 1px;
}
.tab-btn i {
  font-size: 0.875rem;
  width: 1rem;
  text-align: center;
}

/* ── Tab panels ────────────────────────────────────────────── */
.tab-panel { display: none; animation: fadeInTab 0.3s ease-out; }
.tab-panel.active { display: block; }
@keyframes fadeInTab {
  from { opacity: 0; transform: translateY(0.5rem); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Score badge ───────────────────────────────────────────── */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1.125rem;
  flex-shrink: 0;
}
.score-clean {
  background: rgba(43, 181, 137, 0.12);
  color: #2bb589;
  border: 2px solid rgba(43, 181, 137, 0.3);
}
.score-suspect {
  background: rgba(234, 179, 8, 0.12);
  color: #eab308;
  border: 2px solid rgba(234, 179, 8, 0.3);
}
.score-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 2px solid rgba(239, 68, 68, 0.3);
}
.score-na {
  background: color-mix(in srgb, var(--color-muted-foreground) 12%, transparent);
  color: var(--color-muted-foreground);
  border: 2px solid color-mix(in srgb, var(--color-muted-foreground) 30%, transparent);
}

/* ── Search input ──────────────────────────────────────────── */
.ip-search-input {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-foreground);
  font-family: 'JetBrains Mono', monospace;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ip-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 10%, transparent);
}
.ip-search-input::placeholder {
  color: var(--color-muted-foreground);
  font-family: 'Inter', system-ui, sans-serif;
}

/* ── Loading spinner ───────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.scan-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
