/* ------------------------------------------------------------------------------- */
/* Base for jQuery UI Dialog and Form Elements */
/*
calendar backend:  #event-dialog   #category-dialog   #help-dialog
dialogClass: 'ter_kal_ui_dialog ter_kal_calendar_admin',
dialogClass: 'ter_kal_ui_dialog ter_kal_calendar_frontend',

calendar + ical frontend: .event-dialog
dialogClass: 'ter_kal_ui_dialog ter_kal_ical_dialog',
 */
.ui-dialog.ter_kal_ui_dialog {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
        Arial, sans-serif;
    font-size: 13px;
    border-radius: 1rem;
    border: none;
    border-width: 0;
    box-shadow: 0 2.5rem 5rem rgba(0, 0, 0, 1);
    z-index: 10000;
    overflow: hidden;
    width: 100%;
    height: 100%;
    max-width: 800px;
}

.ui-dialog.ter_kal_ui_dialog:focus {
    outline: none;
}

/* ------------------------------------------------------------------------------- */
.ui-dialog.ter_kal_ui_dialog .ui-dialog-content {
    width: 100%;
    background: #f8f9fa;
    padding: 1rem;
}

/* ------------------------------------------------------------------------------- */

.ui-dialog.ter_kal_ui_dialog .ui-dialog-titlebar {
    background: #007bff;
    color: #fff;
    border: 0px;
    border-radius: 1rem 1rem 0px 0px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
}


.ter_kal_ui_dialog.ter_kal_calendar_admin .ui-dialog-titlebar,
.ter_kal_ui_dialog.ter_kal_calendar_admin .ui-dialog-buttonpane {
    cursor: grab;
}

.ter_kal_ui_dialog.ter_kal_calendar_admin .ui-dialog-titlebar:active,
.ter_kal_ui_dialog.ter_kal_calendar_admin .ui-dialog-buttonpane:active {
    cursor: grabbing;
}

.ui-dialog.ter_kal_ui_dialog .ui-dialog-titlebar-close {
    background: none;
    border: 0px solid #fff;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.2);
    line-height: 1.6rem;
    opacity: 0.75;
    border-radius: 0.5rem;
    padding: 0.6rem 1.2;
    max-width: fit-content;
    cursor: pointer;
}

.ui-dialog.ter_kal_ui_dialog .ui-dialog-titlebar-close:hover,
.ui-dialog.ter_kal_ui_dialog .ui-dialog-titlebar-close:focus {
    opacity: 1;
}


.ui-dialog.ter_kal_ui_dialog .ui-dialog-title {
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.6rem;
    margin: 0;
    flex-grow: 1;
    padding-left: 3.6rem;
}

.ui-dialog.ter_kal_ui_dialog .dialog_title_icon {
    font-size: 3rem;
    line-height: 1.6rem;
    position: absolute;
    left: 1rem;
}


/* ------------------------------------------------------------------------------- */

.event-dialog input.regular-text {
    margin-bottom: 0.3rem;
}

/* ---------------------------- */
.event-dialog hr {
    margin: 0.1rem;
}

/* ------------------------------------------------------------------------------- */

.ui-dialog.ter_kal_ui_dialog .event-category {
    display: flex;
    align-items: center;
    /*justify-content: center;*/
    gap: 0.4rem;
}

.ui-dialog.ter_kal_ui_dialog .event-category label {
    /*margin: 0;*/
    /*white-space: nowrap;*/
}

.ui-dialog.ter_kal_ui_dialog .event-category select {
    /*flex: 1;*/
    /*display: inline-block;*/
}

/* ------------------------------------------------------------------------------- */
/* ter_kal_: Optimized responsive grid for event-dates form fields */
.event-form .event-dates {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.3rem;
    max-width: 100%;
}

.event-form .event-date {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    /* ter_kal_: Don't grow, don't shrink, auto width */
    min-width: fit-content;
}

.event-form .event-date label {
    display: block;
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

.event-form .event-date input,
.event-form .event-date select,
.event-form .event-date textarea {
    width: auto;
    min-width: fit-content;
    max-width: 100%;
}

/* ------------------------------------------------------------------------------- */

.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 0.6rem 1.2rem;
    border-radius: 0 0 0.3rem 0.3rem;
}

.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
    text-align: right;
}

.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane button {
    background: #007bff;
    border: 1px solid #898989;
    color: #fff;
    border-color: #898989;
    border-radius: 0.25rem;
    cursor: pointer;
    line-height: 1.4;
    margin-left: 0.5rem;
}

.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane button:hover,
.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane button:focus {
    background: #0056b3;
}

/* ------------------------------------------------------------------------------- */
/* Copy Button (Light Blue) */
.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane .tk_btn_copy {
    background-color: #2b47ae;
    color: #ffffff;
}

.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane .tk_btn_copy:hover {
    background-color: #182862;
}

/* Delete Button (Red) */
.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane .tk_btn_delete {
    background-color: #dc3545;
    color: #ffffff;
}

