/**
 * Visitor Statistics Styling
 * Beautiful and modern statistics display
 */

/* ===========================
   STATS SECTION CONTAINER
   =========================== */

.stats-section {
  padding: 80px 20px;
  background: linear-gradient(
    135deg,
    rgba(10, 61, 98, 0.05) 0%,
    rgba(56, 182, 255, 0.05) 100%
  );
  border-top: 2px solid rgba(56, 182, 255, 0.2);
  border-bottom: 2px solid rgba(56, 182, 255, 0.2);
}

.stats-container {
  max-width: 1200px;
  margin: 0 auto;
}

.stats-header {
  text-align: center;
  margin-bottom: 50px;
  animation: fadeInUp 0.8s ease;
}

.stats-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 15px;
  background: linear-gradient(135deg, #38b6ff, #0a3d62);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stats-subtitle {
  font-size: 1.1rem;
  color: #666;
  font-weight: 500;
}

/* ===========================
   OVERVIEW STATS (4 CARDS)
   =========================== */

.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 50px;
}

.overview-card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  border: 1px solid rgba(56, 182, 255, 0.1);
  text-align: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  animation: slideInUp 0.6s ease;
}

.overview-card:nth-child(1) {
  animation-delay: 0.1s;
}
.overview-card:nth-child(2) {
  animation-delay: 0.2s;
}
.overview-card:nth-child(3) {
  animation-delay: 0.3s;
}
.overview-card:nth-child(4) {
  animation-delay: 0.4s;
}

.overview-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(56, 182, 255, 0.15);
  border-color: rgba(56, 182, 255, 0.3);
}

.overview-label {
  font-size: 0.9rem;
  color: #999;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.overview-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: #0a3d62;
  margin-bottom: 5px;
  font-family: "Courier New", monospace;
}

.overview-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.overview-card.total {
  border-top: 4px solid #38b6ff;
}
.overview-card.day {
  border-top: 4px solid #1abc9c;
}
.overview-card.month {
  border-top: 4px solid #f39c12;
}
.overview-card.year {
  border-top: 4px solid #e74c3c;
}

/* ===========================
   TIME PERIOD FILTER
   =========================== */

.filter-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 40px;
  justify-content: center;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 10px 20px;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-btn:hover {
  border-color: #38b6ff;
  color: #38b6ff;
}

.filter-btn.active {
  background: linear-gradient(135deg, #38b6ff, #0a3d62);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(56, 182, 255, 0.3);
}

/* ===========================
   COUNTRIES LIST
   =========================== */

.countries-list {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(56, 182, 255, 0.1);
  animation: fadeInUp 0.8s ease;
}

.countries-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 30px;
  color: #0a3d62;
  display: flex;
  align-items: center;
  gap: 10px;
}

.countries-title-icon {
  font-size: 1.8rem;
}

.country-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid #f0f0f0;
  transition: all 0.3s ease;
}

.country-item:last-child {
  border-bottom: none;
}

.country-item:hover {
  background: linear-gradient(90deg, rgba(56, 182, 255, 0.05), transparent);
  padding-left: 25px;
}

.country-info {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
}

.country-flag {
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.country-details h4 {
  margin: 0;
  font-size: 1rem;
  color: #0a3d62;
  font-weight: 700;
}

.country-details p {
  margin: 3px 0 0 0;
  font-size: 0.85rem;
  color: #999;
}

.country-stats {
  display: flex;
  align-items: center;
  gap: 20px;
}

.visitor-count {
  font-size: 2rem;
  font-weight: 800;
  color: #38b6ff;
  font-family: "Courier New", monospace;
  min-width: 60px;
  text-align: right;
}

.visitor-badge {
  padding: 8px 12px;
  background: linear-gradient(
    135deg,
    rgba(56, 182, 255, 0.1),
    rgba(10, 61, 98, 0.1)
  );
  border-radius: 15px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0a3d62;
  white-space: nowrap;
  border: 1px solid rgba(56, 182, 255, 0.2);
}

.rank-badge {
  width: 35px;
  height: 35px;
  background: linear-gradient(135deg, #38b6ff, #0a3d62);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ===========================
   STATISTICS CHART
   =========================== */

.stats-chart-container {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(56, 182, 255, 0.1);
  margin-top: 40px;
  animation: fadeInUp 0.8s ease 0.2s both;
}

.chart-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 30px;
  color: #0a3d62;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 15px;
  height: 300px;
  overflow-x: auto;
  padding-bottom: 20px;
}

.chart-bar {
  flex: 1;
  min-width: 40px;
  background: linear-gradient(180deg, #38b6ff, #0a3d62);
  border-radius: 10px 10px 0 0;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(56, 182, 255, 0.2);
}

.chart-bar:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(56, 182, 255, 0.3);
}

.chart-bar-value {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 700;
  font-size: 0.85rem;
  color: #0a3d62;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chart-bar:hover .chart-bar-value {
  opacity: 1;
}

.chart-label {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: #999;
  white-space: nowrap;
  width: 100%;
  text-align: center;
}

/* ===========================
   LOADING STATE
   =========================== */

.stats-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  gap: 10px;
}

.loading-spinner {
  width: 12px;
  height: 12px;
  background: #38b6ff;
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

.loading-spinner:nth-child(1) {
  animation-delay: 0s;
}
.loading-spinner:nth-child(2) {
  animation-delay: 0.2s;
}
.loading-spinner:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 1;
  }
  40% {
    transform: translateY(-10px);
    opacity: 0.7;
  }
}

/* ===========================
   EMPTY STATE
   =========================== */

.stats-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.stats-empty-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.stats-empty-text {
  font-size: 1rem;
  margin-bottom: 10px;
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

@media (max-width: 768px) {
  .stats-title {
    font-size: 2rem;
  }

  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .overview-number {
    font-size: 2rem;
  }

  .filter-controls {
    gap: 8px;
  }

  .filter-btn {
    padding: 8px 15px;
    font-size: 0.85rem;
  }

  .country-item {
    flex-wrap: wrap;
    gap: 15px;
  }

  .country-info {
    flex: 1;
    min-width: 100%;
  }

  .country-stats {
    width: 100%;
    justify-content: space-between;
  }

  .chart-bars {
    height: 200px;
    gap: 8px;
  }

  .chart-bar {
    min-width: 30px;
  }
}

@media (max-width: 480px) {
  .stats-section {
    padding: 40px 15px;
  }

  .stats-title {
    font-size: 1.5rem;
  }

  .stats-overview {
    grid-template-columns: 1fr;
  }

  .overview-number {
    font-size: 1.8rem;
  }

  .countries-list,
  .stats-chart-container {
    padding: 20px;
  }

  .filter-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .chart-bars {
    height: 150px;
  }
}

/* ===========================
   ANIMATIONS
   =========================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   DARK MODE SUPPORT
   =========================== */

@media (prefers-color-scheme: dark) {
  .overview-card {
    background: #1a1a1a;
    border-color: rgba(56, 182, 255, 0.2);
  }

  .filter-btn {
    background: #1a1a1a;
    border-color: #333;
    color: #ccc;
  }

  .filter-btn:hover {
    border-color: #38b6ff;
    color: #38b6ff;
  }

  .countries-list,
  .stats-chart-container {
    background: #1a1a1a;
    border-color: rgba(56, 182, 255, 0.2);
  }

  .country-item {
    border-color: #333;
  }

  .country-details h4 {
    color: #fff;
  }

  .country-details p {
    color: #999;
  }

  .stats-title {
    color: #38b6ff;
  }

  .stats-subtitle,
  .country-details p {
    color: #aaa;
  }
}
