/*
 * SureSuccess - Analytics Page Stylesheet
 * Optimized styles specifically for the analytics page
 */

/* ======================================
   BASE STYLES & VARIABLES
   ====================================== */
:root {
  /* Color Palette */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --primary-lighter: #93c5fd;
  --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  
  --secondary: #0f172a;
  --secondary-light: #1e293b;
  --secondary-lighter: #334155;
  
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --accent-light: #fbbf24;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  --background: #ffffff;
  --background-alt: #f8fafc;
  --background-dark: #f1f5f9;
  
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-headings: 'Poppins', var(--font-primary);
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;
  
  /* Borders */
  --border-radius-sm: 0.25rem;
  --border-radius: 0.5rem;
  --border-radius-lg: 1rem;
  --border-radius-xl: 1.5rem;
  --border-radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Transitions */
  --transition: all 0.3s ease;
  --transition-fast: all 0.15s ease;
  --transition-slow: all 0.5s ease;
}

/* ======================================
   RESET & BASE STYLES
   ====================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-primary);
  color: var(--text-dark);
  line-height: 1.6;
  background-color: var(--background);
  overflow-x: hidden;
  position: relative;
  font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-headings);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--secondary);
}

p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

section {
  padding: 5rem 0;
  position: relative;
}

/* ======================================
   NAVIGATION
   ====================================== */
.navbar {
  background-color: var(--background);
  box-shadow: var(--shadow);
  padding: 0.75rem 0;
  transition: var(--transition);
  z-index: 100;
}

.navbar.scrolled {
  box-shadow: var(--shadow-md);
}

.brand-logo {
  display: flex;
  align-items: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--secondary);
}

