/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Figtree', sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    overflow-x: hidden; /* Prevent horizontal scroll */
    position: relative; /* Create a stacking context */
}

/* Header styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #eeeeee;
    margin-bottom: 20px;
}

header h1 {
    font-weight: 600;
    color: #333;
}

.date-picker {
    background-color: #eeeeee;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    display: flex; /* Arrange year toggle and nav links side-by-side */
    align-items: center; /* Vertically align items */
    flex-wrap: wrap; /* Allow wrapping if space is very limited */
    gap: 15px; /* Space between year toggle and nav links container */
}

/* Quick Navigation Links in Header */
.quick-nav-links {
    display: flex; /* Arrange links horizontally */
    flex-wrap: wrap; /* Allow wrapping if space is tight */
    gap: 8px; /* Space between individual links */
    align-items: center; /* Align items vertically */
}

.quick-nav-links a {
    font-size: 0.8em; /* Smaller font size for unobtrusiveness */
    color: #4A5568; /* Tailwind's gray-700 for a modern, muted look */
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.quick-nav-links a:hover,
.quick-nav-links a:focus {
    background-color: #E2E8F0; /* Tailwind's gray-200 */
    color: #2D3748; /* Tailwind's gray-800 */
    outline: none;
}

/* Year Toggle Styles */
.year-toggle {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  align-items: center;
  font-family: Figtree, sans-serif;
}
.year-toggle label {
  position: relative;
  cursor: pointer;
  font-size: 1.05em;
  border: 2px solid #eeeeee;
  border-radius: 20px;
  padding: 6px 20px 6px 36px;
  background: #fff;
  color: #70d955;
  font-weight: 600;
  transition: all 0.15s;
  box-shadow: 0 1px 3px 0 rgba(88,227,208,0.08);
  user-select: none;
}

/* Add styles for selected label state */
.year-toggle label:has(input[type="radio"]:checked) {
  background-color: rgba(112, 217, 85, 0.1);
  border-color: #70d955;
}

.year-toggle label:nth-child(2):has(input[type="radio"]:checked) {
  background-color: rgba(88, 227, 208, 0.1);
  border-color: #58e3d0;
}

.year-toggle label:nth-child(3):has(input[type="radio"]:checked) {
  background-color: rgba(82, 196, 26, 0.1);
  border-color: #52c41a;
}
.year-toggle input[type="radio"] {
  appearance: none;
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 2px solid #70d955;
  border-radius: 50%;
  background: #fff;
  transition: border-color 0.2s, background 0.2s;
}
.year-toggle input[type="radio"]:checked {
  background: #70d955;
  border-color: #70d955;
}
.year-toggle label:nth-child(2) input[type="radio"]:checked {
  background: #58e3d0;
  border-color: #58e3d0;
}
.year-toggle label:nth-child(3) input[type="radio"]:checked {
  background: #52c41a;
  border-color: #52c41a;
}
.year-toggle input[type="radio"]:checked:after {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  margin: 2px auto;
  border-radius: 50%;
  background: #fff;
}
.year-toggle input[type="radio"]:focus {
  outline: 2px solid #58e3d0;
}
.year-toggle input[type="radio"]:hover {
  border-color: #58e3d0;
}
.year-toggle label input[type="radio"]:checked + span,
.year-toggle label input[type="radio"]:checked {
  color: #fff;
}
.year-toggle label:nth-child(1) input[type="radio"]:checked ~ span {
  background: #70d955;
}
.year-toggle label:nth-child(2) input[type="radio"]:checked ~ span {
  background: #58e3d0;
}
.year-toggle label:nth-child(3) input[type="radio"]:checked ~ span {
  background: #52c41a;
}

/* Metric card styles */

.metric-card .baseline {
  font-size: 0.95em;
  color: #888;
  margin: 4px 0 2px 0;
  font-family: Figtree, sans-serif;
}

.metric-card .actual {
  font-size: 1em;
  color: #52c41a;
  font-weight: 600;
  margin: 4px 0 2px 0;
  font-family: Figtree, sans-serif;
}

.current-value-prominent {
    font-size: 1.5em; /* Adjusted to match '3x run rate' style */
    font-weight: 700; /* Bold */
    color: #222; /* Dark color for prominence */
    margin: 10px 0 6px 0; /* Spacing around the value */
    letter-spacing: -0.5px;
    font-family: 'Figtree', sans-serif;
}

.current-value-prominent::before {
    content: "Current: ";
    font-size: 0.65em; /* Make 'Current:' smaller */
    font-weight: 400; /* Less bold */
    color: #888; /* Subtle gray color */
    letter-spacing: normal;
}

.progress-label {
    font-size: 1em;
    font-weight: 600;
    color: #70d955; /* Accent color */
    margin-bottom: 4px;
    margin-top: 8px;
    font-family: 'Figtree', sans-serif;
}

/* Summary cards styles */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-top: 4px solid #eeeeee;
}

