/**
 * Analytics Dashboard Styles
 * Organized by: Base → Layout → Components → Utilities → Responsive
 */

/* ============================================
   BASE STYLES
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #F9FAFB;
  padding: 20px;
  color: #111827;
}

/* ============================================
   LAYOUT - HEADER
   ============================================ */

.header {
  background: white;
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-left: 4px solid #DC2626;
  margin-bottom: 24px;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #111827;
  letter-spacing: -0.025em;
}

.header p {
  color: #6B7280;
  font-size: 14px;
  font-weight: 500;
}

/* ============================================
   LAYOUT - DASHBOARD GRID
   ============================================ */

.dashboard-grid {
  display: grid;
  /* min(100%, 600px) keeps the 600px preferred track width on desktop but
     never forces a track wider than the viewport, so narrow/mobile screens
     don't get horizontal overflow. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 600px), 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

/* Grid items default to min-width:auto, which refuses to shrink below their
   content's min-width — a wide table then forces the whole panel (and the page)
   wider than the viewport. min-width:0 lets panels shrink so inner
   .table-container { overflow-x:auto } can scroll wide tables internally. */
.dashboard-grid > * {
  min-width: 0;
}

/* ============================================
   COMPONENTS - CHARTS
   ============================================ */

.chart-container {
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-left: 4px solid #DC2626;
  transition: all 0.2s ease;
}

.chart-container:hover {
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
  transform: translateY(-2px);
}

.chart-container.full-width {
  grid-column: 1 / -1;
}

.chart-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #111827;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chart {
  min-height: 400px;
}

/* ============================================
   COMPONENTS - TABLES
   ============================================ */

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: #111827;
  color: white;
}

th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: white;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 2px solid #DC2626;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid #E5E7EB;
  color: #374151;
  font-size: 14px;
}

tbody tr:hover {
  background: #FEF2F2;
}

.no-data {
  padding: 60px 40px;
  text-align: center;
  color: #9CA3AF;
  font-style: normal;
  font-size: 14px;
  font-weight: 500;
}

/* ============================================
   COMPONENTS - FORM FILTERS
   ============================================ */

#form-filter {
  transition: all 0.15s ease;
  border: 2px solid #E5E7EB;
  background: white;
}

#form-filter:hover {
  border-color: #DC2626;
  background: #FEF2F2;
}

#form-filter:focus {
  outline: none;
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
  background: white;
}

/* Filter dropdowns for URL parameters table */
.filter-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 10px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 150px;
  margin-top: 2px;
}

.filter-dropdown label {
  display: block;
  padding: 4px;
  cursor: pointer;
  font-size: 12px;
  color: #374151 !important;
  font-weight: 500;
}

.filter-dropdown label:hover {
  background: #F3F4F6;
  border-radius: 4px;
}

.filter-dropdown input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
}

/* ============================================
   UTILITIES - ANIMATIONS
   ============================================ */

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   RESPONSIVE - MOBILE & TABLET
   ============================================ */

@media (max-width: 1200px) {
  .url-params-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  body {
    padding: 10px;
  }
}