.brand-highlight {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

.navbar-toggler {
  border: none;
  padding: 0.5rem;
  font-size: 1.25rem;
  color: var(--primary);
}

.navbar-toggler:focus {
  box-shadow: none;
  outline: none;
}

.navbar-nav {
  margin-left: 1.5rem;
}

.nav-item {
  margin: 0 0.5rem;
}

.nav-link {
  color: var(--text-dark);
  font-weight: 500;
  font-size: 1rem;
  padding: 0.625rem 0.5rem;
  transition: var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

.nav-link.active::after {
  content: '';
  display: block;
  width: 2rem;
  height: 2px;
  background: var(--primary-gradient);
  margin-top: 4px;
  border-radius: var(--border-radius-full);
}

.nav-buttons {
  display: flex;
  align-items: center;
}

@media (max-width: 991.98px) {
  .navbar-collapse {
    background-color: var(--background);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 0.5rem;
    box-shadow: var(--shadow);
  }

  .nav-buttons {
    margin-top: 1rem;
    flex-direction: column;
    width: 100%;
  }

  .nav-buttons .btn {
    margin: 0.25rem 0;
    width: 100%;
  }
}

/* ======================================
   BUTTONS
   ====================================== */
.btn {
  font-weight: 500;
  padding: 0.625rem 1.5rem;
  border-radius: var(--border-radius);
  transition: var(--transition);
  outline: none !important;
  font-size: 0.95rem;
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1.1rem;
}

.btn-sm {
  padding: 0.375rem 1rem;
  font-size: 0.875rem;
}

.btn-primary {
  background: var(--primary-gradient);
  border: none;
  color: var(--text-white);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover, 
.btn-primary:focus {
  background: var(--primary-dark);
  color: var(--text-white);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.btn-outline-primary {
  border: 1px solid var(--primary);
  color: var(--primary);
  background-color: transparent;
}

.btn-outline-primary:hover, 
.btn-outline-primary:focus,
.btn-outline-primary.active {
  background-color: var(--primary);
  color: var(--text-white);
  transform: translateY(-2px);
}

.btn-outline-primary:active {
  transform: translateY(0);
}

.btn-outline-light {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: transparent;
  color: var(--text-white);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  border-color: white;
}

/* Button Groups */
.btn-group {
  display: inline-flex;
  vertical-align: middle;
}

.btn-group > .btn {
  position: relative;
  flex: 1 1 auto;
}

/* ======================================
   HEADER SECTION
   ====================================== */
.module-detail-header {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  padding: 130px 0 80px;
  position: relative;
  overflow: hidden;
  color: white;
}

/* Add subtle dot pattern overlay */
.module-detail-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(#ffffff33 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.3;
  z-index: 0;
}

/* Breadcrumb Styling */
.breadcrumb-wrapper {
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.breadcrumb {
  padding: 0;
  background-color: transparent;
  margin-bottom: 0;
}

.breadcrumb-item {
  font-size: 0.95rem;
  font-weight: 500;
}

.breadcrumb-item a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.3s ease;
}

.breadcrumb-item a:hover {
  color: white;
}

.breadcrumb-item.active {
  color: white;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: rgba(255, 255, 255, 0.6);
}

/* Module Title & Description */
.module-title {
  font-size: 3.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 1rem;
  line-height: 1.2;
  position: relative;
  z-index: 1;
}

.module-description {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 1.5rem;
  max-width: 800px;
  position: relative;
  z-index: 1;
}

/* Module Actions */
.module-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  position: relative;
  z-index: 1;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.75rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  background-color: white;
  color: #2563eb;
  border: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: #2563eb;
}

.btn-action.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: 0.375rem;
}

/* Module Image */
.module-image {
  position: relative;
  z-index: 1;
  text-align: center;
}

.module-image img {
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

/* Wave divider */
.wave-divider {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  overflow: hidden;
  line-height: 0;
  z-index: 1;
}

.wave-divider svg {
  width: 100%;
  height: 90px;
  display: block;
}

/* ======================================
   MAIN CONTENT SECTION
   ====================================== */
.module-content-section {
  padding: 3rem 0;
  background-color: #ffffff;
}

/* ======================================
   MODULE CARD STYLING
   ====================================== */
.module-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  border: none;
  overflow: hidden;
  transition: all 0.3s ease;
  margin-bottom: 2rem;
}

.module-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.module-card .card-header {
  background-color: white;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
}

.module-card .card-header h2 {
  font-size: 1.25rem;
  margin-bottom: 0;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
}

.card-icon {
  color: #3b82f6;
  margin-right: 0.75rem;
  font-size: 1.2rem;
}

.module-card .card-body {
  padding: 1.5rem;
}

.heatmap-card {
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  border: none;
  height: 100%;
  position: relative;
  padding: 24px;
  transition: all 0.3s ease;
  margin-bottom: 2rem;
}

.heatmap-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.heatmap-card-header {
  padding: 0 0 20px 0;
  background: transparent;
  border: none;
}

.heatmap-card-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #212529;
  margin: 0;
  display: flex;
  align-items: center;
}

.heatmap-card-body {
  padding: 0;
  position: relative;
}

/* ======================================
   SUMMARY STAT CARDS
   ====================================== */
.display-5 {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1f2937;
}

.text-success {
  color: #10b981 !important;
}

.text-danger {
  color: #ef4444 !important;
}

.text-warning {
  color: #f59e0b !important;  
}

.text-primary {
  color: #3b82f6 !important;
}

.text-muted {
  color: #64748b !important;
}

.opacity-75 {
  opacity: 0.75;
}

/* ======================================
   TIMEFRAME CONTROLS
   ====================================== */
.btn-group .btn {
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-color: #e5e7eb;
  color: #4b5563;
  transition: all 0.3s ease;
}

.btn-group .btn.active {
  background-color: #3b82f6;
  border-color: #3b82f6;
  color: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-group .btn:hover:not(.active) {
  background-color: #f1f5f9;
  color: #3b82f6;
}

/* ======================================
   CHART CONTAINERS
   ====================================== */
.chart-container {
  position: relative;
  height: 400px;
  width: 100%;
  margin-bottom: 15px;
}

canvas {
  transition: opacity 0.3s ease;
  max-width: 100%;
}

canvas:hover {
  opacity: 0.95;
}

.chart-controls {
  display: flex;
  gap: 5px;
}

.chart-type-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.chart-type-btn.active {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.chart-legend {
  background-color: #f8fafc;
  border-radius: 50px;
  padding: 8px 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  font-size: 0.875rem;
}

/* ======================================
   ACTIVITY HEATMAP
   ====================================== */
#activity-heatmap .heatmap-table {
  border-collapse: separate;
  border-spacing: 3px;
  table-layout: fixed;
  width: 100%;
  margin-bottom: 1.5rem;
  background: transparent;
  border: none;
}

#activity-heatmap .day-header {
  font-size: 0.75rem;
  font-weight: normal;
  color: #6c757d;
  text-align: center;
  padding: 0.25rem 0;
  width: 30px;
  overflow: visible;
  white-space: nowrap;
  letter-spacing: -0.5px;
  background: transparent;
  border: none;
}

#activity-heatmap th.week-label-col {
  width: 80px;
  min-width: 80px;
  text-align: left;
  white-space: nowrap;
  overflow: visible;
  font-size: 0.85rem;
  font-weight: normal;
  color: #6c757d;
  padding-left: 0;
  background: transparent;
  border: none;
}

