/**
 * ROOTs
 */
:root {
    --dialog-font-size: 13.5pt;
    --dialog-color-primary: #1e3a8a;
    --dialog-border-radius: 10px;
    --dialog-control-border-color: #cbd5e1;
}

/**
 * DIVs
 */
.dialog-div {
    position: fixed;
    top: 2.5vh;
    right: 2.5vh;
    min-width: 20vh;
    max-width: 90%;
    width: auto;
    height: fit-content;
    min-height: 4vh;
    padding: 1vh;

    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.10);
    border-radius: var(--dialog-border-radius);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);

    z-index: 99999;                     /*xxxxx (5)*/
    opacity: 0;
    transform: scale(0.9);
    transition:
            opacity 0.3s ease-out,
            transform 0.3s ease-out,
            box-shadow 0.15s ease,
            border-color 0.15s ease;
    margin-left: 2vh;
}

.dialog-div,
.dialog-full-size,
.dialog-div input,
.dialog-div select,
.dialog-div textarea,
.dialog-div button,
.dialog-full-size input,
.dialog-full-size select,
.dialog-full-size textarea,
.dialog-full-size button {
    font-family: var(--font-main), serif;
}

.dialog-full-size {
    position: fixed;
    top: 5rem;
    left: 50%;
    z-index: 88888;
    width: min(62rem, calc(100vw - 16rem));
    height: auto;
    max-height: calc(100vh - 6rem);
    min-width: 20vh;
    min-height: 4vh;
    padding: 1rem;

    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--dialog-control-border-color);
    border-radius: 0.9rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);

    opacity: 0;
    transform: translateX(-50%) translateY(-0.5rem) scale(0.98);
    transition:
            opacity 0.3s ease-out,
            transform 0.3s ease-out,
            box-shadow 0.15s ease,
            border-color 0.15s ease;
}

.dialog-full-size, .dialog-full-size *:not(i) {
    z-index: 88888;                     /*xxxxx (5)*/
}

.dialog-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.35rem;
    margin: 0 2.4rem 0.85rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e6edf6;
    color: #172033;
    font-size: 1.04rem;
    font-weight: 900;
}

.dialog-header-icon {
    display: inline-flex;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 0.55rem;
    background: #2563eb;
    color: #ffffff;
    font-size: 1rem;
}

.dialog-header-text {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.dialog-header-title {
    color: #172033;
    font-size: 1.04rem;
    font-weight: 900;
    line-height: 1.15;
}

.dialog-header-subtitle {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
}

.dialog-content {
    margin-top: 0;
    max-height: calc(100vh - 11rem);
    overflow-y: auto;
    overflow-x: hidden;
}

.dialog-div * {
    user-select: none;
}

.dialog-from-top *:not(b) {
    user-select: none;
}

.dialog-from-top b {
    user-select: text;
}

.dialog-div.show {
    opacity: 1;
    transform: scale(1);
}

.dialog-full-size.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

.dialog-div.hide, .dialog-full-size.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-0.5rem) scale(0.98);
}

.dialog-from-top {
    position: fixed;
    top: -160px;
    left: 50%;
    right: auto;
    box-sizing: border-box;
    width: min(34rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2.2rem);
    padding: 0.95rem 1.05rem;
    border: 1px solid var(--dialog-control-border-color);
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
    overflow: auto;
    transform: translateX(-50%);
    transition:
            top 0.3s ease-out,
            opacity 0.25s ease,
            box-shadow 0.15s ease,
            border-color 0.15s ease;
}

.dialog-from-top.show {
    top: 1.1rem;
    transform: translateX(-50%);
}

.dialog-from-top button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 6.5rem;
    min-height: 2.35rem;
    margin-top: 0.75rem !important;
    border: 1px solid #dbe3ef;
    border-radius: 0.55rem;
    font-weight: 600;
    transition:
            background-color 0.15s ease,
            color 0.15s ease,
            border-color 0.15s ease,
            transform 0.1s ease,
            box-shadow 0.15s ease,
            opacity 0.15s ease;
}

