/* ========================================
   📊 Analytics Dashboard Styles
   ======================================== */

/* ========== CONTAINER ========== */
.analytics-container {
  max-width: 98%;
  padding: 0 15px;
  margin: 0 auto;
  font-family: inherit; /* ✅ ใช้ฟอนต์จาก base.css แทน */
}

/* ========== HERO SECTION ========== */
.analytics-hero {
  position: relative;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 80px 20px;
  border-radius: 24px;
  margin-bottom: 40px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
}

.hero-gradient-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content-wrapper {
  position: relative;
  z-index: 2;
  text-align: center;
  color: white;
}

.hero-icon-container {
  margin-bottom: 30px;
}

.icon-circle {
  width: 100px;
  height: 100px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  animation: float 3s ease-in-out infinite;
}

.icon-circle i {
  font-size: 3rem;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.hero-main-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 15px;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
}

.hero-description {
  font-size: 1.2rem;
  opacity: 0.95;
}

.floating-element {
  position: absolute;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: float-random 15s ease-in-out infinite;
}

.element-1 { top: 10%; left: 5%; animation-delay: 0s; }
.element-2 { top: 60%; right: 10%; animation-delay: -5s; }
.element-3 { bottom: 20%; left: 15%; animation-delay: -10s; }

@keyframes float-random {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(120deg); }
  66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* ========== DATE FILTER CARD ========== */
.date-filter-card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.date-filter-form {
  width: 100%;
}

.filter-group {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 20px;
  align-items: end;
}

.filter-item {
  display: flex;
  flex-direction: column;
}

.filter-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modern-input {
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  background: #f8f9fa;
  width: 100%;
  box-sizing: border-box;
}

.modern-input:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.filter-submit-btn {
  padding: 12px 30px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.filter-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* ========== CHARTS GRID ========== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  margin-bottom: 40px;
}

.charts-grid .chart-card:nth-child(-n+4) {
  grid-column: 1 / -1;
}

@media (min-width: 1200px) {
  .charts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .charts-grid .chart-card:nth-child(-n+4) {
    grid-column: 1 / -1;
  }
}

.chart-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.chart-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
}

.chart-card-header {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 20px 25px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.chart-icon {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  backdrop-filter: blur(10px);
}

.chart-card-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.chart-wrapper {
  padding: 25px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 350px;
}

canvas {
  max-height: 320px !important;
}

canvas[id^="heatmap"] {
  height: 350px !important;
  max-height: 350px !important;
}

/* ========== HEATMAP TEXT ENHANCEMENT ========== */
canvas[id^="heatmap"] {
  /* ปรับปรุงการแสดงผลข้อความใน heatmap */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* ========== LOADING STATE ========== */
.chart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 350px;
  color: #667eea;
}

.chart-loading i {
  font-size: 3rem;
  margin-bottom: 15px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.chart-loading p {
  font-size: 1.1rem;
  font-weight: 600;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .hero-main-title {
    font-size: 2rem;
  }
  
  .filter-group {
    grid-template-columns: 1fr;
  }
  
  .filter-submit-btn {
    width: 100%;
    justify-content: center;
  }
  
  .chart-wrapper {
    min-height: 300px;
  }
}
