/* CausalFunnel Heatmap Page - Dark Theme (Joomla Style) */

/* Force dark theme on all elements */
* {
  color: #e2e8f0;
}

/* Loading Overlay */
.cf-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #0f1523 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.cf-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(129, 140, 248, 0.2);
  border-top: 4px solid #818cf8;
  border-radius: 50%;
  animation: cf-spin 1s linear infinite;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(129, 140, 248, 0.2);
}

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

.cf-loading-overlay p {
  color: #94a3b8;
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  text-align: center;
  background: rgba(15, 21, 35, 0.9);
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Main Container */
.causalfunnel-container {
  max-width: 100%;
  margin: 0;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #0f1523 !important;
  color: #e2e8f0;
  min-height: 100vh;
}

.causalfunnel-container, 
.causalfunnel-container * {
  background-color: transparent !important;
}

.causalfunnel-container a {
  color: #818cf8;
}

.causalfunnel-container a:hover {
  color: #a5b4fc;
}

/* Header Styles */
.cf-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d1b4e 100%) !important;
  color: white;
  padding: 25px 30px;
  border-radius: 12px;
  margin-bottom: 25px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.cf-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.cf-title-section {
  flex: 1;
}

.cf-main-title {
  font-size: 1.5em;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #818cf8;
}

.cf-subtitle {
  font-size: 0.95em;
  margin: 0;
  color: #94a3b8;
}

/* Date Badge */
.cf-date-badge {
  background: #1a2332 !important;
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid #2d3748;
  text-align: center;
  min-width: 160px;
}

.cf-date-label {
  display: block;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cf-date-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #e2e8f0;
}

/* Info Cards Grid */
.cf-info-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

@media (max-width: 900px) {
  .cf-info-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .cf-info-cards {
    grid-template-columns: 1fr;
  }
}

.cf-info-card {
  background: #1a2332 !important;
  border-radius: 10px;
  padding: 25px 20px;
  text-align: center;
  border: 1px solid #2d3748;
  transition: all 0.3s ease;
}

.cf-info-card:hover {
  background: #232d3f !important;
  border-color: #3d4a5c;
}

.cf-card-content h4 {
  margin: 0 0 12px 0;
  color: #818cf8;
  font-size: 1.1em;
  font-weight: 600;
}

.cf-card-content p {
  margin: 0;
  color: #94a3b8;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cf-link {
  color: #818cf8 !important;
  text-decoration: none;
}

.cf-link:hover {
  color: #a5b4fc !important;
  text-decoration: underline;
}

.cf-store-name {
  color: #e2e8f0;
}

/* Main Content */
.cf-main-content {
  background: #1a2332 !important;
  border-radius: 12px;
  border: 1px solid #2d3748;
  overflow: hidden;
}

.cf-content-header {
  padding: 20px 24px;
  border-bottom: 1px solid #2d3748;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #141c2b !important;
}

.cf-content-header h2 {
  margin: 0;
  color: #e2e8f0;
  font-size: 1.1em;
  font-weight: 600;
}

/* Table Styles */
.cf-table-container {
  overflow-x: auto;
  background: #1a2332 !important;
}

.cf-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: #1a2332 !important;
}

.cf-data-table thead {
  background: #141c2b !important;
}

.cf-data-table th {
  padding: 15px 20px;
  text-align: left;
  border-bottom: 1px solid #2d3748;
  font-weight: 600;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
}

.cf-data-table tbody tr {
  border-bottom: 1px solid #2d3748;
  transition: background-color 0.2s;
}

.cf-data-table tbody tr:hover {
  background-color: #141c2b !important;
}

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

.cf-data-table td {
  padding: 15px 20px;
  color: #e2e8f0;
}

.cf-td-url {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #94a3b8;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.cf-metric-value {
  font-weight: 600;
  font-size: 1rem;
  padding: 6px 16px;
  border-radius: 20px;
  display: inline-block;
  text-align: center;
}

.cf-scroll-100 {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #10b981;
}

.cf-scroll-80 {
  background: rgba(14, 165, 233, 0.2) !important;
  color: #0ea5e9;
}

.cf-scroll-60 {
  background: rgba(234, 179, 8, 0.2) !important;
  color: #eab308;
}

.cf-scroll-40 {
  background: rgba(249, 115, 22, 0.2) !important;
  color: #f97316;
}

.cf-scroll-20 {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #ef4444;
}

