/* Modal Dialog Styling */

/* Modal Content */
.modal-content {
    border-radius: 4px;
    border: 1.5px solid #e0e0e0;
    font-family: 'Poppins', Arial, Helvetica, sans-serif;
    width: 100%;
    font-size: 1em; /* Base content size */
}

.modal-dialog {
    max-width: 720px; /* Slightly wider to reduce right whitespace */
    margin: 20px auto; /* Reduced top margin */
}

/* Modal Header */
.modal-header {
    padding: 12px 20px 8px 20px; /* Reduced top and bottom padding */
    border-bottom: 2px solid #e9ecef;
    background-color: #f8f9fa;
}

.modal-title {
    font-size: 1em; /* Changed to 1em as requested */
    font-weight: 600;
    color: #495057;
    margin: 0;
    padding: 0;
}

/* Close button styling */
.btn-close {
    font-size: 0.85em;
    padding: 8px;
    opacity: 0.7;
}

.btn-close:hover {
    opacity: 1;
}

/* Modal Body */
.modal-body {
    padding: 12px 4px 0 8px;
    background-color: white;
    width: 100%;
    font-size: 12px; /* Content size */
    line-height: 1.3; /* Tighter line height */
    display: block; /* Ensure block layout for proper inline-block children */
}

/* Modal Body with panels - ensure side by side layout */
.modal-body.modalBody {
    white-space: nowrap; /* Prevent panels from wrapping */
}

.modal-body.modalBody .halfDialogPanel {
    white-space: normal; /* Restore normal text wrapping inside panels */
}

.modal-footer {
    background-color: #f8f9fa; /* Match header background */
    margin-top: 0px;
    padding-right: 8px;
    border: none;
    gap: 2px; /* Increased gap between buttons */
    justify-content: flex-end;
}

.modal-footer .btn {
    font-size: 12px; /* Bigger buttons */
    padding: 8px 20px; /* More horizontal padding */
    border-radius: 4px;
    font-weight: 500;
    min-width: 80px; /* Consistent button width */
}

.modal-footer .btn-primary-theme {
    background-color: #102b7c;
    border-color: #102b7c;
    color: white;
}

.modal-footer .btn-primary-theme:hover {
    background-color: #0d2464;
    border-color: #0d2464;
}

.modal-footer .btn:not(.btn-primary-theme) {
    background-color: white;
    color: #333;
    border: 1.5px solid #333;
}

.modal-footer .btn:not(.btn-primary-theme):hover {
    background-color: #f8f9fa;
}

/* Half Dialog Panels */
.halfDialogPanel {
    width: 49%; /* Slightly wider to use space better */
    display: inline-block;
    height: 90%;
    max-height: 450px; /* Reduced max height */
    margin-right: 8px; /* Reduced margin */
    vertical-align: top;
}

.halfDialogPanel h4 {
    font-size: 12px; /* Bigger heading */
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0; /* Reduced bottom margin */
    padding-bottom: 6px; /* Reduced padding */
    border-bottom: 1px solid #e0e0e0;
    width: 100%;
}

.halfDialogPanel h4 .dropdown {
    width: 100%;
}

.halfDialogPanel h4 .dropdown .dropdown-toggle {
    width: 100%;
}

.modal-body .dropdown-toggle,
.halfDialogPanel .dropdown-toggle {
    background-color: #102b7c;
    border-color: #102b7c;
    color: white;
    font-size: 12px; /* Bigger dropdown buttons */
    padding: 8px 12px; /* Increased padding for better proportion */
    border-radius: 4px;
    width: 100%;
    text-align: left;
    font-weight: 500;
}

/* Ensure dropdown menu matches button width */
.halfDialogPanel .dropdown-menu {
    min-width: 100%;
    width: 100%;
}

/* Ensure dropdown menus inside modals don't overflow the modal */
.modal .dropdown-menu,
.halfDialogPanel .dropdown-menu,
.modal-body .dropdown-menu {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    position: absolute !important;
    z-index: 1050;
}