.exit-driver[data-driver="ARR"] {
    border-top-color: #70d955;
}

.exit-driver[data-driver="NRR"] {
    border-top-color: #58e3d0;
}

.exit-driver[data-driver="GRR"] {
    border-top-color: #36b9cc;
}

.exit-driver[data-driver="Profitability"] {
    border-top-color: #52c41a;
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #666;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.trend {
    font-size: 14px;
    font-weight: 500;
}

.trend.positive {
    color: #70d955;
}

.trend.negative {
    color: #ff4d4f;
}

.completion .progress-container {
    margin-top: 15px;
}

/* Dashboard sections */
.dashboard-section {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.section-header h2 {
    font-weight: 600;
    font-size: 20px;
    margin-right: 15px;
}

.owner-tag, .exec-tag {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    margin-right: 10px;
}

.owner-tag {
    color: #666;
    font-weight: 500;
    background-color: #eeeeee;
}

.exec-tag {
    color: white;
    font-weight: 600;
    background-color: #70d955;
    padding: 5px 12px;
    font-size: 13px;
    position: relative;
    top: -1px;
}

.exit-driver-tag {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    color: white;
}

.exit-driver-tag[data-driver="ARR"] {
    background-color: #70d955;
}

.exit-driver-tag[data-driver="NRR"] {
    background-color: #58e3d0;
}

.exit-driver-tag[data-driver="Profitability"] {
    background-color: #52c41a;
}

.exit-driver-tags {
    display: flex;
    gap: 10px;
}

/* Indicators container */
.indicators-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 25px;
}

.leading-indicators, .lagging-indicators {
    border-radius: 8px;
    padding: 20px;
    background-color: #eeeeee;
}

