/*
 * Porsineh administration UI
 * Loaded after Rasad for both LTR and RTL admin pages.
 */

:root {
    --porsineh-ink: #172033;
    --porsineh-muted: #687386;
    --porsineh-primary: #214f7e;
    --porsineh-primary-hover: #193c60;
    --porsineh-primary-soft: #eef4fa;
    --porsineh-page: #f7f9fc;
    --porsineh-surface: #ffffff;
    --porsineh-border: #e2e8f0;
    --porsineh-control-border: #d2dce8;
    --porsineh-focus: rgba(33, 79, 126, 0.16);
    --porsineh-shadow-sm: 0 2px 8px rgba(23, 32, 51, 0.05);
    --porsineh-shadow-md: 0 10px 28px rgba(23, 32, 51, 0.12);

    /* Keep Bootstrap helpers in sync with the dashboard palette. */
    --bs-primary: #214f7e;
    --bs-primary-rgb: 33, 79, 126;
    --bs-link-color: #214f7e;
    --bs-link-hover-color: #193c60;
    --bs-body-color: #172033;
    --bs-body-bg: #f7f9fc;
}

body {
    color: var(--porsineh-ink);
    background-color: var(--porsineh-page);
}

a {
    color: var(--porsineh-primary);
    transition: color 0.18s ease;
}

a:hover,
a:focus {
    color: var(--porsineh-primary-hover);
}

/* Buttons */
.btn {
    min-height: 40px;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-weight: 700;
    line-height: 1.25;
    box-shadow: none;
    transition: color 0.18s ease, background-color 0.18s ease,
        border-color 0.18s ease, box-shadow 0.18s ease,
        transform 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(33, 79, 126, 0.16);
}

.btn:focus,
.btn:focus-visible,
.btn:active:focus,
.btn.active:focus,
.btn.dropdown-toggle.show,
.btn.dropdown-toggle.show:focus,
.btn-check:focus + .btn {
    outline: 0;
    box-shadow: 0 0 0 3px var(--porsineh-focus) !important;
}

.btn:active,
.btn.active,
.btn.show,
.show > .btn.dropdown-toggle {
    transform: translateY(0);
}

.btn.disabled,
.btn:disabled,
.btn[disabled] {
    color: #7d8796;
    background: #e9edf3;
    border-color: #dce2ea;
    box-shadow: none !important;
    opacity: 0.72;
    transform: none;
}