/* Prevent dropdown from affecting modal layout */
.modal-body .dropdown,
.halfDialogPanel .dropdown {
    position: relative;
}

/* Ensure the dropdown doesn't expand the modal body */
.modal-body,
.halfDialogPanel .modal-content {
    overflow: visible;
}

.modal-body .dropdown-toggle:hover,
.halfDialogPanel .dropdown-toggle:hover {
    background-color: #0d2464;
    border-color: #0d2464;
}

.modal-body .dropdown-toggle:focus,
.halfDialogPanel .dropdown-toggle:focus {
    outline: none;
    box-shadow: none; /* Remove blue focus highlight */
    background-color: #102b7c;
    border-color: #102b7c;
}

/* Binder Frame */
.binderFrame {
    overflow: auto;
    max-height: 380px; /* Reduced height */
    min-height: 380px;
    border: 1.5px solid #e0e0e0;
    border-radius: 4px;
    background-color: white;
}

/* Binder List */
.binderList {
    font-size: 12px; /* Content size */
    min-height: 40px;
    border: none;
    padding: 6px; /* Reduced padding */
}

/* Binder Items */
.binderItem {
    margin: 1px 0; /* Reduced margin */
    padding: 6px 10px; /* Reduced padding */
    background-color: white;
    border: 1.5px solid #e0e0e0;
    border-radius: 4px;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 12px; /* Content size */
    color: #333;
    transition: all 0.2s ease;
    position: relative; 
    padding-right: 80px; /* Reduced to fit buttons better */
}

/* Binder Item Buttons */
.binderButton,
.binderHiddenButton {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    font-size: 12px; /* Smaller buttons */
    padding: 3px 5px; /* Reduced padding */
    margin: 0;
    border-radius: 4px;
    border: 1.5px solid #e0e0e0;
    background-color: white;
    color: #666;
    transition: opacity 0.2s ease, background-color 0.15s ease;
    z-index: 2;
}

.binderHiddenButton {
    right: 32px; /* Adjusted for smaller padding */
}

.binderButton {
    right: 6px; /* Adjusted for smaller padding */
}

.binderItem:hover .binderButton,
.binderItem:hover .binderHiddenButton {
    opacity: 1;
}

.binderPlaceholderClass {
    background-color: #f8f9fa;
    border: 2px dashed #102b7c;
    min-height: 32px;
    border-radius: 4px;
}

.binderHoverClass {
    border: 1.5px solid #102b7c;
    background-color: #f0f4ff;
}

.binderHiddenItem {
    opacity: 0.5;
    border: 1.5px solid #e0e0e0;
}

/* Group Items */
.binderGroupItem {
    font-weight: 600;
    background-color: #f8f9fa;
    border-color: #102b7c;
}

.modal-body .alert {
    border-radius: 4px;
    font-size: 12px; /* Content size */
}

.modal-body .alert-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

/* Custom Rename Form */
.binder-rename-form {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background-color: white;
    border: 1.5px solid #102b7c;
    border-radius: 4px;
    padding: 8px;
    z-index: 10;
    display: none;
}

.binder-rename-form.show {
    display: block;
}

.binder-rename-form input {
    width: 100%;
    padding: 6px 8px;
    border: 1.5px solid #e0e0e0;
    border-radius: 4px;
    font-size: 12px; /* Content size */
    margin-bottom: 8px;
    font-family: 'Poppins', Arial, Helvetica, sans-serif;
}

.binder-rename-form input:focus {
    outline: none;
    border-color: #102b7c;
}

/* Focus style for modal form controls: smaller subtle ring using navigation blue */
.modal-body .panelFrame .designerKVP .form-control:focus,
.modal-body .panelFrame .designerKVP input:focus,
.modal-body .panelFrame .designerKVP textarea:focus,
.modal-body .panelFrame .designerKVP select:focus {
    outline: none;
    border: 1.5px solid #102b7c;
    border-radius: 4px;
    box-shadow: none;
}

