/* ============================================================
   TopFreeProxy — Public Proxy List Page
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #f0f4f8;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --text:       #1a202c;
  --text-2:     #4a5568;
  --muted:      #a0aec0;
  --font:       'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --primary:    #1a56db;
  --primary-dk: #1e429f;
  --primary-lt: #ebf5ff;

  --green:      #0e9f6e;
  --green-lt:   #def7ec;
  --red:        #e02424;
  --red-lt:     #fde8e8;
  --amber:      #d97706;
  --amber-lt:   #fef3c7;
  --violet:     #7e3af2;
  --violet-lt:  #edebfe;
  --cyan:       #0694a2;
  --cyan-lt:    #d5f5f6;

  --radius:     8px;
  --radius-sm:  5px;
}

body {
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top Nav ──────────────────────────────────────────────── */
.top-nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}
.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: all 0.12s;
  border: 1px solid transparent;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { color: var(--primary); background: var(--primary-lt); }
.nav-link.admin-link {
  color: var(--primary);
  border-color: #bfdbfe;
}
.nav-link.admin-link:hover { background: var(--primary-lt); }

/* ── Hero Banner ──────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1a56db 60%, #0694a2 100%);
  color: #fff;
  padding: 52px 20px 44px;
  text-align: center;
}
.hero-inner { max-width: 780px; margin: 0 auto; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.hero-badge .dot {
  width: 6px;
  height: 6px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.hero h1 {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 14px;
}
.hero h1 span { color: #93c5fd; }
.hero p {
  font-size: 16px;
  opacity: 0.85;
  max-width: 560px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

/* ── Stats row ────────────────────────────────────────────── */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.stat-card {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  padding: 14px 24px;
  text-align: center;
  min-width: 120px;
}
.stat-card .val {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}
.stat-card.green { border-color: rgba(74,222,128,0.4); }
.stat-card.green .val { color: #4ade80; }

/* ── Main content wrapper ─────────────────────────────────── */
.content-wrap {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 28px 20px 60px;
  flex: 1;
}

/* ── Filter panel ─────────────────────────────────────────── */
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 160px;
}
.filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}
.filter-select, .filter-input {
  padding: 8px 32px 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.filter-input {
  padding: 8px 10px;
  background-image: none;
}
.filter-select:focus, .filter-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.08);
}
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.btn-filter {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-filter.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-filter.primary:hover { background: var(--primary-dk); border-color: var(--primary-dk); }
.btn-filter.outline {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn-filter.outline:hover { background: var(--bg); }
.btn-filter.green {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.btn-filter.green:hover { background: #057a55; }

/* ── Table card ───────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.table-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.table-title .count-badge {
  background: var(--primary-lt);
  color: var(--primary);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.table-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.per-page-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.per-page-select {
  padding: 5px 26px 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
}
.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  font-size: 14px;
  transition: all 0.12s;
}
.icon-btn:hover { background: var(--bg); }

/* ── Proxy table ──────────────────────────────────────────── */
.proxy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.proxy-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.proxy-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: var(--text);
}
.proxy-table tbody tr:last-child td { border-bottom: none; }
.proxy-table tbody tr:hover td { background: #f8fafc; }

.ip-port {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--font);
}
.copy-btn:hover { background: var(--primary-lt); color: var(--primary); border-color: #bfdbfe; }
.copy-btn.copied { background: var(--green-lt); color: var(--green); border-color: #6ee7b7; }

/* Badges */
.proto-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.proto-badge.http   { background: #dbeafe; color: #1d4ed8; }
.proto-badge.https  { background: var(--green-lt); color: #065f46; }
.proto-badge.socks4 { background: var(--amber-lt); color: #92400e; }
.proto-badge.socks5 { background: var(--violet-lt); color: #5b21b6; }

.anon-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-2);
  white-space: nowrap;
}
.anon-badge.elite { background: var(--cyan-lt); color: var(--cyan); }
.anon-badge.anonymous { background: var(--green-lt); color: var(--green); }
.anon-badge.transparent { background: #f1f5f9; color: var(--muted); }

.flag { font-size: 18px; margin-right: 4px; }
.country-name { font-size: 12px; color: var(--text-2); }

.speed-val { font-weight: 700; font-size: 13px; }
.speed-fast { color: var(--green); }
.speed-mid  { color: var(--amber); }
.speed-slow { color: var(--red); }
.speed-na   { color: var(--muted); }

.time-val { font-size: 12px; color: var(--muted); }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state i { font-size: 40px; display: block; margin-bottom: 12px; opacity: 0.35; }
.empty-state .empty-title { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state .empty-sub { font-size: 13px; }

/* ── Table footer / pagination ────────────────────────────── */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
  flex-wrap: wrap;
  gap: 10px;
}
.pagination-info { font-size: 13px; color: var(--muted); }
.pagination-nav { display: flex; gap: 3px; align-items: center; }
.page-btn {
  min-width: 32px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s;
}
.page-btn:hover:not(:disabled):not(.active) { background: var(--bg); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-btn.ellipsis { cursor: default; border-color: transparent; background: transparent; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: #1e293b;
  color: #94a3b8;
  text-align: center;
  padding: 20px;
  font-size: 12px;
  margin-top: auto;
}
.site-footer a { color: #60a5fa; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

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

.me-1 { margin-right: 4px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero h1 { font-size: 26px; }
  .stats-row { gap: 10px; }
  .stat-card { padding: 10px 16px; }
  .stat-card .val { font-size: 20px; }
  .filter-panel { flex-direction: column; }
  .filter-group { min-width: 100%; }
  .proxy-table th:nth-child(5),
  .proxy-table td:nth-child(5),
  .proxy-table th:nth-child(7),
  .proxy-table td:nth-child(7) { display: none; }
}

@media (max-width: 640px) {
  .nav-inner { gap: 4px; }
  .nav-links { overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 2px; }
  .nav-link { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .table-footer { flex-direction: column; align-items: flex-start; gap: 8px; }
  .per-page-wrap { display: none; }
}

@media (max-width: 480px) {
  .brand-name { display: none; }
  .nav-inner { height: 48px; }
  .hero { padding: 32px 16px 28px; }
  .hero h1 { font-size: 22px; letter-spacing: -0.5px; }
  .hero p { font-size: 14px; }
  .hero-badge { font-size: 11px; padding: 3px 10px; }
  .stat-card { min-width: 80px; padding: 8px 12px; }
  .stat-card .val { font-size: 18px; }
  .content-wrap { padding: 16px 12px 40px; }
  /* Hide Country and Speed columns on very small screens */
  .proxy-table th:nth-child(4),
  .proxy-table td:nth-child(4),
  .proxy-table th:nth-child(6),
  .proxy-table td:nth-child(6) { display: none; }
  /* Hide row number column */
  .proxy-table th:nth-child(1),
  .proxy-table td:nth-child(1) { display: none; }
  .filter-panel { padding: 12px; }
  .filter-actions { width: 100%; }
  .btn-filter { flex: 1; justify-content: center; }
}