#activity-heatmap td {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 4px;
  transition: transform 0.2s ease;
  border: none;
}

#activity-heatmap td:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  z-index: 2;
}

#activity-heatmap tbody tr {
  border: none;
}

#activity-heatmap tbody tr td:first-child {
  text-align: left;
  padding-right: 5px;
  font-size: 0.85rem;
  font-weight: normal;
  color: #6c757d;
  white-space: nowrap;
  overflow: visible;
  padding-left: 0;
  border: none;
}

/* Heatmap Legend */
.heatmap-legend {
  display: flex;
  align-items: center;
  margin-top: 0.5rem;
  padding-left: 0.5rem;
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
}

.legend-color {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 0.375rem;
}

.legend-text {
  font-size: 0.875rem;
  color: #6c757d;
}

/* ======================================
   TOPIC CHART FILTERS
   ====================================== */
.topic-chart-filters {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.topic-chart-filters .form-select {
  font-size: 0.875rem;
  border-radius: 6px;
  background-color: #f9fafb;
  border-color: #e5e7eb;
  transition: all 0.2s ease;
}

.topic-chart-filters .form-select:focus {
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
  border-color: #93c5fd;
}

.topic-chart-filters .form-label {
  font-weight: 500;
  color: #4b5563;
}

/* ======================================
   MODULE PERFORMANCE LIST
   ====================================== */
.module-entry {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  transition: all 0.3s ease;
  margin-bottom: 1rem;
}

.module-entry:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.module-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.module-entry-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
}

.module-badge {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 50px;
}

.badge-premium {
  background-color: #f59e0b;
  color: white;
}

.module-entry-stats {
  font-size: 0.9rem;
  color: #64748b;
  margin-bottom: 0.75rem;
}

.stats-text {
  display: block;
}

.module-entry-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.module-entry-activity {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: #64748b;
}

.module-entry-activity i {
  margin-right: 0.5rem;
}

.module-entry-score {
  background-color: #10b981;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 50px;
}

/* ======================================
   RECOMMENDATIONS TABLE
   ====================================== */
.recommendations-table {
  margin-bottom: 0;
}

.recommendations-table th {
  font-weight: 600;
  border-top: none;
  color: #4b5563;
  padding: 0.75rem 1rem;
  background-color: #f9fafb;
}

.recommendations-table td {
  vertical-align: middle;
  padding: 0.75rem 1rem;
  color: #1f2937;
}

