/* "Set Time" popover for .timepicker inputs (Web/TagHelpers/Timepicker.cs,
   Web/wwwroot/js/timepicker.js). Figma: Design System StudyNet.io, node 1482-7742 (card),
   1490-6304 (hour list), 1490-6478 (minute list).

   Reuses the generic .popover-menu/.popover-menu-item shell (popover-menu.css) for the Hour
   and Min value lists - same anchor-name/position-anchor pairing convention, native
   popover="auto" light-dismiss. The outer card is its own popover="manual" element, same
   reasoning/positioning convention as follow-up.css's .appointment-date-picker-popup. */

/* site.css's `input.form-control[readonly] { pointer-events: none; }` (meant for genuinely
   non-interactive display fields) also matches this readonly input - without this override,
   clicking it would do nothing at all. Loaded after site.css so this wins on equal specificity. */
input.timepicker[readonly] {
    --_input-wrapper-bg-clr: var(--white-clr);

    pointer-events: auto;
    cursor: pointer;
}

.timepicker-popup {
    margin: 0.25rem 0 0;
    padding: 0;
    border: none;
    background: none;
    overflow: visible;
    position: fixed;
    inset: auto;
    position-area: bottom span-left;
    position-try-fallbacks: flip-block;
    z-index: 100;
}

.timepicker-card {
    width: 19.6875rem;
    /* 315px */
    padding: 1.5rem;
    background-color: var(--bw-white);
    border: 1px solid var(--gray-clr-200);
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
}

.timepicker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.timepicker-title {
    font-size: var(--fs-300);
    font-weight: var(--fw-500);
    color: var(--midnight-blue-clr-700);
}

.timepicker-ampm-toggle {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background-color: var(--gray-clr-100);
    border-radius: 0.625rem;
}

.timepicker-ampm-btn {
    min-width: 2.4375rem;
    height: 2rem;
    padding: 0 0.75rem;
    border: none;
    border-radius: 0.5rem;
    background-color: transparent;
    color: var(--gray-clr-400);
    font-size: var(--fs-300);
    font-weight: var(--fw-500);
    cursor: pointer;

    &.is-active {
        background-color: var(--bw-white);
        color: var(--midnight-blue-clr-700);
        box-shadow: var(--shadow-xs);
    }
}

.timepicker-fields {
    display: flex;
    gap: 1.25rem;
}

.timepicker-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    flex: 1;
    min-width: 0;
}

.timepicker-field-label {
    font-size: var(--fs-300);
    font-weight: var(--fw-500);
    color: var(--midnight-blue-clr-400);
}

.timepicker-field-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 2.25rem;
    padding: 0 0.75rem;
    border: 1px solid var(--gray-clr-200);
    border-radius: 0.5rem;
    background-color: var(--bw-white);
    cursor: pointer;

    &:hover {
        background-color: var(--gray-clr-50);
    }

    .iconify {
        font-size: 1rem;
        color: var(--gray-clr-400);
        flex-shrink: 0;
    }
}

.timepicker-field-value {
    font-size: var(--fs-300);
    font-weight: var(--fw-500);
    color: var(--midnight-blue-clr-700);
}

/* Hour (12 items)/Min (60 items) value lists - both share this modifier on top of the generic
   .popover-menu shell for fixed width + a scrollable, capped-height viewport. */
.timepicker-list {
    --_popover-menu-width: 7.625rem;
    /* 122px */
    max-height: 15.5rem;
    overflow-y: auto;

    .popover-menu-item {
        justify-content: center;
        text-align: center;
    }
}
