/* Timeline Scope CSS */

.timeline-summary {
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
}
.timeline-stats-grid {
  margin-bottom: var(--s-24);
  width: 100%;
}

.bg-widget-forecast {
  background-color: #cbe5ed;
  color: #1c404e;
}
.bg-widget-overdue {
  background-color: #fce8e8;
  color: #d32f2f;
}
.bg-widget-cleared {
  background-color: #e2f2ed;
  color: #1c404e;
}
.bg-widget-income {
  background-color: #dce1f8;
  color: #1b1f4c;
}

.timeline-stats-grid .stat-widget {
  padding: var(--s-16) var(--s-16);
  min-width: 0; /* CRITICAL: Prevents CSS Grid from overflowing container bounds */
  overflow: hidden;
}

.timeline-stats-grid .stat-title {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-stats-grid .stat-value {
  font-size: clamp(15px, 4.5vw, 26px); /* Fluid typography to fit wide AED amounts on small screens */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.5px;
}

.timeline-stats-grid .stat-icon-svg {
  width: 28px; /* Bigger icons as requested */
  height: 28px;
  flex-shrink: 0;
}

/* Timeline Header & Filter */
.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-16);
}

.timeline-container {
  padding-bottom: 40px;
}

/* Agenda / Group Styles */
.timeline-month-group {
  margin-bottom: var(--s-24);
}

.timeline-month-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--s-12);
  border-bottom: 1px solid var(--c-border);
  padding-bottom: 4px;
}

.timeline-btn-group {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.timeline-items {
  display: flex;
  flex-direction: column;
  gap: var(--s-12);
}

/* Individual Item / Card */
.timeline-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--s-16);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.timeline-item:active {
  transform: scale(0.98);
}

.timeline-item-left {
  display: flex;
  gap: var(--s-12);
  align-items: center;
}

.item-date-box {
  background-color: var(--c-bg);
  border-radius: var(--r-md);
  padding: 10px 12px;
  min-width: 56px;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.item-date-day {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text-main);
  line-height: 1;
}

.item-date-weekday {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  margin-top: 4px;
}

.item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text-main);
}

.item-subtitle {
  font-size: 12px;
  color: var(--c-text-muted);
}

.timeline-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.item-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text-main);
}

.item-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-scheduled {
  background-color: var(--c-bg);
  color: var(--c-text-muted);
}
.status-pending {
  background-color: var(--c-warning-bg);
  color: var(--c-warning);
}
.status-cleared {
  background-color: var(--c-income-bg);
  color: var(--c-income);
}
.status-bounced {
  background-color: var(--c-expense-bg);
  color: var(--c-expense);
}



/* Utility classes replacing inline styles */
.btn-hidden {
  visibility: hidden;
  width: 24px;
}
.app-content-timeline {
  padding-top: var(--s-24);
}
.agenda-title {
  margin-bottom: 0;
}
.filter-select {
  padding: 4px var(--s-12);
  height: auto;
  font-size: 13px;
}
.timeline-loading {
  color: var(--c-text-muted);
}

/* =========================================
   DATE RANGE FILTER PILLS
   ========================================= */
.timeline-filters-wrapper {
  padding-bottom: var(--s-16);
}

.date-range-pills {
  justify-content: flex-start;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none; /* Firefox */
}
.date-range-pills::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.pill-btn {
  padding: 8px 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.pill-btn:hover {
  color: var(--c-text-main);
  border-color: var(--c-text-muted);
}

.pill-btn.active {
  background: var(--c-text-main);
  color: var(--c-surface);
  border-color: var(--c-text-main);
  box-shadow: var(--shadow-sm);
}

/* CUSTOM DATE ACCORDION */
.custom-date-accordion {
  display: none;
  margin-top: 12px;
  background: var(--c-surface);
  padding: 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  animation: slideDownFade 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.custom-date-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.custom-date-col {
  flex: 1;
  min-width: 120px;
}

.custom-date-col label {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-muted);
  display: block;
  margin-bottom: 4px;
}

.date-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  font-size: 14px;
  height: 40px;
}

.custom-date-btn {
  padding: 0 20px;
  font-size: 14px;
  height: 40px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  flex-grow: 1;
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