.btn-primary,
.btn-info,
.btn-create {
    color: #fff;
    background: var(--porsineh-primary);
    border-color: var(--porsineh-primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.btn-info:hover,
.btn-info:focus,
.btn-info:active,
.btn-info.active,
.btn-create:hover,
.btn-create:focus,
.btn-create:active {
    color: #fff;
    background: var(--porsineh-primary-hover);
    border-color: var(--porsineh-primary-hover);
}

.btn-secondary,
.btn-cancel,
.btn-outline-primary,
.btn-outline-secondary {
    color: var(--porsineh-primary);
    background: #fff;
    border: 1px solid var(--porsineh-primary);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active,
.btn-secondary.active,
.btn-cancel:hover,
.btn-cancel:focus,
.btn-cancel:active,
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active,
.btn-outline-secondary.active {
    color: #fff;
    background: var(--porsineh-primary);
    border-color: var(--porsineh-primary);
}

.btn-danger,
.btn-outline-danger:hover,
.btn-outline-danger:focus {
    color: #fff;
    background: #c2414b;
    border-color: #c2414b;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active {
    color: #fff;
    background: #a9323c;
    border-color: #a9323c;
}

.btn-outline-danger {
    color: #b63540;
    background: #fff;
    border-color: #c2414b;
}

.btn-success {
    color: #fff;
    background: #287a4b;
    border-color: #287a4b;
}

.btn-success:hover,
.btn-success:focus,
.btn-success:active {
    color: #fff;
    background: #20643d;
    border-color: #20643d;
}

.btn-warning {
    color: #3d2a08;
    background: #e9b44c;
    border-color: #d9a23a;
}

.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active {
    color: #fff;
    background: #bd7c16;
    border-color: #aa6e11;
}

.btn-light {
    color: var(--porsineh-ink);
    background: #f1f4f8;
    border-color: #e1e7ef;
}

.btn-link {
    color: var(--porsineh-primary);
    box-shadow: none !important;
}

.btn-sm,
.btn-group-sm > .btn {
    min-height: 32px;
    padding: 0.38rem 0.68rem;
    border-radius: 8px;
}

.btn-lg,
.btn-group-lg > .btn {
    min-height: 46px;
    padding: 0.75rem 1.15rem;
    border-radius: 12px;
}

.btn-xs {
    min-height: 30px;
    padding: 0.28rem 0.52rem;
    border-radius: 8px;
}

.btn-icon {
    border-radius: 10px;
}

/* Form fields */
.form-control,
.form-select,
select.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
textarea {
    min-height: 42px;
    padding: 0.65rem 0.8rem;
    color: var(--porsineh-ink);
    background-color: #fff !important;
    border: 1px solid var(--porsineh-control-border) !important;
    border-radius: 10px;
    box-shadow: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease,
        background-color 0.18s ease;
}

.form-control:hover,
.form-select:hover,
select.form-control:hover,
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
textarea:hover {
    border-color: #afbed0 !important;
}

.form-control:focus,
.form-select:focus,
select.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
textarea:focus {
    color: var(--porsineh-ink);
    background-color: #fff !important;
    border-color: var(--porsineh-primary) !important;
    outline: 0;
    box-shadow: 0 0 0 3px var(--porsineh-focus) !important;
}

.form-control.ls-important-field,
.form-select.ls-important-field {
    color: var(--porsineh-ink);
    background: #fff !important;
    border: 1px solid var(--porsineh-control-border) !important;
    border-radius: 10px;
    box-shadow: var(--porsineh-shadow-sm);
}

.form-control.ls-important-field:focus,
.form-select.ls-important-field:focus {
    border-color: var(--porsineh-primary) !important;
    box-shadow: 0 0 0 3px var(--porsineh-focus) !important;
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled,
input:disabled,
input[readonly],
textarea:disabled,
textarea[readonly] {
    color: #7d8796;
    background-color: #eef1f5 !important;
    border-color: #dce2ea !important;
    box-shadow: none !important;
}

textarea.form-control,
textarea {
    min-height: 100px;
}

/* Rich-text editors */
.cke_chrome {
    width: 100% !important;
    overflow: hidden;
    padding: 0 !important;
    background: var(--porsineh-surface) !important;
    border: 1px solid var(--porsineh-control-border) !important;
    border-radius: 10px !important;
    box-shadow: var(--porsineh-shadow-sm) !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.cke_chrome:hover {
    border-color: #afbed0 !important;
}

.cke_chrome.cke_focus {
    border-color: var(--porsineh-primary) !important;
    box-shadow: 0 0 0 3px var(--porsineh-focus) !important;
}

.cke_top {
    padding: 0.55rem 0.6rem 0.25rem !important;
    background: #f7f9fc !important;
    border: 0 !important;
    border-bottom: 1px solid var(--porsineh-border) !important;
    border-radius: 0 !important;
}

.cke_toolgroup {
    overflow: hidden;
    margin-block-end: 0.3rem !important;
    background: #fff !important;
    border: 1px solid var(--porsineh-border) !important;
    border-radius: 7px !important;
    box-shadow: none !important;
}

.cke_toolbox .cke_button {
    margin: 0 !important;
    padding: 5px 6px !important;
    border-radius: 6px !important;
    transition: color 0.15s ease, background-color 0.15s ease,
        box-shadow 0.15s ease;
}

.cke_toolbox .cke_button:hover,
.cke_toolbox .cke_button:focus {
    color: var(--porsineh-primary) !important;
    background: var(--porsineh-primary-soft) !important;
    box-shadow: inset 0 0 0 2px var(--porsineh-focus) !important;
    outline: 0;
}

.cke_toolbox .cke_button.cke_button_on,
.cke_toolbox .cke_button.cke_button_on:hover,
.cke_toolbox .cke_button.cke_button_on:focus {
    color: var(--porsineh-primary) !important;
    background: #dce9f5 !important;
    box-shadow: inset 0 0 0 1px #b9cee2 !important;
}

.cke_toolbox .cke_button.cke_button_on .cke_button_icon i {
    color: var(--porsineh-primary) !important;
}

.cke_toolbox .cke_button.cke_button_disabled {
    background: transparent !important;
    box-shadow: none !important;
    opacity: 0.45;
}

.cke_toolgroup a.cke_button:last-child::after {
    display: none !important;
}

.cke_toolbox .cke_toolbar_separator {
    margin: 5px 4px !important;
    background: var(--porsineh-border) !important;
}

.cke_combo {
    margin-block-end: 0.3rem !important;
}

.cke_combo a.cke_combo_button,
.cke_combo_on a.cke_combo_button,
.cke_combo_off a.cke_combo_button:hover,
.cke_combo_off a.cke_combo_button:focus,
.cke_combo_off a.cke_combo_button:active {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    border: 1px solid var(--porsineh-border) !important;
    border-radius: 7px !important;
    box-shadow: none !important;
}

.cke_combo_on a.cke_combo_button,
.cke_combo_off a.cke_combo_button:hover,
.cke_combo_off a.cke_combo_button:focus {
    background: var(--porsineh-primary-soft) !important;
    border-color: #b9cee2 !important;
}

.cke_contents {
    background: #fff !important;
    border: 0 !important;
    border-radius: 0 !important;
}

.cke_wysiwyg_frame,
.cke_wysiwyg_div {
    background: #fff !important;
}

.cke_contents textarea.cke_source {
    min-height: 0;
    padding: 0.85rem 1rem;
    color: var(--porsineh-ink);
    background: #fff !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
    line-height: 1.65;
}

.cke_bottom {
    min-height: 22px;
    padding: 5px 8px !important;
    background: #f7f9fc !important;
    border: 0 !important;
    border-top: 1px solid var(--porsineh-border) !important;
    border-radius: 0 !important;
}

.cke_resizer {
    margin: 0 !important;
    opacity: 0.55;
}

.cke_toolbox_collapser {
    border-color: var(--porsineh-control-border) !important;
    border-radius: 4px;
}

.cke_toolbox_collapser:hover,
.cke_toolbox_collapser:focus {
    background: var(--porsineh-primary-soft) !important;
    border-color: var(--porsineh-primary) !important;
}

input[type="file"],
.form-control[type="file"] {
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    background: #fff;
    border: 1px solid var(--porsineh-control-border) !important;
    border-radius: 10px;
    box-shadow: none;
}

input[type="file"]::file-selector-button {
    position: static;
    transform: none;
    min-height: 30px;
    margin-block: -0.35rem;
    margin-inline: -0.45rem 0.65rem;
    padding: 0.35rem 0.7rem;
    color: var(--porsineh-primary);
    background: var(--porsineh-primary-soft);
    border: 0 !important;
    border-radius: 7px;
    font-weight: 700;
}

.form-label,
.col-form-label,
label {
    color: var(--porsineh-ink);
    font-weight: 600;
}

.form-text,
.help-block,
.hint,
.annotation {
    color: var(--porsineh-muted);
}

.input-group-text {
    color: var(--porsineh-primary);
    background: var(--porsineh-primary-soft);
    border: 1px solid var(--porsineh-control-border);
}

.input-group > .form-control,
.input-group > .form-select,
.input-group > .input-group-text,
.input-group > .btn {
    min-height: 42px;
}

/* Select2 is widely used throughout the admin UI. */
.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple,
.select2-container--bootstrap .select2-selection,
.select2-container--bootstrap-5 .select2-selection {
    min-height: 42px;
    color: var(--porsineh-ink);
    background: #fff;
    border: 1px solid var(--porsineh-control-border);
    border-radius: 10px;
    box-shadow: none;
}

.select2-container--focus .select2-selection,
.select2-container--open .select2-selection,
.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--porsineh-primary) !important;
    box-shadow: 0 0 0 3px var(--porsineh-focus) !important;
}

.select2-dropdown {
    overflow: hidden;
    border: 1px solid var(--porsineh-border);
    border-radius: 10px;
    box-shadow: var(--porsineh-shadow-md);
}

.select2-results__option--highlighted,
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    color: #fff;
    background: var(--porsineh-primary);
}

/* Checkboxes, radios and switches */
.form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    border: 1px solid #b9c5d4;
    box-shadow: none;
}

.form-check-input:focus {
    border-color: var(--porsineh-primary);
    box-shadow: 0 0 0 3px var(--porsineh-focus);
}

.form-check-input:checked {
    background-color: var(--porsineh-primary);
    border-color: var(--porsineh-primary);
}

input[type="checkbox"]:focus::after,
.checkbox input[type="checkbox"]:focus::after,
.checkbox-inline input[type="checkbox"]:focus::after {
    border-color: var(--porsineh-primary);
    box-shadow: 0 0 0 3px var(--porsineh-focus);
}

input[type="checkbox"]:checked::after,
.checkbox input[type="checkbox"]:checked::after,
.checkbox-inline input[type="checkbox"]:checked::after {
    background-color: var(--porsineh-primary);
    border-color: var(--porsineh-primary);
}

/* Tabs */
.nav-tabs {
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem;
    background: #fff;
    border: 1px solid var(--porsineh-border);
    border-radius: 12px;
}

.nav-tabs .nav-item {
    margin: 0;
}

.nav-tabs .nav-link {
    padding: 0.62rem 0.95rem;
    color: var(--porsineh-muted);
    background: transparent;
    border: 0;
    border-radius: 9px;
    font-weight: 700;
    transition: color 0.18s ease, background-color 0.18s ease,
        box-shadow 0.18s ease;
}

.nav-tabs .nav-link:hover,
.nav-tabs .nav-link:focus,
.nav-tabs .nav-link:hover:not(.active) {
    color: var(--porsineh-primary);
    background: var(--porsineh-primary-soft);
    border: 0 !important;
    box-shadow: none !important;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: #fff;
    background: var(--porsineh-primary);
    border: 0;
}

.nav-tabs .nav-link.disabled,
.nav-tabs .nav-link:disabled {
    color: #9aa3b1;
    background: transparent;
    opacity: 0.65;
}

.tab-content {
    margin-top: 0.75rem;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid var(--porsineh-border);
    border-radius: 14px;
}

/* Cards, panels and page sections */
.card,
.card.card-primary,
.ls-panelboxes .card.card-primary,
.panel,
.well,
.jumbotron,
.ls-settings-wrapper,
.panelbox {
    background: var(--porsineh-surface);
    border: 1px solid var(--porsineh-border);
    border-radius: 14px;
    box-shadow: var(--porsineh-shadow-sm);
}

.card.card-primary,
.ls-panelboxes .card.card-primary {
    padding: 1.25rem;
    border-radius: 14px;
}

.card.card-primary.card-clickable:hover,
.ls-panelboxes .card.card-primary.card-clickable:hover {
    border-color: #c9d6e5;
    box-shadow: 0 8px 22px rgba(33, 79, 126, 0.13);
}

.ls-settings-wrapper {
    padding: 1.25rem;
}

.card-header,
.panel-heading,
.panel-titlebar {
    color: var(--porsineh-ink);
    background: #fff;
    border-bottom: 1px solid #edf0f5;
    border-radius: 14px 14px 0 0;
}

.card-title,
.panel-title,
.pagetitle,
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--porsineh-ink);
}

