/* Time Reporting Component Styles - Modular Design */

/* Period Carousel Styles */

.period-carousel-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: var(--size-md);
}

.period-carousel-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 28px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s; /* Specific properties only */
  flex-shrink: 0;
}

.period-carousel-arrow:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.period-carousel {
  display: flex;
  align-items: center;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}

.period-carousel--inactive {
  opacity: 0.5;
}

.period-carousel--inactive .period-carousel-item {
  color: var(--text-muted);
}

.period-carousel--inactive .period-carousel-item--selected {
  background: transparent;
  box-shadow: none;
  border-color: transparent;
}

.period-carousel-item {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s; /* Specific properties only */
  white-space: nowrap;
}

.period-carousel-item:hover:not(.period-carousel-item--selected) {
  color: var(--text);
  background: var(--bg);
}

.period-carousel-item--selected {
  background: var(--bg);
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Custom Period Button and Dropdown */
.period-custom-wrapper {
  position: relative;
  margin-left: 4px;
}

.period-custom-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.15s; /* Specific properties, transform for scale */
}

.period-custom-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.period-custom-btn--selected {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-accent);
}

.period-custom-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: var(--space-2);
  z-index: 100;
  min-width: 200px;
}

.period-custom-dropdown-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.period-custom-dropdown-field + .period-custom-dropdown-field {
  margin-top: var(--space-2);
}

.period-custom-dropdown-field label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.period-custom-dropdown-field input {
  padding: var(--space-1) var(--space-2);
  font-size: 12px;
}

/* Calendar Grid Styles */

.time-reporting-calendar {
  margin: 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

/* Month Banner Row - thin horizontal banner between calendar rows */
.calendar-month-banner-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin: 2px 0;
  min-height: 16px;
}

.calendar-month-banner {
  display: inline-flex;
  align-items: center;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-right: none;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 8px 2px 6px;
  height: 16px;
  position: relative;
  width: fit-content;
  border-radius: 2px 0 0 2px;
}

.calendar-month-banner::after {
  content: '';
  position: absolute;
  right: -8px;
  top: -1px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 8px solid var(--bg-muted);
}

.calendar-month-banner::before {
  content: '';
  position: absolute;
  right: -9px;
  top: -1px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 9px solid var(--border);
}

.calendar-month-banner-text {
  white-space: nowrap;
}

/* Padding cells for alignment - must override base .calendar-day-cell */
.calendar-day-cell.calendar-day-cell--padding {
  background: var(--bg-muted) !important;
  border: 1px solid transparent;
  cursor: default;
  pointer-events: none;
}

/* Calendar Day Headers */
.calendar-day-header {
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: var(--space-1) 0;
}

/* Calendar Day Cells */
.calendar-day-cell {
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px;
  cursor: pointer;
  transition: background-color 0.1s, border-color 0.1s; /* Specific properties only, very fast */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  min-height: 28px;
}

.calendar-day-cell:hover:not(.outside-period) {
  border-color: var(--primary);
  background: var(--bg-accent);
}

.calendar-day-cell.outside-period {
  background: var(--bg-muted);
  opacity: 0.4;
  cursor: pointer;
}

.calendar-day-cell.status-work {
  background: rgba(34, 197, 94, 0.08);
}

.calendar-day-cell.status-vacation {
  background: rgba(168, 85, 247, 0.1);
}

.calendar-day-cell.status-sick {
  background: rgba(249, 115, 22, 0.1);
}

.calendar-day-cell.status-holiday {
  background: rgba(59, 130, 246, 0.1);
}

.calendar-day-cell.status-off {
  background: var(--bg-muted);
  opacity: 0.4;
}

.calendar-day-cell--selected {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.calendar-day-number {
  font-weight: 500;
  font-size: 11px;
  color: var(--text);
  line-height: 1;
}

.calendar-day-info {
  font-size: 8px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1;
}

.calendar-day-info--nonstandard {
  color: #ef4444;
  font-weight: 600;
}

/* Calendar Legend */
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  justify-content: center;
}

.calendar-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.calendar-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.calendar-legend-color.status-work {
  background: rgba(34, 197, 94, 0.3);
  border-color: rgba(34, 197, 94, 0.5);
}

.calendar-legend-color.status-vacation {
  background: rgba(168, 85, 247, 0.3);
  border-color: rgba(168, 85, 247, 0.5);
}

.calendar-legend-color.status-sick {
  background: rgba(249, 115, 22, 0.3);
  border-color: rgba(249, 115, 22, 0.5);
}

.calendar-legend-color.status-holiday {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.5);
}

.calendar-legend-color.status-off {
  background: var(--bg-muted);
}

.calendar-legend-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Day Editor Popover Styles */

.day-editor-popover {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: var(--space-3);
  z-index: 3000;
  width: 280px;
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - 20px);
  overflow: auto;
}

.day-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.day-editor-title {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text);
}

.day-editor-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.day-editor-close:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.day-editor-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.day-editor-field {
  margin-bottom: 0;
}

.day-editor-field label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.day-editor-field input,
.day-editor-field textarea {
  width: 100%;
  font-size: var(--font-size-sm);
}

