/* Rafina Jalali calendar: date picker and field twins.
   Uses the Rafina theme's tokens when present, with plain fallbacks elsewhere
   (client area, other admin themes). */

.rj-real {
    display: none !important;
}

.rj-proxy {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "ss01"; /* Persian digits, like the rest of the page */
    text-align: right;
}

/* A range holds two dates: room for both */
.rj-proxy[data-range] {
    min-inline-size: 15rem;
}

/* Date with time: left to right (else "05 1405/07/08:"), wide enough for both */
.rj-proxy[data-time],
.rj-proxy.time {
    min-inline-size: 190px;
    direction: ltr;
    text-align: right;
}

/* In search / filter columns the field fills its column */
.form-group > .date-picker-prepend-icon:has(> .rj-proxy),
[class*="col-"] > .date-picker-prepend-icon:has(> .rj-proxy),
[class*="col-"] > .form-group.date-picker-prepend-icon:has(> .rj-proxy) {
    display: block;
}

[class*="col-"] .date-picker-prepend-icon > .rj-proxy {
    inline-size: 100%;
}

.rj-proxy.rj-invalid {
    border-color: var(--rf-danger, #d92d20) !important;
    box-shadow: 0 0 0 3px rgb(217 45 32 / 0.15) !important;
}

.rj-picker {
    --rj-brand: var(--rf-brand-500, #0069ff);
    --rj-brand-soft: var(--rf-brand-50, #eef5ff);
    --rj-text: var(--rf-text, #101828);
    --rj-text-2: var(--rf-text-2, #475467);
    --rj-text-3: var(--rf-text-3, #667085);
    --rj-surface: var(--rf-surface, #fff);
    --rj-surface-2: var(--rf-surface-2, #f8f9fc);
    --rj-border: var(--rf-border, #e4e8ef);
    --rj-danger: var(--rf-danger, #d92d20);
    position: absolute;
    z-index: 2000;
    inline-size: 292px;
    padding: 12px;
    border: 1px solid var(--rj-border);
    border-radius: var(--rf-r-lg, 14px);
    background: var(--rj-surface);
    box-shadow: 0 12px 32px rgb(16 24 40 / 0.16), 0 2px 6px rgb(16 24 40 / 0.06);
    color: var(--rj-text);
    font-family: var(--rf-font, "IRANSansX", Tahoma, sans-serif);
    font-size: 13px;
    font-feature-settings: "ss01";
    line-height: 1.5;
    direction: rtl;
    text-align: right;
    user-select: none;
}

.rj-picker *,
.rj-picker *::before,
.rj-picker *::after {
    box-sizing: border-box;
}

.rj-picker button {
    font: inherit;
    cursor: pointer;
}

.rj-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-block-end: 8px;
}

.rj-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rj-month,
.rj-year {
    block-size: 32px;
    margin: 0;
    padding: 0 8px;
    border: 1px solid var(--rj-border);
    border-radius: var(--rf-r-sm, 8px);
    background: var(--rj-surface);
    color: var(--rj-text);
    font: inherit;
    font-weight: 600;
}

.rj-month {
    inline-size: 104px;
    padding-inline-end: 24px;
}

.rj-year {
    inline-size: 72px;
    text-align: center;
    -moz-appearance: textfield;
}

.rj-year::-webkit-inner-spin-button,
.rj-year::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* RTL: the previous month is to the right, its arrow points right */
.rj-nav {
    display: grid;
    place-items: center;
    inline-size: 32px;
    block-size: 32px;
    padding: 0;
    border: 1px solid var(--rj-border);
    border-radius: var(--rf-r-sm, 8px);
    background: var(--rj-surface);
    color: var(--rj-text-2);
}

.rj-nav::before {
    content: "";
    inline-size: 8px;
    block-size: 8px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(-45deg); /* points right: back to the previous month */
    margin-inline-start: 3px;
}

.rj-nav--next::before {
    transform: rotate(135deg); /* points left: on to the next month */
    margin-inline-start: 0;
    margin-inline-end: 3px;
}

.rj-nav:hover {
    background: var(--rj-surface-2);
    color: var(--rj-text);
}

.rj-hint {
    margin-block-end: 6px;
    color: var(--rj-text-3);
    font-size: 12px;
    text-align: center;
}

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

.rj-week span {
    padding: 4px 0;
    color: var(--rj-text-3);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.rj-week .is-friday {
    color: var(--rj-danger);
}

.rj-day {
    position: relative;
    display: grid;
    place-items: center;
    block-size: 34px;
    padding: 0;
    border: 0;
    border-radius: var(--rf-r-sm, 8px);
    background: none;
    color: var(--rj-text);
    font-variant-numeric: tabular-nums;
}

.rj-day--blank {
    pointer-events: none;
}

.rj-day:hover {
    background: var(--rj-surface-2);
}

.rj-day.is-friday {
    color: var(--rj-danger);
}

/* Today: a ring, readable without colour */
.rj-day.is-today {
    box-shadow: inset 0 0 0 1.5px var(--rj-brand);
    font-weight: 700;
}

.rj-day.is-in-range {
    border-radius: 0;
    background: var(--rj-brand-soft);
}

.rj-day.is-selected {
    background: var(--rj-brand);
    color: #fff;
    font-weight: 700;
}

.rj-day:focus-visible,
.rj-nav:focus-visible,
.rj-link:focus-visible,
.rj-preset:focus-visible {
    outline: 2px solid var(--rj-brand);
    outline-offset: 1px;
}

.rj-foot {
    display: flex;
    justify-content: space-between;
    margin-block-start: 8px;
    padding-block-start: 8px;
    border-block-start: 1px solid var(--rj-border);
}

.rj-link {
    padding: 4px 8px;
    border: 0;
    border-radius: var(--rf-r-sm, 8px);
    background: none;
    color: var(--rj-brand);
    font-weight: 600;
}

.rj-link:hover {
    background: var(--rj-brand-soft);
}

.rj-link--muted {
    color: var(--rj-text-3);
}

.rj-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-block-start: 8px;
    padding-block-start: 8px;
    border-block-start: 1px solid var(--rj-border);
}

.rj-preset {
    padding: 3px 10px;
    border: 1px solid var(--rj-border);
    border-radius: 999px;
    background: var(--rj-surface);
    color: var(--rj-text-2);
    font-size: 12px;
}

.rj-preset:hover {
    border-color: var(--rj-brand);
    color: var(--rj-brand);
}

@media (prefers-reduced-motion: no-preference) {
    .rj-picker {
        animation: rj-in 120ms ease-out;
    }
}

@keyframes rj-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Addon page (addonmodules.php?module=rafina_jalali) ---------- */

.rf-jl {
    display: grid;
    gap: 16px;
}

.rf-jl-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    padding: 20px;
    border: 1px solid var(--rf-border, #e4e8ef);
    border-radius: var(--rf-r-lg, 14px);
    background: var(--rf-surface, #fff);
    box-shadow: var(--rf-shadow-xs, none);
}

.rf-jl-hero__date {
    display: grid;
    place-items: center;
    flex: none;
    inline-size: 120px;
    padding: 14px 8px;
    border-radius: var(--rf-r-md, 12px);
    background: var(--rf-brand-500, #0069ff);
    color: #fff;
    text-align: center;
}

.rf-jl-hero__day {
    font-size: 40px;
    font-weight: 800;
    line-height: 1.1;
}

.rf-jl-hero__month {
    font-size: 15px;
    font-weight: 600;
}

.rf-jl-hero__weekday {
    margin-block-start: 4px;
    font-size: 12px;
    opacity: 0.85;
}

.rf-jl-hero__text {
    flex: 1 1 320px;
    min-inline-size: 0;
}

.rf-jl-hero__text h2 {
    margin: 0 0 6px;
    font-size: var(--rf-fs-xl, 20px);
    font-weight: 700;
}

.rf-jl-hero__text p {
    margin: 0 0 6px;
    line-height: 1.8;
}

.rf-jl-muted {
    color: var(--rf-text-3, #667085);
    font-size: var(--rf-fs-sm, 13px);
}

.rf-jl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    align-items: start;
}

.rf-jl-card {
    padding: 18px 20px;
    border: 1px solid var(--rf-border, #e4e8ef);
    border-radius: var(--rf-r-lg, 14px);
    background: var(--rf-surface, #fff);
    box-shadow: var(--rf-shadow-xs, none);
}

.rf-jl-card h3 {
    margin: 0 0 12px;
    font-size: var(--rf-fs-lg, 16px);
    font-weight: 700;
}

.rf-jl-card .form-group {
    margin-block-end: 6px;
}

.rf-jl-table {
    inline-size: 100%;
    margin: 0 0 14px;
    border-collapse: collapse;
}

.rf-jl-table td {
    padding: 9px 0;
    border-block-end: 1px solid var(--rf-border, #e4e8ef);
    font-size: var(--rf-fs-sm, 13px);
}

.rf-jl-table td:last-child {
    text-align: end;
}

.rf-jl-table tr:last-child td {
    border-block-end: 0;
}