.list-group {
    overflow: hidden;
    border-radius: 10px;
}

/* Question action menus extend beyond their nested list groups. Clipping these
   lists hides the menus behind the following question/group cards. */
#questionexplorer .list-group {
    overflow: visible;
}

.list-group-item {
    color: var(--porsineh-ink);
    background: #fff;
    border-color: #edf0f5;
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    color: var(--porsineh-ink);
    background: var(--porsineh-primary-soft);
}

.list-group-item.active {
    color: #fff;
    background: var(--porsineh-primary);
    border-color: var(--porsineh-primary);
}

/* Accordions */
.accordion-item {
    margin-bottom: 0.65rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--porsineh-border);
    border-radius: 12px !important;
}

.accordion-button {
    color: var(--porsineh-ink);
    background: #fff;
    font-weight: 700;
    box-shadow: none;
}

.accordion-button:not(.collapsed) {
    color: var(--porsineh-primary);
    background: var(--porsineh-primary-soft);
    box-shadow: none;
}

.accordion-button:focus {
    border-color: var(--porsineh-primary);
    box-shadow: inset 0 0 0 2px var(--porsineh-focus);
}

/* Tables and grids */
.table,
.grid-view table,
.grid-view-ls table {
    color: var(--porsineh-ink);
    background: #fff;
    border-color: #e7ebf1;
}