.cf-scroll-0 {
  background: rgba(100, 116, 139, 0.2) !important;
  color: #64748b;
}

/* Progress Bar */
.cf-progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cf-progress-bar {
  flex: 1;
  height: 8px;
  background: #2d3748 !important;
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}

.cf-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 4px;
  transition: width 0.8s ease;
}

.cf-progress-text {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 0.875rem;
  min-width: 40px;
}

/* View Button */
.cf-view-btn {
  padding: 8px 16px;
  background: #818cf8 !important;
  color: white !important;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.85em;
  text-decoration: none;
  display: inline-block;
}

.cf-view-btn:hover {
  background: #6366f1 !important;
}

/* Empty State */
.cf-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
  background: #1a2332 !important;
}

.cf-empty-state-title {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 8px;
  color: #e2e8f0;
}

/* Error Message */
.cf-error-message,
.cf-error-container {
  background: #1a2332 !important;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-left: 4px solid #ef4444;
  color: #fca5a5;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.cf-error-container h3 {
  margin: 0 0 10px 0;
  color: #ef4444;
}

.cf-error-container p {
  margin: 0 0 10px 0;
  color: #fca5a5;
}

.cf-error-hint {
  color: #94a3b8 !important;
  font-size: 0.85rem !important;
  margin-top: 6px !important;
}

/* Breadcrumb */
.cf-breadcrumb {
  color: #64748b;
  font-size: 0.9em;
  margin-bottom: 20px;
}

.cf-breadcrumb a {
  color: #64748b;
  text-decoration: none;
}

.cf-breadcrumb a:hover {
  color: #818cf8;
}

.cf-breadcrumb span {
  color: #818cf8;
}

/* Responsive */
@media (max-width: 768px) {
  .causalfunnel-container {
    padding: 16px;
  }

  .cf-header {
    padding: 20px;
    margin-bottom: 20px;
  }

  .cf-header-content {
    flex-direction: column;
    text-align: center;
  }

  .cf-main-title {
    font-size: 1.3em;
  }

  .cf-subtitle {
    font-size: 0.9em;
  }

  .cf-info-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .cf-info-card {
    padding: 20px 15px;
  }

  .cf-data-table {
    font-size: 0.75rem;
  }

  .cf-data-table th,
  .cf-data-table td {
    padding: 10px 12px;
  }
}


/* Header Styles */
.cf-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d1b4e 100%);
  color: white;
  padding: 25px 30px;
  border-radius: 12px;
  margin-bottom: 25px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.cf-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.cf-title-section {
  flex: 1;
}

.cf-main-title {
  font-size: 1.5em;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #818cf8;
}

.cf-subtitle {
  font-size: 0.95em;
  margin: 0;
  color: #94a3b8;
}

/* Date Badge */
.cf-date-badge {
  background: #1a2332;
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid #2d3748;
  text-align: center;
  min-width: 160px;
}

.cf-date-label {
  display: block;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cf-date-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #e2e8f0;
}

/* Info Cards Grid */
.cf-info-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

@media (max-width: 900px) {
  .cf-info-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .cf-info-cards {
    grid-template-columns: 1fr;
  }
}

.cf-info-card {
  background: #1a2332;
  border-radius: 10px;
  padding: 25px 20px;
  text-align: center;
  border: 1px solid #2d3748;
}

.cf-card-content h4 {
  margin: 0 0 12px 0;
  color: #e2e8f0;
  font-size: 2.2em;
  font-weight: 600;
  color: #818cf8;
}