.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane .tk_btn_delete:hover {
    background-color: #bd2130;
}

/* Primary Dialog Button (Subtle Default) */
.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane .tk_btn_primary {
    background-color: transparent;
    color: #6c757d;
    border: 1px solid transparent;
}

.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane .tk_btn_primary:hover {
    color: #000000;
    background-color: #dedede;
}

/* Cancel Button (Less Prominent) */
.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane .tk_btn_cancel {
    background-color: transparent;
    color: #6c757d;
    border: 1px solid transparent;
}

.ui-dialog.ter_kal_ui_dialog .ui-dialog-buttonpane .tk_btn_cancel:hover {
    color: #000000;
    background-color: #dedede;
}

/* ------------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------------- */
/* --- only calendar backend + editable ------------------------------------------ */
/* ------------------------------------------------------------------------------- */
.event-dialog .show_preview,
.event-dialog .show_more,
.event-dialog .excluding-dates,
.event-dialog .exclude-add-date {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    line-height: 1rem;
    border: 1px solid #898989;
    cursor: pointer;
}

/* ---------------------------- */
.event-dialog .excluding-dates {
    border: 0;
    border-radius: 0.3rem;
    /*background: #F8F9FA;*/
    background: #ECEEF1;
}

.event-dialog .exclude-date {
    position: relative;
    cursor: pointer;
    margin-right: 5px;
    padding: 2px 5px;
    background: #f0f0f0;
    border-radius: 3px;
}

.event-dialog .exclude-date:hover {
    background: #e0e0e0;
}

.event-dialog .remove-date {
    margin-left: 3px;
    font-weight: bold;
    color: #d63638;
}

/* ---------------------------- */
.ter_kal_ui_dialog .custom-select {
    position: relative;
    font-family: Arial;
}

.ter_kal_ui_dialog .custom-select .select-selected {
    background-color: #eee;
    padding: 10px;
    cursor: pointer;
    border: 1px solid #ccc;
}

.ter_kal_ui_dialog .custom-select .select-selected:after {
    content: '';
    position: absolute;
    top: 14px;
    right: 10px;
    border: 6px solid transparent;
    border-color: black transparent transparent transparent;
}

.ter_kal_ui_dialog .custom-select .select-items {
    position: absolute;
    background-color: white;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    border: 1px solid #ccc;
    max-height: 200px;
    overflow-y: auto;
}

.ter_kal_ui_dialog .custom-select .select-items div {
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.ter_kal_ui_dialog .custom-select .select-items div:hover {
    background-color: #ddd;
}

.ter_kal_ui_dialog .custom-select .select-items div .dashicons {
    margin-right: 8px;
}

/* ---------------------------- */
/* Custom Styles for Notes Field */
.ter_kal_ui_dialog .event-notes {
    background: #fff3cd;
    border: 1px solid #ffecb5;
    padding: 0.5rem;
    border-radius: 0.25rem;
}

/* ---------------------------- */

.ter_kal_ui_dialog .show_allday {
    margin-left: 1rem;
}

.ter_kal_ui_dialog .show_allday input[type="checkbox"] {
    transform: scale(1.6);
    margin: 0.5rem;
}

/* ---------------------------- */
.ter_kal_ui_dialog .all_fields_inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ter_kal_ui_dialog .fields_inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ter_kal_ui_dialog .fields_inline label,
.ter_kal_ui_dialog .fields_inline input,
.ter_kal_ui_dialog .fields_inline select,
.ter_kal_ui_dialog .fields_inline span {
    margin: 0;
}

.ter_kal_ui_dialog .fields_inline input {
    width: 4rem;
}

.ter_kal_ui_dialog .fields_inline select {
    width: 10rem;
}

/* ---------------------------- */
.ter_kal_ui_dialog .category-form input[type='color'] {
    height: 40px;
}

/* ------------------------------------------------------------------------------- */

/* Responsive: WP admin bar is 46px on mobile (screens < 783px) */
/*@media screen and (max-width: 782px) {
    .ui-dialog {
        top: calc(46px + 20px) !important;
    }
}*/

/* Ensure dialog doesn't exceed viewport height */
/*.ui-dialog {
    max-height: calc(100vh - 32px - 40px) !important; /
    overflow: visible !important;
}*/

/*@media screen and (max-width: 782px) {
    .ui-dialog {
        max-height: calc(100vh - 46px - 40px) !important;
    }
}*/

/* Make content area scrollable if needed */
/*.ui-dialog-content {
    max-height: calc(100vh - 32px - 40px - 60px) !important;
    overflow-y: auto !important;
}*/

/*@media screen and (max-width: 782px) {
    .ui-dialog-content {
        max-height: calc(100vh - 46px - 40px - 60px) !important;
    }
}
*/


/* ------------------------------------------------------------------------------- */
/* Style for phones (small screens) */
@media screen and (max-width: 768px) {
    .ui-dialog.ter_kal_ui_dialog {
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        margin: 0;
    }
}

/* ------------------------------------------------------------------------------- */