.table thead th,
.grid-view table thead th,
.grid-view-ls table thead th {
    color: var(--porsineh-ink);
    background: #f2f6fa;
    border-color: #e2e8f0;
    font-weight: 700;
}

.table-hover > tbody > tr:hover > *,
.grid-view table tbody tr:hover > *,
.grid-view-ls table tbody tr:hover > * {
    color: var(--porsineh-ink);
    background: #f5f8fb;
}

.table-responsive,
.grid-view,
.grid-view-ls {
    overflow: hidden;
    border: 1px solid var(--porsineh-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--porsineh-shadow-sm);
}

/* Menus, popovers and modals */
.dropdown-menu,
.popover,
.ui-menu {
    padding: 0.45rem;
    background: #fff;
    border: 1px solid var(--porsineh-border);
    border-radius: 11px;
    box-shadow: var(--porsineh-shadow-md);
}

.dropdown-item,
.ui-menu-item-wrapper {
    color: var(--porsineh-ink);
    border-radius: 7px;
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item.active,
.dropdown-item:active,
.ui-menu-item-wrapper.ui-state-active {
    color: var(--porsineh-primary);
    background: var(--porsineh-primary-soft);
}

.modal-content {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--porsineh-border);
    border-radius: 16px;
    box-shadow: 0 22px 60px rgba(23, 32, 51, 0.2);
}