.cf-card-content p {
  margin: 0;
  color: #64748b;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Main Content */
.cf-main-content {
  background: #1a2332;
  border-radius: 12px;
  border: 1px solid #2d3748;
  overflow: hidden;
}

.cf-content-header {
  padding: 20px 24px;
  border-bottom: 1px solid #2d3748;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #141c2b;
}

.cf-content-header h2 {
  margin: 0;
  color: #e2e8f0;
  font-size: 1.1em;
  font-weight: 600;
}

/* Table Styles */
.cf-table-container {
  overflow-x: auto;
}

.cf-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.cf-data-table thead {
  background: #141c2b;
}

.cf-data-table th {
  padding: 15px 20px;
  text-align: left;
  border-bottom: 1px solid #2d3748;
  font-weight: 600;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
}

.cf-data-table tbody tr {
  border-bottom: 1px solid #2d3748;
  transition: background-color 0.2s;
}

.cf-data-table tbody tr:hover {
  background-color: #141c2b;
}

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

.cf-data-table td {
  padding: 15px 20px;
  color: #e2e8f0;
}

.cf-td-url {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #94a3b8;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.cf-metric-value {
  font-weight: 600;
  font-size: 1rem;
  padding: 6px 16px;
  border-radius: 20px;
  display: inline-block;
  text-align: center;
}

.cf-scroll-100 {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.cf-scroll-80 {
  background: rgba(14, 165, 233, 0.2);
  color: #0ea5e9;
}

.cf-scroll-60 {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
}

.cf-scroll-40 {
  background: rgba(249, 115, 22, 0.2);
  color: #f97316;
}

.cf-scroll-20 {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.cf-scroll-0 {
  background: rgba(100, 116, 139, 0.2);
  color: #64748b;
}

/* Progress Bar */
.cf-progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cf-progress-bar {
  flex: 1;
  height: 8px;
  background: #2d3748;
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}

.cf-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 4px;
  transition: width 0.8s ease;
}

.cf-progress-text {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 0.875rem;
  min-width: 40px;
}

/* View Button */
.cf-view-btn {
  padding: 8px 16px;
  background: #818cf8;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.85em;
  text-decoration: none;
  display: inline-block;
}

.cf-view-btn:hover {
  background: #6366f1;
}

/* Empty State */
.cf-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
}

.cf-empty-state-title {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 8px;
  color: #e2e8f0;
}

/* Error Message */
.cf-error-message {
  background: #1a2332;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-left: 4px solid #ef4444;
  color: #fca5a5;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

/* Breadcrumb */
.cf-breadcrumb {
  color: #64748b;
  font-size: 0.9em;
  margin-bottom: 20px;
}

.cf-breadcrumb a {
  color: #64748b;
  text-decoration: none;
}

.cf-breadcrumb a:hover {
  color: #818cf8;
}

.cf-breadcrumb span {
  color: #818cf8;
}

/* Responsive */
@media (max-width: 768px) {
  .causalfunnel-container {
    padding: 16px;
  }

  .cf-header {
    padding: 20px;
    margin-bottom: 20px;
  }

  .cf-header-content {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }

  .cf-main-title {
    font-size: 1.3em;
  }

  .cf-subtitle {
    font-size: 0.9em;
  }

  .cf-info-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .cf-info-card {
    padding: 20px 15px;
  }

  .cf-summary-cards {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .cf-filters-bar .cf-filters-form,
  .cf-filters-bar form {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }
}

/* Analytics Summary Cards */
.cf-analytics-summary {
  margin-bottom: 25px !important;
}

.cf-summary-cards {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 15px !important;
}

.cf-summary-card {
  background: #1a2332 !important;
  border: 1px solid #2d3748 !important;
  border-radius: 10px !important;
  padding: 20px 24px !important;
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  box-sizing: border-box !important;
}

.cf-summary-content {
  display: flex !important;
  flex-direction: column !important;
}

.cf-summary-content h4 {
  margin: 0 0 4px 0 !important;
  font-size: 0.82em !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  color: #64748b !important;
  font-weight: 500 !important;
}

.cf-summary-number {
  font-size: 1.8em !important;
  font-weight: 700 !important;
  color: #818cf8 !important;
  line-height: 1 !important;
}

/* Date Range Filter Bar */
.cf-filters-bar {
  background: #1a2332 !important;
  padding: 16px 20px !important;
  border-radius: 10px !important;
  border: 1px solid #2d3748 !important;
  margin-bottom: 20px !important;
}

.cf-filters-bar .cf-filters-form,
.cf-filters-bar form {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  gap: 15px !important;
  align-items: end !important;
}

.cf-filters-bar .cf-filter-group {
  display: flex;
  flex-direction: column;
}

.cf-filters-bar .cf-filter-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: #94a3b8;
  font-size: 0.82em;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cf-filters-bar .cf-filter-group input[type="date"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #2d3748;
  border-radius: 6px;
  font-size: 14px;
  background: #0f1523;
  color: #e2e8f0;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.cf-filters-bar .cf-filter-group input[type="date"]:focus {
  border-color: #818cf8;
  outline: none;
}

.cf-filters-bar .cf-btn-apply {
  padding: 9px 20px;
  background: #818cf8;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  height: 40px;
  transition: background 0.2s;
  white-space: nowrap;
}

.cf-filters-bar .cf-btn-apply:hover {
  background: #6366f1;
}
