/*
 * Menyra theme integration for local third-party UI libraries.
 * Vendor source files remain untouched under webroot/vendor.
 */

/* Chosen */
.chosen-container {
    width: 100% !important;
    color: var(--mn-color-text);
    font-family: var(--mn-font-sans);
    font-size: var(--mn-font-size-sm);
}

.chosen-container-single .chosen-single,
.chosen-container-multi .chosen-choices {
    min-height: 2.75rem;
    box-sizing: border-box;
    border: var(--mn-border-default);
    border-radius: var(--mn-radius-md);
    background: var(--mn-color-surface);
    background-image: none;
    box-shadow: none;
    color: var(--mn-color-text);
}

.chosen-container-single .chosen-single {
    display: flex;
    align-items: center;
    padding: 0 2.25rem 0 0.75rem;
    line-height: normal;
}

.chosen-container-single .chosen-single div {
    top: 0.45rem;
}

.chosen-container-multi .chosen-choices {
    padding: 0.25rem 0.5rem;
}

.chosen-container-multi .chosen-choices li.search-choice {
    border: 0;
    border-radius: var(--mn-radius-sm);
    background: var(--mn-color-primary-soft);
    background-image: none;
    box-shadow: none;
    color: var(--mn-color-primary);
}

.chosen-container .chosen-drop {
    border: var(--mn-border-default);
    border-radius: 0 0 var(--mn-radius-md) var(--mn-radius-md);
    background: var(--mn-color-surface);
    box-shadow: var(--mn-shadow-md);
    color: var(--mn-color-text);
}

.chosen-container .chosen-results {
    color: var(--mn-color-text);
}

.chosen-container .chosen-results li.highlighted {
    background: var(--mn-color-primary);
    background-image: none;
    color: var(--mn-color-primary-text);
}

.chosen-container .chosen-results li.no-results {
    background: var(--mn-color-surface-subtle);
    color: var(--mn-color-text-muted);
}

.chosen-container-active .chosen-single,
.chosen-container-active .chosen-choices {
    border-color: var(--mn-color-focus);
    box-shadow: var(--mn-focus-ring);
}

.chosen-container .chosen-search input[type="text"],
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
    color: var(--mn-color-text);
}

/* Summernote Lite */
.note-editor.note-frame {
    border: var(--mn-border-default);
    border-radius: var(--mn-radius-md);
    background: var(--mn-color-surface);
    color: var(--mn-color-text);
    box-shadow: none;
}

.note-editor.note-frame:focus-within {
    border-color: var(--mn-color-focus);
    box-shadow: var(--mn-focus-ring);
}

.note-toolbar {
    border-bottom: var(--mn-border-default);
    border-radius: var(--mn-radius-md) var(--mn-radius-md) 0 0;
    background: var(--mn-color-surface-subtle);
}

.note-btn {
    border-color: var(--mn-color-border);
    background: var(--mn-color-surface);
    color: var(--mn-color-text);
}

.note-btn:hover,
.note-btn:focus,
.note-btn.active {
    border-color: var(--mn-color-primary);
    background: var(--mn-color-primary-soft);
    color: var(--mn-color-primary);
}

.note-editable,
.note-statusbar {
    background: var(--mn-color-surface);
    color: var(--mn-color-text);
}

.note-editable {
    line-height: var(--mn-line-height-body);
}

.note-placeholder {
    color: var(--mn-color-text-subtle);
}

.note-dropdown-menu,
.note-modal-content {
    border-color: var(--mn-color-border);
    background: var(--mn-color-surface);
    color: var(--mn-color-text);
    box-shadow: var(--mn-shadow-lg);
}

.note-modal-header,
.note-modal-footer {
    border-color: var(--mn-color-border);
}

.note-form-control {
    border-color: var(--mn-color-border);
    background: var(--mn-color-surface);
    color: var(--mn-color-text);
}

/* SweetAlert2 */
div:where(.swal2-container) div:where(.swal2-popup) {
    border: var(--mn-border-default);
    border-radius: var(--mn-radius-xl);
    background: var(--mn-color-surface);
    color: var(--mn-color-text);
    box-shadow: var(--mn-shadow-lg);
    font-family: var(--mn-font-sans);
}

div:where(.swal2-container) h2:where(.swal2-title) {
    color: var(--mn-color-text);
}

div:where(.swal2-container) div:where(.swal2-html-container) {
    color: var(--mn-color-text-muted);
}

div:where(.swal2-container) button:where(.swal2-styled) {
    border-radius: var(--mn-radius-md);
    font-weight: var(--mn-font-weight-semibold);
}

/* Module 2.6 vendor responsive closure. */

.chosen-container,
.chosen-container .chosen-drop,
.chosen-container .chosen-search input[type="text"] {
    max-width: 100%;
}

.note-editor.note-frame {
    max-width: 100%;
}

.note-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
}

.note-toolbar > .note-btn-group {
    margin-right: 0;
}

.note-modal-content {
    width: min(36rem, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
}

div:where(.swal2-container) div:where(.swal2-popup) {
    width: min(32rem, calc(100% - 2rem));
    max-width: calc(100% - 2rem);
}

@media (max-width: 40rem) {
    .chosen-container-single .chosen-single,
    .chosen-container-multi .chosen-choices {
        min-height: 2.875rem;
    }

    .note-toolbar {
        padding: var(--mn-space-2);
    }

    .note-editable {
        min-height: 8rem;
    }

    .note-modal-content {
        width: calc(100vw - 1rem);
        max-width: calc(100vw - 1rem);
    }

    div:where(.swal2-container) div:where(.swal2-popup) {
        width: calc(100% - 1rem);
        max-width: calc(100% - 1rem);
    }

    div:where(.swal2-container) div:where(.swal2-actions) {
        width: 100%;
        gap: var(--mn-space-2);
    }

    div:where(.swal2-container) button:where(.swal2-styled) {
        flex: 1 1 auto;
        margin: 0;
    }
}
