/* ═══════════════════════════════════════════════════
   IP CHECKER PRO — style.css
   WebKaar | Ayush Tiwari | Ultimate Edition
   All styles scoped — no conflict with parent CSS
═══════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════
   LAYOUT
════════════════════════════════════════════════ */
.tool-container {
  max-width: 600px;
  margin: 20px auto;
  padding: 0 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ════════════════════════════════════════════════
   MAIN IP CARD
════════════════════════════════════════════════ */
.ip-card {
  background: linear-gradient(135deg, var(--primary-blue, #2563eb), var(--primary-dark, #1d4ed8));
  padding: 22px 24px 26px;
  border-radius: 22px;
  color: white;
  box-shadow: 0 12px 36px -6px rgba(37, 99, 235, 0.45);
  transition: background 0.4s ease, box-shadow 0.4s ease;
  position: relative;
  overflow: hidden;
}

/* Subtle shimmer bg */
.ip-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  pointer-events: none;
}

/* Offline / Error state */
.ip-card.offline-mode {
  background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
  box-shadow: 0 12px 36px -6px rgba(239, 68, 68, 0.45) !important;
}

/* Card header row */
.card-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 12px;
}

.label {
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0.85;
  margin: 0;
  white-space: nowrap;
}

/* IP number display */
.ip-number {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 0 0 18px;
  word-break: break-all;
  line-height: 1.15;
}
@media (max-width: 380px) {
  .ip-number { font-size: 1.9rem; }
}

/* Copy button on card */
.card-icon-btn {
  background: rgba(255,255,255,0.18) !important;
  border: 1px solid rgba(255,255,255,0.25) !important;
  color: white !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 10px !important;
  flex-shrink: 0;
}
.card-icon-btn:hover {
  background: rgba(255,255,255,0.30) !important;
  transform: translateY(-2px);
}
.card-icon-btn:active { transform: scale(0.92) !important; }

/* ── IPv4/IPv6 Toggle ──────────────────────────── */
.ip-version-toggle {
  display: flex;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.ver-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  white-space: nowrap;
}
.ver-btn.active {
  background: rgba(255,255,255,0.9);
  color: var(--primary-blue, #2563eb);
}
.ver-btn:not(.active):hover {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* ── Badges Row ───────────────────────────────── */
.badges-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.isp-badge {
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  white-space: nowrap;
}

/* VPN warning badge */
.vpn-badge {
  background: rgba(239,68,68,0.85) !important;
  border-color: rgba(239,68,68,0.5) !important;
  animation: vpnPulse 2s ease-in-out infinite;
}
@keyframes vpnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* ════════════════════════════════════════════════
   DETAILS WRAPPER
════════════════════════════════════════════════ */
.details-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeSlideUp 0.4s ease;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Map ──────────────────────────────────────── */
.map-container {
  width: 100%;
  height: 190px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  position: relative;
}
.map-container iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Section Title ────────────────────────────── */
.section-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 6px 0 -4px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.section-title i {
  color: var(--primary-blue);
  font-size: 18px;
}

/* Beta badge */
.section-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: rgba(245,158,11,0.15);
  color: #d97706;
  border: 1px solid rgba(245,158,11,0.3);
  padding: 2px 8px;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Details Grid ─────────────────────────────── */
.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 400px) {
  .details-grid { grid-template-columns: 1fr; }
}

.detail-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 14px 16px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}
.detail-item:hover { border-color: var(--primary-blue); }

.detail-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.detail-label i {
  color: var(--primary-blue);
  font-size: 15px;
}

.detail-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  word-break: break-word;
}
/* Smaller text for long values */
.detail-value--sm {
  font-size: 0.88rem !important;
}

/* Security status colors */
.sec-safe  { color: #10b981; }
.sec-warn  { color: #ef4444; }
.sec-unknown { color: var(--text-muted); }

/* ════════════════════════════════════════════════
   BLACKLIST BOX
════════════════════════════════════════════════ */
.blacklist-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.blacklist-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
}

.blacklist-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.blacklist-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 800;
}
.blacklist-status.clean { color: #10b981; }
.blacklist-status.listed { color: #ef4444; }

.blacklist-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: right;
}

/* ════════════════════════════════════════════════
   LATENCY GRID
════════════════════════════════════════════════ */
.latency-placeholder {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 0;
}

.latency-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 400px) {
  .latency-grid { grid-template-columns: 1fr; }
}