.day-editor-field input:disabled {
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

.day-editor-field textarea {
  resize: none;
  min-height: 50px;
}

/* Status segmented control for day editor */
.day-editor-status {
  width: 100%;
  flex-wrap: wrap;
}

.day-editor-status label {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 6px !important;
}

.day-editor-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.day-editor-actions .btn {
  flex: 1;
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-size-xs);
}

/* Summary Panel Styles */

.time-reporting-summary {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
}

.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: 11px;
  color: var(--text-muted);
}

.summary-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.summary-stat strong {
  color: var(--text);
  font-weight: 600;
}

/* Line Items Preview */
.summary-line-items {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.summary-line-items-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.summary-line-items-header label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.summary-line-items-header select {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  width: auto;
  min-width: 80px;
}

.summary-line-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-1) 0;
  font-size: var(--font-size-xs);
}

.summary-line-item + .summary-line-item {
  border-top: 1px dashed var(--border);
}

.summary-line-item-desc {
  color: var(--text);
}

.summary-line-item-amount {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Actions */
.summary-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.summary-actions .btn {
  flex: 1;
  padding: var(--space-2);
  font-size: var(--font-size-xs);
}

/* Time Report Summary Display (in line items) */
.time-report-summary-display {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--font-size-sm);
  flex: 1;
}

.time-report-summary-label {
  color: var(--text-muted);
  font-weight: 500;
}

.time-report-summary-value {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.time-report-summary-separator {
  color: var(--text-muted);
  margin: 0 var(--space-1);
}

.time-report-summary-total {
  color: var(--primary);
  font-weight: 700;
  font-size: var(--font-size-base);
  font-variant-numeric: tabular-nums;
}

/* Core Time Report Styles */

/* Inline Time Report Line Items */
.line-item--time-report {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  background: var(--bg);
}

.time-report-line-item-config {
  margin: var(--space-2) 0 var(--space-1) 0;
}

.time-report-line-item-calendar {
  margin: var(--space-1) 0 var(--space-2) 0;
}

.line-item-row--time-report-summary {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: space-between;
}

/* Time Report VAT and Discount Inputs */
.line-item-row--time-report-summary .line-item-discount-wrap,
.line-item-row--time-report-summary .line-item-tax-wrap {
  flex-shrink: 0;
}

.time-report-discount,
.time-report-vat {
  width: 4rem;
  height: var(--input-height);
  padding: 0 var(--space-1);
  font-size: var(--font-size-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

.line-items-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* Add Time Reporting Button */
.add-time-reporting-btn {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s; /* Specific properties only */
  width: 100%;
}

.add-time-reporting-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  border-style: solid;
}

/* Main Section */
.time-reporting-section {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Header */
.time-reporting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.time-reporting-header h2 {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.time-reporting-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--font-size-md);
  padding: 0;
  line-height: 1;
  opacity: 0.5;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s; /* Specific properties only */
}

.time-reporting-remove-btn:hover {
  color: var(--error);
  opacity: 1;
}

/* Config Form - Flowing Layout */
.time-reporting-config {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  row-gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.time-reporting-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 0 0 auto;
  min-width: 0;
}

.time-reporting-field > label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.time-reporting-field-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: var(--size-md);
}

.time-reporting-field-row--nowrap {
  flex-wrap: nowrap;
}

.time-reporting-field-row > span {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* Rate Input - Compact */
.time-reporting-rate-input-small {
  width: 45px;
  min-width: 45px;
  max-width: 45px;
  padding: 3px 4px;
  font-size: 12px;
  text-align: right;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  flex-shrink: 0;
  flex-grow: 0;
}

.time-reporting-rate-input-small:focus {
  outline: none;
  border-color: var(--primary);
}

.time-reporting-currency {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.time-reporting-separator {
  font-size: 11px;
  color: var(--text-muted);
}

/* Rate Type Toggle */
.time-reporting-rate-type {
  display: inline-flex;
  align-items: center;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.time-reporting-rate-type input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.time-reporting-rate-type label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 2px;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s; /* Specific properties only */
}

.time-reporting-rate-type input[type="radio"]:checked + label {
  background: var(--bg);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.time-reporting-rate-type label:hover {
  color: var(--text);
}

/* Hours per day input */
.time-reporting-hours-input {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  padding: 3px 4px;
  font-size: 12px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  flex-shrink: 0;
  flex-grow: 0;
}

.time-reporting-hours-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Working Days - Compact Toggle Pills */
.time-reporting-working-days {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: var(--size-md);
}

.time-reporting-day-btn {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s; /* Specific properties only */
  min-width: 32px;
  text-align: center;
}

.time-reporting-day-btn:hover {
  border-color: var(--primary);
}

.time-reporting-day-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Holidays and PDF Rows - Inline */
.time-reporting-holidays-row,
.time-reporting-pdf-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--size-md);
}

.time-reporting-holidays-row .country-input {
  padding: var(--space-1) 4px;
  font-size: var(--font-size-xs);
  width: 2.5rem;
  min-width: 2.5rem;
  max-width: 2.5rem;
  text-align: center;
  flex-shrink: 0;
  flex-grow: 0;
}