/* Admin menus use unusually high z-index values. Keep dialogs and their
   backdrop above every sticky toolbar, sidebar and open navigation menu. */
.modal {
    z-index: 21000 !important;
}

.modal-backdrop {
    z-index: 20990 !important;
}

.modal-header,
.modal-footer {
    background: #fff;
    border-color: #edf0f5;
}

.modal-title {
    color: var(--porsineh-ink);
    font-weight: 800;
}

.btn-close {
    border-radius: 8px;
}

.btn-close:focus {
    box-shadow: 0 0 0 3px var(--porsineh-focus);
}

/* Topbar, pagination and feedback */
.topbar {
    background: rgba(247, 249, 252, 0.96);
    border-bottom: 1px solid var(--porsineh-border);
    box-shadow: 0 2px 8px rgba(23, 32, 51, 0.04);
    backdrop-filter: blur(8px);
}

.topbar.scroll-shadow {
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 8px 22px rgba(23, 32, 51, 0.1);
}

.pagination {
    gap: 0.25rem;
}

.page-link {
    min-width: 36px;
    min-height: 36px;
    color: var(--porsineh-primary);
    background: #fff;
    border: 1px solid var(--porsineh-border);
    border-radius: 8px !important;
}

.page-link:hover,
.page-link:focus {
    color: var(--porsineh-primary-hover);
    background: var(--porsineh-primary-soft);
    border-color: #c8d5e4;
    box-shadow: 0 0 0 3px var(--porsineh-focus);
}

.page-item.active .page-link {
    color: #fff;
    background: var(--porsineh-primary);
    border-color: var(--porsineh-primary);
}

.alert,
.toast {
    border-radius: 12px;
    box-shadow: var(--porsineh-shadow-sm);
}