.latency-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}
.latency-item:hover { border-color: var(--primary-blue); }

.latency-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.latency-info { flex: 1; min-width: 0; }

.latency-server {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.latency-ms {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

/* Latency color coding */
.latency-fast   { color: #10b981; }
.latency-medium { color: #f59e0b; }
.latency-slow   { color: #ef4444; }
.latency-fail   { color: var(--text-muted); }

/* Ping bar */
.latency-bar-wrap {
  height: 3px;
  background: var(--border-color);
  border-radius: 100px;
  margin-top: 4px;
  overflow: hidden;
}
.latency-bar {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s ease;
}

/* ════════════════════════════════════════════════
   IP HISTORY
════════════════════════════════════════════════ */
.section-title .clear-history-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 50px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}
.section-title .clear-history-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239,68,68,0.06);
}

.ip-history-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.history-empty {
  padding: 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  margin: 0;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--bg-body); }

.history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-blue);
  flex-shrink: 0;
  opacity: 0.6;
}
.history-dot.current { opacity: 1; background: #10b981; }

.history-ip {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-main);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.history-copy {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  font-size: 14px;
  transition: color 0.2s;
  flex-shrink: 0;
}
.history-copy:hover { color: var(--primary-blue); }

/* ════════════════════════════════════════════════
   REFRESH BUTTON
════════════════════════════════════════════════ */
.secondary-btn {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  color: var(--text-main);
  padding: 15px 20px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.secondary-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  background: var(--bg-body);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37,99,235,0.15);
}
.secondary-btn:active { transform: scale(0.97); }
.secondary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.mt-4 { margin-top: 4px; }
.full-width { width: 100%; }

/* ════════════════════════════════════════════════
   TOAST
════════════════════════════════════════════════ */
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: #1a1f2e;
  color: #fff;
  padding: 11px 22px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 9999;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 4px solid #10b981;
}
.toast.toast--error { border-left-color: #ef4444; }
.toast.toast--visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════════════════
   INFO MODAL
════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 9000;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: opacity 0.25s;
}
.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* NOT display:none — preserve fade animation */
}

.modal-content {
  background: var(--bg-surface);
  width: 100%;
  max-width: 520px;
  border-radius: 28px 28px 0 0;
  border: 1px solid var(--border-color);
  border-bottom: none;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -16px 40px rgba(0,0,0,0.2);
  animation: sheetUp 0.3s cubic-bezier(0.34, 1.16, 0.64, 1);
}
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* Drag handle */
.modal-content::before {
  content: '';
  display: block;
  width: 38px;
  height: 4px;
  background: var(--border-color);
  border-radius: 100px;
  margin: 10px auto 0;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.modal-body { padding: 16px 20px 32px; }

.info-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.info-list li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  font-weight: 500;
}
.info-list li:last-child { border-bottom: none; }
.info-list li i {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}
.info-list li strong {
  display: block;
  color: var(--text-main);
  font-weight: 800;
  font-size: 0.92rem;
  margin-bottom: 2px;
}

/* Desktop modal — centered */
@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
  .modal-content {
    border-radius: 24px;
    border: 1px solid var(--border-color);
    max-width: 440px;
  }
  .modal-content::before { display: none; }
}

/* ════════════════════════════════════════════════
   UTILITY
════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* Spinner from phosphor */
.ph-spin {
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════
   DARK MODE TWEAKS
════════════════════════════════════════════════ */
.dark-mode .ip-card {
  box-shadow: 0 12px 36px -6px rgba(37,99,235,0.35);
}
.dark-mode .detail-item:hover {
  background: var(--bg-body);
}
.dark-mode .toast {
  background: #0d1120;
}
.dark-mode .modal-content {
  box-shadow: 0 -20px 60px rgba(0,0,0,0.5);
}

/* ════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════ */
@media (max-width: 380px) {
  .tool-container { padding: 0 12px 120px; }
  .ip-card { padding: 18px 18px 22px; }
  .detail-item { padding: 12px 14px; }
  .secondary-btn { font-size: 0.92rem; padding: 14px 16px; }
  .latency-item { padding: 10px 12px; }
}