.leading-indicators h3, .lagging-indicators h3 {
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

/* Metrics grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.indicator-group {
    margin-bottom: 20px;
}

.indicator-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding-left: 8px;
    border-left: 4px solid;
}

.leading-indicators .indicator-header {
    border-color: #70d955;
}

.lagging-indicators .indicator-header {
    border-color: #58e3d0;
}

.indicator-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #333;
}

.indicator-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 10px;
    color: white;
}

.leading-tag {
    background-color: #70d955;
}

.lagging-tag {
    background-color: #58e3d0;
}

.indicator-description {
    font-size: 12px;
    color: #666;
    margin-left: 10px;
}

.indicators-legend {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-right: 20px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 5px;
}

.legend-color.leading {
    background-color: #70d955;
}

.legend-color.lagging {
    background-color: #58e3d0;
}

.metric-card {
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.metric-card h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.exit-driver-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    color: white;
    margin-bottom: 8px;
}

.exit-driver-pill[data-driver="ARR"] {
    background-color: #70d955;
}

.exit-driver-pill[data-driver="NRR"] {
    background-color: #58e3d0;
}

.exit-driver-pill[data-driver="GRR"] {
    background-color: #36b9cc;
}

.exit-driver-pill[data-driver="Profitability"] {
    background-color: #52c41a;
}

.targets {
    font-size: 11px;
    color: #666;
    margin-bottom: 10px;
}

.targets span {
    display: inline-block;
    margin-right: 8px;
}

.current-value {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.target-value {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

/* Progress bars */




.progress-container {
    margin-top: 10px;
    width: 100%;
    background-color: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    background-color: #70d955; /* Match the accent color of the progress label */
    height: 20px;
    color: white;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    font-weight: 500;
    transition: width 0.5s ease-in-out;
}

/* Data warning indicator */
.data-warning {
    position: absolute;
    top: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2px 5px;
    font-size: 12px;
    border-radius: 0 4px 0 4px;
    cursor: help;
    z-index: 2;
}

.correlation-chart {
    margin-top: 20px;
    height: 250px;
    max-height: 250px; /* Add explicit max height */
    overflow: hidden; /* Prevent overflow */
}

/* Footer styles */
.dashboard-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.footer-section {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    max-height: 400px; /* Add max height to prevent infinite scroll */
    overflow: hidden; /* Hide overflow content */
}

.footer-section h3 {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}

#exitDriverSummaryChart {
    height: 300px !important; /* Force height on the chart */
    max-height: 300px; /* Maximum height constraint */
    width: 100%;
}

/* Horizontal Timeline Section */
.horizontal-timeline-section {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    overflow-x: auto; /* Allow horizontal scrolling if needed */
}

.horizontal-timeline-section h3 {
    font-weight: 600;
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

/* Horizontal Timeline styles */
.timeline {
    display: flex; /* Arrange items in a row */
    position: relative;
    padding: 20px 0;
    white-space: nowrap; /* Prevent items from wrapping to the next line */
    justify-content: space-around; /* Distribute items evenly */
}

.timeline:before { /* Horizontal line */
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: #eeeeee;
    top: calc(20px + 10px); /* Position line relative to marker: padding + marker_height/2 + border_width */
    left: 0;
    transform: translateY(-50%);
    z-index: 1;
}

.timeline-item {
    display: flex;
    flex-direction: column; /* Stack marker and content vertically */
    align-items: center; /* Center items horizontally */
    position: relative;
    padding: 0 10px; /* Spacing between items */
    min-width: 120px; /* Minimum width for each item */
    z-index: 2; /* Ensure items are above the line */
}

.timeline-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #eeeeee;
    border: 3px solid #ffffff; /* Create a "hole" effect on the line */
    position: relative; /* Keep it in flow for flex alignment */
    margin-bottom: 10px; /* Space between marker and content */
}

.timeline-item.current .timeline-marker {
    background-color: #70d955;
}

.timeline-content {
    text-align: center; /* Center text below marker */
}

.timeline-content h4 {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 5px;
}

.timeline-content p {
    font-size: 13px;
    color: #666;
    white-space: normal; /* Allow text to wrap within the item */
}

/* Styles for the top timeline with text above markers */
.timeline-top-text .timeline-item {
    flex-direction: column-reverse; /* Content on top, marker below */
}

.timeline-top-text .timeline-marker {
    margin-top: 10px; /* Space between content (now above) and marker */
    margin-bottom: 0; /* Remove bottom margin as content is on top */
}

.timeline-top-text .timeline-content {
    margin-bottom: 0; /* Adjust as needed, marker is now below */
}

/* Adjust line position for the top timeline */
.timeline-top-text:before {
    top: auto;
    bottom: calc(20px + 10px); /* 20px bottom padding of .timeline + 10px half marker height */
}

/* Adjust dashboard-footer if it becomes a single column */
.dashboard-footer:has(> .footer-section:only-child) {
    grid-template-columns: 1fr;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .indicators-container {
        grid-template-columns: 1fr;
    }
    
    .dashboard-footer {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}