.recommendation-row {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.recommendation-row:hover {
  background-color: #f8fafc;
}

/* ======================================
   PROGRESS BARS
   ====================================== */
.progress {
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background-color: #f1f5f9;
  margin-bottom: 0.5rem;
}

.progress-bar {
  background-color: #3b82f6;
  transition: width 1s ease;
}

.progress-bar.bg-success {
  background-color: #10b981 !important;
}

.progress-bar.bg-warning {
  background-color: #f59e0b !important;
}

.progress-bar.bg-danger {
  background-color: #ef4444 !important;
}

.progress-bar.bg-info {
  background-color: #0ea5e9 !important;
}

/* ======================================
   FOOTER STYLES
   ====================================== */
.site-footer {
  background-color: #0f172a;
  color: #e2e8f0;
  padding-top: 4rem;
  position: relative;
}

.footer-brand {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: white;
}

.footer-text {
  color: #cbd5e1;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  transition: all 0.3s ease;
}

.social-link:hover {
  background-color: #3b82f6;
  transform: translateY(-3px);
}

.footer-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: white;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: #cbd5e1;
  text-decoration: none;
  transition: all 0.3s ease;
}

.footer-links a:hover {
  color: #3b82f6;
  text-decoration: none;
}

.newsletter-form .input-group {
  border-radius: 8px;
  overflow: hidden;
}

.newsletter-form .form-control {
  background-color: #1e293b;
  border: none;
  color: white;
  padding: 0.75rem 1rem;
}

.newsletter-form .form-control::placeholder {
  color: #94a3b8;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.5rem 0;
  margin-top: 3rem;
}

.copyright {
  color: #94a3b8;
  text-align: center;
  margin: 0;
}

/* ======================================
   RESPONSIVE STYLES
   ====================================== */
@media (max-width: 991.98px) {
  .module-title {
    font-size: 2.75rem;
  }
  
  .module-description {
    font-size: 1.1rem;
  }
  
  .module-image {
    margin-top: 2rem;
  }
  
  .chart-container {
    height: 350px;
  }
  
  .display-5 {
    font-size: 2rem;
  }
  
  .activity-heatmap-table td {
    width: 1.75rem;
    height: 1.75rem;
  }
  
  .module-card .card-body i.fa-3x {
    width: 60px;
    height: 60px;
    font-size: 1.75rem;
  }
  
  .module-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 767.98px) {
  .module-detail-header {
    padding: 110px 0 70px;
  }
  
  .module-title {
    font-size: 2.25rem;
  }
  
  .module-actions {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .btn-action,
  .btn-outline-light {
    width: 100%;
  }
  
  .chart-container {
    height: 300px;
  }
  
  .topic-chart-filters .form-select {
    font-size: 0.8rem;
  }
  
  .btn-group .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }
  
  .display-5 {
    font-size: 1.75rem;
  }
  
  .recommendations-table th,
  .recommendations-table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
  
  .heatmap-table td {
    width: 1.5rem;
    height: 1.5rem;
  }
  
  .heatmap-table th {
    font-size: 0.8rem;
    padding: 0.25rem;
  }
  
  .heatmap-legend {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }
}

@media (max-width: 575.98px) {
  .module-detail-header {
    padding: 100px 0 60px;
  }
  
  .module-title {
    font-size: 2rem;
  }
  
  .module-description {
    font-size: 1rem;
  }
  
  .card-header h2 {
    font-size: 1.1rem;
  }
  
  .chart-container {
    height: 250px;
  }
  
  .chart-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .heatmap-table td {
    width: 1.25rem;
    height: 1.25rem;
  }
  
  .heatmap-table th {
    font-size: 0.7rem;
    padding: 0.2rem;
  }
  
  .heatmap-legend-item {
    font-size: 0.7rem;
  }
  
  .btn-group {
    flex-wrap: wrap;
  }
  
  .btn-group .btn {
    flex: 1 0 40%;
    margin-bottom: 0.5rem;
  }
  
  .display-5 {
    font-size: 1.5rem;
  }
  
  .module-card .card-header h2 {
    font-size: 1.1rem;
  }
  
  .recommendations-table {
    font-size: 0.8rem;
  }
}