.badge {
    border-radius: 999px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .nav-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .nav-tabs .nav-link {
        padding-inline: 0.75rem;
        white-space: nowrap;
    }

    .tab-content {
        padding: 0.85rem;
        border-radius: 12px;
    }

    .btn {
        max-width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    a,
    .form-control,
    .form-select,
    .nav-link {
        transition: none !important;
    }

    .btn:hover {
        transform: none;
    }
}

/* Tempus Dominus date/time picker --------------------------------------- */
/* The picker is mounted on <body>, so these rules intentionally live at the
   theme level instead of being nested under the publication panel. */
.tempus-dominus-widget {
    --td-widget-background: var(--porsineh-surface);
    --td-font-color: var(--porsineh-ink);
    --td-active-bg: var(--porsineh-primary);
    --td-range-bg: #dce9f6;
    --td-active-color: #fff;
    --td-active-border-color: var(--porsineh-primary);
    --td-border-radius: 9px;
    --td-btn-hover-bg: var(--porsineh-primary-soft);
    --td-disabled-color: #a1abba;
    --td-alternate-color: #a1abba;
    --td-secondary-border-color: var(--porsineh-border);
    --td-secondary-border-color-rgba: rgba(33, 79, 126, 0.18);
    --td-dow-color: var(--porsineh-muted);

    width: min(22rem, calc(100vw - 1.5rem));
    padding: 0.55rem;
    color: var(--porsineh-ink);
    background: var(--porsineh-surface);
    border: 1px solid var(--porsineh-border);
    border-radius: 14px;
    box-shadow: var(--porsineh-shadow-md);
    font-family: inherit;
    overflow: hidden;
}

/* The admin theme currently has a single light surface. Keep Tempus from
   switching to its unrelated default dark palette when the OS prefers dark. */
.tempus-dominus-widget.dark {
    --td-dark-widget-background: var(--porsineh-surface);
    --td-dark-font-color: var(--porsineh-ink);
    --td-dark-active-bg: var(--porsineh-primary);
    --td-dark-range-bg: #dce9f6;
    --td-dark-active-color: #fff;
    --td-dark-active-border-color: var(--porsineh-primary);
    --td-dark-btn-hover-bg: var(--porsineh-primary-soft);
    --td-dark-disabled-color: #a1abba;
    --td-dark-alternate-color: #a1abba;
    --td-dark-secondary-border-color: var(--porsineh-border);
    --td-dark-secondary-border-color-rgba: rgba(33, 79, 126, 0.18);
    --td-dark-primary-border-color: var(--porsineh-primary);
    --td-dark-text-shadow: none;
}

.tempus-dominus-widget .calendar-header {
    margin: 0 0 0.35rem;
    padding: 0.25rem 0.2rem 0.55rem;
    border-bottom: 1px solid var(--porsineh-border);
    font-weight: 800;
}

.tempus-dominus-widget .calendar-header > div {
    display: flex;
    min-height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.tempus-dominus-widget .calendar-header > div[data-action]:not(.disabled):hover {
    color: var(--porsineh-primary);
    background: var(--porsineh-primary-soft);
}

.tempus-dominus-widget .calendar-header .next,
.tempus-dominus-widget .calendar-header .previous {
    padding-inline: 0.4rem;
}

.tempus-dominus-widget .calendar-header i,
.tempus-dominus-widget .toolbar i {
    color: var(--porsineh-primary);
    font-size: 1.1rem;
}

.tempus-dominus-widget .date-container-days {
    direction: rtl;
    grid-auto-rows: 2.35rem;
    padding: 0.35rem 0.2rem 0.5rem;
}

.tempus-dominus-widget .date-container-days .dow {
    color: var(--porsineh-muted);
    font-size: 0.72rem;
    font-weight: 800;
}

.tempus-dominus-widget .date-container-days div:not(.no-highlight),
.tempus-dominus-widget .date-container-decades div:not(.no-highlight),
.tempus-dominus-widget .date-container-years div:not(.no-highlight),
.tempus-dominus-widget .date-container-months div:not(.no-highlight),
.tempus-dominus-widget .time-container-clock div:not(.no-highlight),
.tempus-dominus-widget .time-container-hour div:not(.no-highlight),
.tempus-dominus-widget .time-container-minute div:not(.no-highlight),
.tempus-dominus-widget .time-container-second div:not(.no-highlight) {
    width: 90%;
    height: 90%;
    border: 0 !important;
    border-radius: 9px !important;
    color: var(--porsineh-ink);
    font-variant-numeric: tabular-nums;
    transition: color 0.15s ease, background-color 0.15s ease,
        box-shadow 0.15s ease;
}

.tempus-dominus-widget .date-container-days div:not(.no-highlight):not(.disabled):not(.active):hover,
.tempus-dominus-widget .date-container-decades div:not(.no-highlight):not(.disabled):not(.active):hover,
.tempus-dominus-widget .date-container-years div:not(.no-highlight):not(.disabled):not(.active):hover,
.tempus-dominus-widget .date-container-months div:not(.no-highlight):not(.disabled):not(.active):hover,
.tempus-dominus-widget .time-container-clock div:not(.no-highlight):not(.disabled):not(.active):hover,
.tempus-dominus-widget .time-container-hour div:not(.no-highlight):not(.disabled):not(.active):hover,
.tempus-dominus-widget .time-container-minute div:not(.no-highlight):not(.disabled):not(.active):hover,
.tempus-dominus-widget .time-container-second div:not(.no-highlight):not(.disabled):not(.active):hover {
    background: var(--porsineh-primary-soft) !important;
    border: 0 !important;
}

.tempus-dominus-widget .date-container-days div:not(.no-highlight).active,
.tempus-dominus-widget .date-container-decades div:not(.no-highlight).active,
.tempus-dominus-widget .date-container-years div:not(.no-highlight).active,
.tempus-dominus-widget .date-container-months div:not(.no-highlight).active,
.tempus-dominus-widget .time-container-clock div:not(.no-highlight).active,
.tempus-dominus-widget .time-container-hour div:not(.no-highlight).active,
.tempus-dominus-widget .time-container-minute div:not(.no-highlight).active,
.tempus-dominus-widget .time-container-second div:not(.no-highlight).active {
    color: #fff !important;
    background: var(--porsineh-primary) !important;
    box-shadow: 0 3px 8px rgba(33, 79, 126, 0.2);
    text-shadow: none;
}

.tempus-dominus-widget .date-container-days div:not(.no-highlight).old:not(.active),
.tempus-dominus-widget .date-container-days div:not(.no-highlight).new:not(.active),
.tempus-dominus-widget .date-container-decades div:not(.no-highlight).old:not(.active),
.tempus-dominus-widget .date-container-decades div:not(.no-highlight).new:not(.active),
.tempus-dominus-widget .date-container-months div:not(.no-highlight).old:not(.active),
.tempus-dominus-widget .date-container-months div:not(.no-highlight).new:not(.active),
.tempus-dominus-widget .date-container-years div:not(.no-highlight).old:not(.active),
.tempus-dominus-widget .date-container-years div:not(.no-highlight).new:not(.active) {
    color: #a1abba !important;
}

.tempus-dominus-widget .toolbar {
    grid-auto-rows: 2.15rem;
    margin-top: 0;
    padding: 0.55rem 0.2rem 0.1rem;
    border-top: 1px solid var(--porsineh-border);
}

.tempus-dominus-widget .toolbar > div + div {
    border-inline-start: 1px solid var(--porsineh-border);
}

.tempus-dominus-widget .toolbar div {
    border-radius: 8px;
}

.tempus-dominus-widget .toolbar div:hover {
    background: var(--porsineh-primary-soft);
}

.tempus-dominus-widget .time-container {
    direction: ltr;
    margin: 0.7rem 0 0.85rem;
    text-align: left;
}

.tempus-dominus-widget .time-container-clock,
.tempus-dominus-widget .time-container-hour,
.tempus-dominus-widget .time-container-minute,
.tempus-dominus-widget .time-container-second {
    direction: ltr;
}

.tempus-dominus-widget .time-container-clock {
    grid-auto-rows: 2.35rem;
    padding: 0 0.65rem;
}

.tempus-dominus-widget [data-time-component="hours"],
.tempus-dominus-widget [data-time-component="minutes"],
.tempus-dominus-widget [data-time-component="seconds"],
.tempus-dominus-widget .separator {
    height: 3.2rem !important;
    color: var(--porsineh-primary);
    font-size: 2.35rem;
    font-weight: 800;
}

.tempus-dominus-widget button {
    color: #fff;
    background: var(--porsineh-primary);
    border-color: var(--porsineh-primary);
    border-radius: 8px;
}

.tempus-dominus-widget button:hover,
.tempus-dominus-widget button:focus {
    color: #fff;
    background: var(--porsineh-primary-hover);
    border-color: var(--porsineh-primary-hover);
}

/* Publication fields use a single visual direction even when the underlying
   Gregorian value is kept in a hidden/input value for the server. */
#publication-panel .input-group.date {
    direction: rtl;
}

#publication-panel .input-group.date > .form-control,
#publication-panel .publication-jalali-display {
    direction: ltr;
    text-align: left;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

#publication-panel .input-group.date > .form-control {
    border-start-start-radius: 10px;
    border-end-start-radius: 10px;
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}

#publication-panel .input-group.date > .input-group-text {
    display: inline-flex;
    min-width: 2.75rem;
    align-items: center;
    justify-content: center;
    border-start-start-radius: 0;
    border-end-start-radius: 0;
    border-start-end-radius: 10px;
    border-end-end-radius: 10px;
    cursor: pointer;
    transition: color 0.18s ease, background-color 0.18s ease;
}

#publication-panel .input-group.date > .input-group-text:hover,
#publication-panel .input-group.date > .input-group-text:focus-within {
    color: var(--porsineh-primary-hover);
    background: #dce9f6;
}

@media (max-width: 576px) {
    .tempus-dominus-widget {
        width: min(21rem, calc(100vw - 1rem));
    }
}
