@layer base {
  .calendar {
    min-width: 18rem;
    font-family: var(--font-family-base);
    background-color: var(--card);
    color: var(--card-foreground);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: var(--spacing-4);
    position: relative;
  }

  .nav {
    position: absolute;
    top: var(--spacing-4);
    right: var(--spacing-4);
    display: flex;
    align-items: center;
    gap: var(--spacing-1);
  }

  .button_previous,
  .button_next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm);
    background-color: transparent;
    color: var(--card-foreground);
    border: none;
    cursor: pointer;
    transition: background-color var(--animation-duration-fast) ease;
  }

  .button_previous:hover,
  .button_next:hover {
    background-color: var(--muted);
  }

  .button_previous:active,
  .button_next:active {
    background-color: var(--muted);
    transform: scale(0.97);
  }

  .button_previous svg,
  .button_next svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: currentColor;
  }

  .months {
    width: 100%;
  }

  .month {
    width: 100%;
  }

  .month_grid {
    width: 100%;
    border-collapse: collapse;
  }

  .month_caption {
    height: 2rem;
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-2);
  }

  .caption_label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--card-foreground);
  }

  .weekdays {
    margin-bottom: var(--spacing-1);
  }

  .weekday {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted-foreground);
  }

  .cell {
    position: relative;
  }

  .day {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .day_button {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-color: transparent;
    color: inherit;
    font-size: 0.9rem;
    font-weight: 400;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition:
      background-color var(--animation-duration-fast) ease,
      color var(--animation-duration-fast) ease;
  }

  .day_button:hover {
    background-color: var(--muted);
    color: var(--card-foreground);
  }

  .day_button:active:hover {
    background-color: var(--primary);
    color: var(--primary-foreground);
    transform: scale(0.97);
  }

  .selected .day_button {
    background-color: var(--primary);
    color: var(--primary-foreground);
    font-weight: 500;
  }

  .selected .day_button:hover {
    background-color: color-mix(in srgb, var(--primary) 90%, black);
    color: var(--primary-foreground);
  }

  .today .day_button {
    border: 1px solid var(--primary);
    font-weight: 500;
  }

  .today.selected .day_button {
    border-color: var(--primary-foreground);
  }

  .range_middle .day_button {
    background-color: color-mix(in srgb, var(--primary) 10%, transparent);
    color: var(--foreground);
    border-radius: 0;
  }

  .range_end .day_button {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .outside .day_button {
    color: var(--muted-foreground);
    opacity: 0.6;
  }

  .disabled .day_button {
    opacity: 0.3;
    cursor: not-allowed;
    background-color: transparent;
    color: var(--card-foreground);
  }

  .disabled .day_button:hover {
    background-color: transparent;
  }

  .footer {
    margin-top: var(--spacing-4);
    padding-top: var(--spacing-2);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
  }

  .hidden {
    display: none;
  }

  .chevron {
    display: flex;
  }

  /* Dark mode adjustments */
  :global(.dark) .range_middle .day_button {
    background-color: color-mix(in srgb, var(--primary) 20%, var(--background));
    color: var(--foreground);
  }

  :global(.dark) .day_button:hover {
    background-color: var(--muted);
    color: var(--card-foreground);
  }

  :global(.dark) .day_button:active:hover {
    background-color: var(--primary);
    color: var(--primary-foreground);
  }
}