.dialog-from-top button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
}

.dialog-from-top button:focus {
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    color: white;
}

/**
 * BUTTONs
 */
.dialog-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    height: 2.1rem;
    width: 2.1rem;

    background: linear-gradient(135deg, darkred, #dc2626);
    color: white;
    border: 1px solid rgba(127, 29, 29, 0.28);
    border-radius: 5px;

    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.24);

    transition:
            background-color 0.15s ease,
            color 0.15s ease,
            transform 0.1s ease,
            box-shadow 0.15s ease,
            border-color 0.15s ease;
}

.dialog-close:hover {
    background: linear-gradient(135deg, #7f1d1d, #b91c1c);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.30);
}

.dialog-close:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.22);
}

/**
 * LABELs
 */
.dialog-message {
    position: relative;
    transform: none;
    top: auto;
    bottom: auto;
    left: auto;
    text-align: center;
    font-size: var(--dialog-font-size);
    color: var(--dialog-color-primary) !important;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 93%;
    display: block;
    margin-left: 5vh;
}

.dialog-from-top .dialog-message {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    color: #172033 !important;
    font-size: 0.98rem;
    line-height: 1.45;
    cursor: text;
    overflow: visible;
    text-overflow: initial;
}

.dialog-detail {
    display: grid;
    width: 93%;
    margin: 0 auto;
    gap: 0.75rem;
    text-align: left;
}

.dialog-detail-title {
    margin: 0;
    color: #172033;
    font-size: 0.98rem;
    font-weight: 900;
    text-align: center;
}

.dialog-detail-control,
.dialog-detail-value {
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
}

.dialog-detail-value {
    min-height: 7rem;
    padding: 0.8rem;
    border: 1px solid var(--dialog-control-border-color);
    border-radius: 0.5rem;
    background: #f8fafc;
    color: #172033;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: normal;
}

.dialog-from-top .dialog-button-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.dialog-from-top input[type="checkbox"] + label {
    color: #172033;
    font-size: 10pt;
}

.dialog-search-select {
    display: grid;
    width: min(34rem, calc(100vw - 2rem));
    max-width: 100%;
    border: 1px solid var(--dialog-control-border-color);
    border-radius: 0.65rem;
    background: #ffffff;
    overflow: hidden;
}

.dialog-search-select-search {
    display: grid;
    grid-template-columns: 2.2rem minmax(0, 1fr);
    align-items: center;
    border-bottom: 1px solid var(--dialog-control-border-color);
    background: #f8fafc;
}

.dialog-search-select-search i {
    color: #64748b;
    text-align: center;
}

.dialog-search-select-search input {
    box-sizing: border-box;
    width: 100%;
    height: 2.35rem;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #172033;
    font: inherit;
    font-weight: 400;
    outline: none;
}

.dialog-search-select-box {
    box-sizing: border-box;
    width: 100%;
    height: min(12rem, 36vh);
    min-height: 8rem;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: #ffffff;
    color: #172033;
    font: inherit;
    font-weight: 400;
    outline: none;
}

.dialog-search-select-box option {
    padding: 0.35rem 0.65rem;
}

.dialog-search-select-label {
    display: block;
    margin: 0 0 0.5rem;
    color: #172033;
    font-size: 0.98rem;
    font-weight: 900;
}

.dialog-search-select-hint {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 0.55rem;
}

.dialog-search-select-hint span {
    padding: 0.2rem 0.55rem;
    border: 1px solid #e9d5ff;
    border-radius: 999px;
    background: #faf5ff;
    color: #7e22ce;
    font-size: 0.72rem;
    font-weight: 900;
}

.dialog-field-label {
    display: block;
    margin: 0.8rem 0 0.35rem;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
}

