/* Shared widgets: RxSelect (dropdown) and RxDatePicker (calendar). The components live in Components/Widgets. */

.rx-select { position: relative; width: 100%; }

.rx-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
    min-height: 52px; padding: 0 20px 0 18px; text-align: left;
    border: 1.5px solid var(--color-border-input); border-radius: var(--radius-md);
    background: var(--color-surface); color: var(--color-text);
    font: inherit; font-size: 16px; cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rx-trigger:hover:not(:disabled) { border-color: var(--color-ink); }
.rx-trigger:focus-visible,
.rx-select.is-open .rx-trigger { outline: none; border-color: var(--color-ink); box-shadow: 0 0 0 4px rgba(12, 61, 48, 0.12); }
.rx-trigger:disabled { background: var(--color-bg); cursor: not-allowed; color: var(--color-text-muted); }
.rx-trigger-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-trigger-text.is-placeholder { color: var(--color-text-muted); }

/* The little arrow is an icon in a fixed pixel size, so it looks the same at any zoom. */
.rx-caret { display: flex; flex: 0 0 auto; color: var(--color-ink); transition: transform 0.2s ease; }
.rx-select.is-open:not(.rx-date) .rx-caret { transform: rotate(180deg); }

/* A see-through layer under the open menu, so a click anywhere else closes it. */
.rx-backdrop { position: fixed; inset: 0; z-index: 60; background: transparent; }

.rx-menu {
    position: absolute; z-index: 61; top: calc(100% + 8px); left: 0; min-width: 100%;
    max-height: 300px; overflow-y: auto; margin: 0; padding: 8px; list-style: none;
    background: #FFFFFF; border: 1px solid var(--color-border-soft); border-radius: 22px;
    box-shadow: 0 18px 44px rgba(16, 35, 27, 0.18);
    animation: rx-pop 0.14s ease-out;
}
/* When there is no room below, the menu opens upwards instead. */
.rx-menu.rx-up { top: auto; bottom: calc(100% + 8px); }
@keyframes rx-pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }

.rx-option {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 16px; border-radius: var(--radius-pill);
    font-size: 15px; font-weight: 600; color: var(--color-text); cursor: pointer;
}
.rx-option.is-active { background: #E6F3EC; }
.rx-option.is-selected { background: var(--color-ink); color: #FFFFFF; }

/* Calendar */
.rx-calendar { width: 320px; max-height: none; padding: 16px; border-radius: 26px; overflow: visible; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-nav {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 50%; background: #EEF6F1; color: var(--color-ink); cursor: pointer;
}
.cal-nav:hover { background: #DCEDE3; }
.cal-title {
    display: flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-radius: var(--radius-pill);
    background: transparent; color: var(--color-ink); font: inherit; font-size: 16px; font-weight: 800; cursor: pointer;
}
.cal-title:hover { background: #EEF6F1; }

.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-week span { padding: 4px 0 8px; text-align: center; font-size: 12px; font-weight: 800; color: var(--color-text-muted); }
.cal-day {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 50%; background: transparent; color: var(--color-text);
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.cal-day:hover:not(:disabled) { background: #E6F3EC; }
.cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--color-ink); }
.cal-day.is-selected, .cal-day.is-selected:hover:not(:disabled) { background: var(--color-ink); color: #FFFFFF; box-shadow: none; }
.cal-blank { aspect-ratio: 1; }
.cal-day:disabled { opacity: 0.35; cursor: not-allowed; }

.cal-months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 6px 0; }
.cal-month {
    padding: 16px 0; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--color-text);
    font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.cal-month:hover { background: #E6F3EC; }
.cal-month.is-selected { background: var(--color-ink); color: #FFFFFF; }

.cal-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border-soft); }
.cal-today {
    padding: 8px 14px; border: 0; border-radius: var(--radius-pill); background: transparent;
    color: var(--color-ink); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer;
}
.cal-today:hover:not(:disabled) { background: #E6F3EC; }
.cal-today:disabled { opacity: 0.35; cursor: not-allowed; }

.cal-nav:focus-visible, .cal-title:focus-visible, .cal-day:focus-visible, .cal-month:focus-visible, .cal-today:focus-visible {
    outline: 2px solid var(--color-ink); outline-offset: 2px;
}

@media (max-width: 700px) {
    .rx-calendar { width: 100%; }
}


/* Toasts: small messages that slide in at the top right and leave on their own. */
.toast-region {
    position: fixed; top: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 10px;
    width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
    --toast-accent: var(--color-ink);
    position: relative; overflow: hidden; pointer-events: auto; display: flex; align-items: center; gap: 12px;
    padding: 14px 12px 16px 14px; background: var(--color-surface); border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-md); box-shadow: 0 14px 40px rgba(16, 35, 27, 0.18);
    animation: toast-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
.toast.is-leaving { animation: toast-out 0.26s ease-in both; }
.toast-success { --toast-accent: #1F8F5F; }
.toast-error { --toast-accent: #C0392B; }
.toast-info { --toast-accent: #B7791F; }
.toast-icon {
    flex: 0 0 auto; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; color: #FFFFFF; background: var(--toast-accent);
}
.toast-text { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 700; line-height: 1.45; color: var(--color-text); overflow-wrap: anywhere; }
.toast-close {
    flex: 0 0 auto; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 50%; background: transparent; color: var(--color-text-muted); cursor: pointer;
}
.toast-close:hover { background: #E6F3EC; color: var(--color-ink); }
.toast-bar {
    position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--toast-accent); opacity: 0.55;
    transform-origin: left center; animation: toast-bar linear both;
}
.toast:hover .toast-bar { animation-play-state: paused; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(40px) scale(0.96); } }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (max-width: 700px) {
    .toast-region { top: 10px; right: 16px; left: 16px; width: auto; }
    @keyframes toast-in { from { opacity: 0; transform: translateY(-24px) scale(0.97); } to { opacity: 1; transform: none; } }
    @keyframes toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-24px) scale(0.97); } }
}
@media (prefers-reduced-motion: reduce) {
    .toast, .toast.is-leaving, .modal-backdrop, .modal-card { animation-duration: 0.01ms !important; }
    .toast-bar { animation: none; }
}

/* Confirm dialog: fades in, the card pops up a little. */
.modal-backdrop { animation: modal-fade 0.18s ease-out both; backdrop-filter: blur(2px); }
.modal-card { animation: modal-pop 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.modal-icon {
    width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: #E6F3EC; color: var(--color-ink);
}
.modal-icon.is-danger { background: var(--color-danger-bg); color: var(--color-danger-ink); }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }

/* The one time welcome popup for a new owner */
.welcome-confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 210; pointer-events: none; }
.welcome-card { max-width: 460px; text-align: center; align-items: center; position: relative; overflow: hidden; }
.welcome-card .btn { align-self: stretch; }
.welcome-card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 150px; z-index: 0;
    background: linear-gradient(180deg, var(--tile-lime) 0%, rgba(255, 255, 255, 0) 100%);
}
.welcome-card > * { position: relative; z-index: 1; }
.welcome-card h2 { margin: 18px 0 8px; }
.welcome-card p { margin: 0 0 14px; }
.welcome-badge {
    width: 72px; height: 72px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--gradient-primary); color: #fff;
    box-shadow: 0 10px 24px rgba(11, 127, 90, 0.35); position: relative;
    animation: welcome-pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.welcome-badge::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid var(--color-primary); opacity: 0; animation: welcome-ring 1.8s ease-out 0.5s 2;
}
.welcome-date {
    display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; padding: 6px 14px;
    border-radius: var(--radius-pill); background: var(--color-success-bg); color: var(--color-success-ink); font-weight: 600;
}
.welcome-note { color: var(--color-text-muted); }
@keyframes welcome-pop { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: none; } }
@keyframes welcome-ring { from { opacity: 0.6; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }
@media (prefers-reduced-motion: reduce) {
    .welcome-badge, .welcome-badge::after { animation: none; }
}