.binder-rename-form .form-buttons {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.binder-rename-form .btn {
    font-size: 12px; /* Smaller form buttons */
    padding: 4px 12px;
    border-radius: 4px;
    border: 1.5px solid;
    cursor: pointer;
    font-weight: 500;
}

.binder-rename-form .btn-save {
    background-color: #102b7c;
    border-color: #102b7c;
    color: white;
}

.binder-rename-form .btn-save:hover {
    background-color: #0d2464;
    border-color: #0d2464;
}

.binder-rename-form .btn-cancel {
    background-color: white;
    border-color: #333;
    color: #333;
}

.binder-rename-form .btn-cancel:hover {
    background-color: #f8f9fa;
}

.binderItem {
    position: relative;
}

/* Designer key/value rows inside modal panels (forms) */
.modal-body .panelFrame .designerKVP,
.modalBody .panelFrame .designerKVP {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

/* Allow radio lists in modal designer rows to wrap to additional lines */
.modal-body .panelFrame .designerKVP .radio-list,
.modalBody .panelFrame .designerKVP .radio-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    white-space: normal;
}

.modal-body .panelFrame .designerKVP label,
.modalBody .panelFrame .designerKVP label {
    flex: 0 0 150px;
    max-width: 150px;
    font-size: 12px; /* Content size */
    color: #333;
    margin: 0;
    padding: 0 4px 0 0;
    box-sizing: border-box;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-body .panelFrame .designerKVP .form-control,
.modalBody .panelFrame .designerKVP .form-control {
    flex: 1 1 auto;
    min-width: 250px;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 12px; /* Content size */
    padding: 6px 8px;
    height: 30px;
    border-radius: 4px;
}

.addView .PanelFrame {
    display: block;
    border-radius: 4px;
    padding: 8px;
    box-shadow: 0 6px 18px rgba(16, 43, 124, 0.08);
}

.designerKVP .editSizeTiny {
    width: 450px;
    gap: 8px;
}

/* Make modal panelFrame slightly tighter so inputs align nicely */
.modalBody .panelFrame {
    padding: 8px 20px 20px 20px;
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(16, 43, 124, 0.08);
}

.modal-body .panelFrame .designerKVP label {
    flex: 0 0 140px;
    max-width: 140px;
}

/* Slightly lighter labels for compact fields */
.modal-body .panelFrame .designerKVP label.smallLabel {
    font-weight: 500;
    font-size: 12px; /* Smaller labels */
}

/* Prevent long inputs from creating horizontal scroll inside modals */
.modal-body > .panelFrame,
.modal-body > .panelFrame * {
    max-width: 100%;
}

/* Filter Panel Layout Fixes */
.domFilterPanel {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 12px;
    background: white;
    border-bottom: 1px solid #e5e5e5;
    flex-wrap: wrap;
}

.domSlicerPanel {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.domFilterPanel .multiSlicer {
    margin: 0;
    padding: 0;
}

.domFilterPanel .filter {
    margin: 0;
    align-self: flex-start;
}

.domFilterPanel .filter table {
    margin: 0;
    border-collapse: collapse;
}

.domFilterPanel .filter td {
    padding: 0;
    vertical-align: top;
}

.domFilterPanel .filterButton,
.domFilterPanel .ui-filterButton {
    margin: 0;
    align-self: flex-start;
}

/* Ensure slicer and filter button are aligned horizontally */
.domFilterPanel > div {
    align-self: flex-start;
}

.domSetsPanel {
    align-self: flex-start;
}

/* Responsive: stack label above input on narrow viewports */
@media (max-width: 640px) {
    .modal-body .panelFrame .designerKVP,
    .modalBody .panelFrame .designerKVP {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-body .panelFrame .designerKVP label,
    .modalBody .panelFrame .designerKVP label {
        flex: 0 0 auto;
        max-width: none;
        padding-bottom: 6px;
    }
}
