/* Custom Brazilian date picker (text input + calendar popup). */

.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.date-input-text {
    flex: 1 1 auto;
    min-width: 0;
    font-variant-numeric: tabular-nums;
}

.date-input-cal-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-primary);
    transition: background 0.12s ease, border-color 0.12s ease;
}

.date-input-cal-btn:hover {
    background: var(--accent, #06b6d4);
    border-color: var(--accent, #06b6d4);
}

/* The calendar lives in a Popover panel (z-index 9999 by default). The inline
   table date popup sits at z-index 10000, so lift the calendar above it. */
.popover-panel.date-input-cal-popover {
    z-index: 10001 !important;
}

/* Calendar panel (inside the shared Popover). */
.date-cal {
    width: 260px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    padding: 8px;
    user-select: none;
}

.date-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.date-cal-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.date-cal-nav {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm, 6px);
    color: var(--text-primary);
}

.date-cal-nav:hover {
    background: var(--bg-hover, rgba(127, 127, 127, 0.12));
}

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

.date-cal-weekday {
    text-align: center;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-tertiary, #9ca3af);
    padding: 2px 0;
}

.date-cal-cell {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm, 6px);
    color: var(--text-primary);
}

.date-cal-cell.empty {
    background: transparent;
}

.date-cal-cell.day {
    cursor: pointer;
}

.date-cal-cell.day:hover {
    background: var(--bg-hover, rgba(127, 127, 127, 0.15));
}

.date-cal-cell.today {
    outline: 1px solid var(--accent, #06b6d4);
    outline-offset: -1px;
}

.date-cal-cell.selected {
    background: var(--accent, #06b6d4);
    color: #fff;
    font-weight: 600;
}

.date-cal-footer {
    display: flex;
    justify-content: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.date-cal-today-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    padding: 5px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.date-cal-today-btn:hover {
    background: var(--accent, #06b6d4);
    color: #fff;
    border-color: var(--accent, #06b6d4);
}
