/* === Loading States === */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-radius: 8px;
}

.loading-content {
  text-align: center;
  padding: 20px;
}

.loading-content .spinner-border {
  width: 3rem;
  height: 3rem;
  margin-bottom: 15px;
}

.loading-text {
  font-size: 16px;
  color: #495057;
  font-weight: 500;
}

.loading-blur {
  filter: blur(2px);
  opacity: 0.7;
  pointer-events: none;
}

.no-data-placeholder {
  text-align: center;
  padding: 60px 20px;
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  margin: 20px 0;
}

.placeholder-content {
  max-width: 400px;
  margin: 0 auto;
}

.placeholder-content i {
  margin-bottom: 20px;
  opacity: 0.5;
}

.placeholder-content h4 {
  margin-bottom: 10px;
  font-weight: 500;
}

.placeholder-content p {
  margin-bottom: 0;
  font-size: 14px;
}

/* === Layout wrappers === */
.title-section h3 {
  margin: 0;
  color: #495057;
}

.subtitle {
  font-size: 14px;
  color: #6c757d;
  font-weight: normal;
  margin-left: 10px;
}

.calendar-header {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  border-bottom: 2px solid #e9ecef;
}

.add-btn {
  font-size: 14px;
  cursor: pointer;
  padding: 10px 20px;
  background: #007bff;
  color: white;
  transition: all 0.3s;
  text-decoration: none;
}

.add-btn:hover:not(:disabled) {
  background: #0056b3;
  border-color: #0056b3;
  color: white;
  text-decoration: none;
}

.add-btn:disabled {
  background: #6c757d;
  border-color: #6c757d;
  cursor: not-allowed;
}

.calendar-wrapper {
  display: flex;
  border: 1px solid #ccc;
  max-width: 100%;
  max-height: 400px; /* Approximately 10 rows * 40px height */
  overflow: hidden;
  position: relative; /* For loading overlay positioning */
}

/* Fixed (non-scrollable) 2 columns */
.fixed-columns {
  flex: 0 0 261px;
  background: #fafafa;
  border-right: 1px solid #ccc;
  overflow-y: hidden;
  max-height: 400px;
  position: relative;
}

/* Scrollable (dates) */
.scrollable {
  overflow-x: auto;
  overflow-y: auto;
  white-space: nowrap;
  flex: 1;
  max-height: 400px;
  scroll-behavior: smooth;
}

/* === Row systems: ensure matching heights across fixed + scrollable === */
.row-header {
  display: flex;
  height: 42px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.row-body {
  display: flex;
  height: 34px;
}

/* Fixed cells */
.fixed-cell {
  width: 65px;
  min-width: 65px;
  text-align: center;
  padding: 10px 6px;
  border-bottom: 1px solid #ccc;
  /* font-weight: bold; */
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 11;
}
.fixed-input {
  width: 65px;
  min-width: 65px;
  text-align: center;
  padding: 2px 6px;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fixed-input select {
  width: 100%;
  height: 30px;
}

/* Scrollable rows */
.calendar-row {
  display: flex;
}

/* Header day cells */
.calendar-cell {
  width: 60px;
  min-width: 60px;
  text-align: center;
  padding: 8px;
  background: #f0f3ff;
  /* color: #fff; */
  border-right: 1px solid #ccc;
  flex-shrink: 0;
  /* font-weight: bold; */
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.calendar-cell.today {
  background: #2a54f7;
  color: #fff;
}

/* Input cells */
.input-cell {
  width: 60px;
  min-width: 60px;
  padding: 2px 4px;
  border-right: 1px solid #eee;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.input-cell input {
  width: 100%;
  height: 30px;
  padding: 5px;
  border: none;
}

.btn-row {
  margin-top: 10px;
}

/* Basic responsive adjustments - handled by JavaScript */
@media (max-width: 768px) {
  .btn-row {
    flex-direction: column;
  }

  .btn-row .btn {
    width: 100%;
    margin-bottom: 5px;
  }

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

  .add-btn {
    margin-top: 10px;
  }
}

/* Custom scrollbar styling */
.scrollable::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.scrollable::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.scrollable::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.scrollable::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Firefox scrollbar styling */
.scrollable {
  scrollbar-width: thin;
  scrollbar-color: #c1c1c1 #f1f1f1;
}

.border-right {
  border-right: 1px solid #ccc;
}

/* Status indicators */
.status-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-left: 10px;
  vertical-align: middle;
}

.status-none {
  background-color: #6c757d;
}

.status-editable {
  background-color: #28a745;
}

.status-locked {
  background-color: #dc3545;
}

.cr-indicator {
  display: inline-block;
  background-color: #ffc107;
  color: #212529;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: bold;
  margin-left: 5px;
  vertical-align: middle;
}

/* Disabled input styling */
.disabled-input {
  background-color: #f8f9fa !important;
  color: #6c757d !important;
  cursor: not-allowed !important;
  opacity: 0.6;
}

.disabled-input:focus {
  border-color: #ced4da !important;
  box-shadow: none !important;
}

/* Field Legend Styling */
.field-legend {
  margin-top: 15px;
  padding: 10px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 5px;
}

.field-legend h6 {
  margin-bottom: 10px;
  color: #495057;
  font-weight: 600;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 12px;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  margin-right: 8px;
  border: 1px solid #ccc;
  display: inline-block;
}

.legend-text {
  color: #495057;
  font-weight: 500;
}

/* Plan comparison styling */
.plan-comparison {
  margin-top: 20px;
  padding: 15px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 5px;
}

.plan-comparison h4 {
  margin-bottom: 10px;
  color: #495057;
}

.comparison-row {
  display: flex;
  margin-bottom: 5px;
  font-size: 12px;
}

.comparison-label {
  width: 100px;
  font-weight: bold;
}

.comparison-value {
  flex: 1;
  margin-left: 10px;
}

.comparison-difference {
  color: #dc3545;
  font-weight: bold;
}

/* === Year Labels === */
.year-label {
  font-weight: bold;
  color: #007bff;
  font-size: 14px;
  text-align: center;
  display: block;
  padding: 5px;
  background-color: #f8f9fa;
  border-radius: 3px;
  border: 1px solid #dee2e6;
}

.fixed-cell.border-right {
  border-right: 1px solid #dee2e6;
}

.fixed-input.border-right {
  border-right: 1px solid #dee2e6;
}

/* Gap-filled month styling - Enhanced for better visibility */
.gap-filled-month {
  background-color: #fff3cd !important;
  /* border-color: #ffc107 !important; */
  color: #856404 !important;
  /* font-weight: 500 !important; */
  position: relative !important;
}

.gap-filled-month:focus {
  background-color: #fff3cd !important;
  /* border-color: #ffc107 !important; */
  box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25) !important;
}

.gap-filled-month {
  background-color: #fff3cd !important;
  /* border-color: #ffc107 !important; */
}

/* Auto-generated field styling - Same as gap-filled for consistency */
.auto-generated-field {
  background-color: #dee2e6 !important;
  /* border-color: #ffc107 !important; */
  color: #856404 !important;
  /* font-weight: 500 !important; */
  position: relative !important;
}

.auto-generated-field:focus {
  background-color: #dee2e6 !important;
  /* border-color: #ffc107 !important; */
  box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25) !important;
}