.dialog-field-control {
    box-sizing: border-box;
    width: min(34rem, calc(100vw - 2rem));
    max-width: 100%;
    height: 2.35rem;
    border: 1px solid var(--dialog-control-border-color);
    border-radius: 0.55rem;
    background: #ffffff;
    color: #172033;
    font: inherit;
}

.dialog-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.7rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

body.darkmode .dialog-from-top {
    background: rgba(31, 35, 41, 0.98);
    border-color: rgba(148, 163, 184, 0.22);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

body.darkmode .dialog-from-top .dialog-message,
body.darkmode .dialog-from-top input[type="checkbox"] + label {
    color: #e5edf9 !important;
}

body.darkmode .dialog-search-select,
body.darkmode .dialog-search-select-box {
    background: var(--darkmode-surface-color-soft);
    border-color: var(--darkmode-border-color);
    color: var(--darkmode-text-color);
}

body.darkmode .dialog-header-title {
    color: var(--darkmode-text-color);
}

body.darkmode .dialog-header-subtitle {
    color: var(--darkmode-muted-color);
}

body.darkmode .dialog-search-select-search {
    background: var(--darkmode-surface-color);
    border-bottom-color: var(--darkmode-border-color);
}

body.darkmode .dialog-search-select-search input,
body.darkmode .dialog-search-select-label {
    color: var(--darkmode-text-color);
}

body.darkmode .dialog-search-select-search i {
    color: var(--darkmode-muted-color);
}

body.darkmode .dialog-field-label {
    color: var(--darkmode-muted-color);
}

body.darkmode .dialog-field-control {
    background: var(--darkmode-surface-color-soft);
    border-color: var(--darkmode-border-color);
    color: var(--darkmode-text-color);
}

body.darkmode .dialog-detail-title,
body.darkmode .dialog-detail-value {
    color: var(--darkmode-text-color);
}

body.darkmode .dialog-detail-value {
    border-color: var(--darkmode-border-color);
    background: var(--darkmode-surface-color-soft);
}

body.darkmode .dialog-checkbox-label {
    color: var(--darkmode-text-color);
}

body.darkmode .dialog-search-select-hint span {
    background: rgba(126, 34, 206, 0.2);
    border-color: rgba(192, 132, 252, 0.42);
    color: #d8b4fe;
}

/**
 * IMAGES
 */
.dialog-image {
    position: absolute;
    top: 50%;
    transform: translate(0, -50%);
    height: 90%;
    max-height: 4vh;
    margin-left: 0.2vh;
    margin-top: 0.2vh;
}

/**
 * INPUTs
 */
.dialog-content input:not([type="checkbox"]):not([type="radio"]),
.dialog-content select,
.dialog-content textarea {
    box-sizing: border-box;
    width: min(28rem, calc(100vw - 19rem));
    max-width: 100%;
    min-width: 20vh;
    min-height: 2.2rem;
    border: 1px solid var(--dialog-control-border-color);
    border-radius: 0.5rem;
    background: #ffffff;
    color: #172033;
    font: inherit;
    font-weight: 400;
}

.dialog-content textarea {
    min-height: 8rem;
}

.dialog-content select[multiple] {
    min-height: 5.6rem;
}

body.darkmode .dialog-content input:not([type="checkbox"]):not([type="radio"]),
body.darkmode .dialog-content select,
body.darkmode .dialog-content textarea {
    background: var(--darkmode-surface-color-soft);
    border-color: var(--darkmode-border-color);
    color: var(--darkmode-text-color);
}

/**
 * MEDIAs
 */
@media (max-width: 650px) {
    .dialog-full-size {
        top: 3.55rem;
        left: 5.1rem;
        right: 0.3rem;
        width: auto;
        max-height: calc(100vh - 4rem);
        transform: translateY(-0.5rem) scale(0.98);
    }

    .dialog-full-size.show {
        transform: translateY(0) scale(1);
    }
}
