/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --primary-light: #DBEAFE;
  --secondary: #8B5CF6;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--gray-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header */
.header {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  flex-shrink: 0;
}

.header-title h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
}

.subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  border-radius: 8px;
  font-size: 0.875rem;
}

.stat-badge svg {
  color: var(--primary);
  flex-shrink: 0;
}

.stat-label {
  color: var(--gray-600);
  font-weight: 500;
}

.stat-value {
  color: var(--gray-900);
  font-weight: 700;
}

/* Main Content */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Hero Card */
.hero-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 16px;
  padding: 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-xl);
  color: var(--white);
}

.hero-content {
  flex: 1;
}

.hero-label {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.hero-value {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.hero-description {
  font-size: 1rem;
  opacity: 0.8;
}

.hero-icon {
  flex-shrink: 0;
}

/* Analytics Grid */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
}

.analytics-card {
  background: var(--white);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--gray-100);
}

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

.badge {
  display: inline-flex;
  padding: 0.375rem 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Data Tables */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody td {
  padding: 1rem;
  font-size: 0.875rem;
}

.text-right {
  text-align: right;
}

.partner-name,
.subid-name {
  font-weight: 600;
  color: var(--gray-900);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.25rem 0.625rem;
  background: var(--primary);
  color: var(--white);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Conversions Section */
.conversions-section {
  background: var(--white);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--gray-100);
}

.section-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

.conversions-card {
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

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

.conversions-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1400px;
}

.conversions-table thead {
  background: var(--gray-50);
}

.conversions-table thead th {
  padding: 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  white-space: nowrap;
  border-bottom: 2px solid var(--gray-200);
}

.conversions-table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s ease;
}

.conversions-table tbody tr:hover {
  background: var(--gray-50);
}

.conversions-table tbody tr:last-child {
  border-bottom: none;
}

.conversions-table tbody td {
  padding: 1rem;
  font-size: 0.875rem;
  white-space: nowrap;
}

.date-text {
  color: var(--gray-700);
  font-weight: 500;
}

.date-text.highlight {
  color: var(--primary);
  font-weight: 700;
}

.amount-text {
  color: var(--success);
  font-weight: 600;
}

.type-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.id-text {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--gray-600);
}

.partner-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.subid-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Footer */
.footer {
  margin-top: 2rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--white);
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .hero-card {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }

  .hero-value {
    font-size: 3rem;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .header {
    padding: 1.5rem;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-title h1 {
    font-size: 1.5rem;
  }

  .hero-value {
    font-size: 2.5rem;
  }

  .stats-bar {
    flex-direction: column;
  }

  .stat-badge {
    width: 100%;
  }
}