.auto-generated-field {
  background-color: #dee2e6 !important;
  /* border-color: #ffc107 !important; */
}

/* Add a subtle indicator for auto-generated fields */
.gap-filled-month::after,
.auto-generated-field::after {
  content: "AUTO";
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: #ffc107;
  color: #212529;
  font-size: 8px;
  font-weight: bold;
  padding: 1px 3px;
  border-radius: 2px;
  line-height: 1;
  opacity: 0.8;
  z-index: 1;
  transition: opacity 0.3s ease;
}

.gap-filled-month:hover::after,
.auto-generated-field:hover::after {
  opacity: 1;
}

/* Add a subtle pulsing animation for auto-generated fields */
@keyframes auto-generated-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4);
  }
  70% {
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
  }
}

/* .gap-filled-month,
.auto-generated-field {
  animation: auto-generated-pulse 2s infinite;
} */

/* === Locked vs Editable Month Styling === */
.locked-month {
  background-color: #f8f9fa !important;
  color: #6c757d !important;
  cursor: not-allowed !important;
  /* border: 1px solid #dee2e6 !important; */
}

.locked-month:focus {
  background-color: #f8f9fa !important;
  border-color: #dee2e6 !important;
  box-shadow: none !important;
}

.editable-month {
  background-color: #ffffff !important;
  color: #495057 !important;
  /* border: 1px solid #ced4da !important; */
}

.editable-month:focus {
  background-color: #ffffff !important;
  border-color: #80bdff !important;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

.disabled-input {
  background-color: #f8f9fa;
  color: #6c757d !important;
  cursor: not-allowed !important;
  /* border: 1px solid #dee2e6; */
}

.disabled-input:focus {
  background-color: #f8f9fa !important;
  border-color: #dee2e6 !important;
  box-shadow: none !important;
}

/* Invalid value styling */
.invalid-value {
  background-color: #f8d7da !important;
  border-color: #dc3545 !important;
  color: #721c24 !important;
}

.invalid-value:focus {
  background-color: #f8d7da !important;
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Gap warning styling */
.gap-warning {
  background-color: #fff3cd !important;
  border-color: #ffc107 !important;
  color: #856404 !important;
}

.gap-warning:focus {
  background-color: #fff3cd !important;
  border-color: #ffc107 !important;
  box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25) !important;
}

.no-spinner::-webkit-outer-spin-button,
.no-spinner::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-spinner {
  -moz-appearance: textfield;
  appearance: textfield;
}