/* Universal Box Sizing - Highly Recommended */
*,
*::before,
*::after {
    box-sizing: border-box;
}

.sas-search-form {
    width: 100%;
}

.sas-form-container {
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    /* overflow-x: hidden; */
    /* Keep this if you explicitly want to clip overflowing content horizontally */
}

@media (min-width: 640px) {
    .sas-form-container {
        padding: 2rem;
    }
}

/* Search Section */
.search-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 1rem;
}

.sas-grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .sas-grid-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .sas-form-group {
        width: 100%;
    }
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.sas-form-input {
    width: 100%;
    padding: 0.5rem 0.7rem !important;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    outline: none;
}

.sas-form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

@media (min-width: 640px) {
    .sas-form-input {
        font-size: 0.875rem;
    }
}

/* Custom styles for the select2-like appearance */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select2-container .select2-selection--multiple {
    min-height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background-color: #fff;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    padding: 0 !important;
    margin: 0;
    list-style: none !important;
    width: 100%;
    min-width: 0;
}

.select2-selection__choice {
    background-color: #e0e7ff;
    color: #4338ca;
    border-radius: 0.25rem;
    padding: 0.125rem 0.5rem;
    margin: 0.25rem;
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.select2-selection__choice__remove {
    margin-left: 0.25rem;
    color: #6366f1;
    cursor: pointer;
    font-weight: bold;
}

.select2-selection__choice__remove:hover {
    color: #4338ca;
}

/* Hide the default select element visually but keep it accessible */
.select2-offscreen {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.select2-search__field {
    border: none;
    outline: none;
    background: transparent;
    padding: 0;
    margin: 0.25rem;
    flex-grow: 1;
    min-width: 0;
}

.sas-consulting-option-val {
    white-space: normal;
    word-wrap: break-word;
    width: 100%;
    margin-left: 3px;
}

@media (max-width: 767px) {
    .select2-selection__choice {
        width: 100%;
    }
}

/* Style for the custom dropdown list (simulated) */
.custom-select-dropdown {
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: #fff;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 0.25rem;
    position: absolute;
    width: 100%;
    z-index: 10;
}

.custom-select-dropdown div {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.custom-select-dropdown div:hover {
    background-color: #f3f4f6;
}

.custom-select-dropdown div.selected {
    background-color: #3b82f6;
    color: white;
}

.hidden {
    display: none;
}

.search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    color: #ffffff;
    background-color: #643a6f;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    margin-top: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-button:hover {
    background-color: #4f3057;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.search-button:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #93c5fd;
}

.search-button svg {
    margin-right: 0.5rem;
    width: 1.25rem;
    height: 1.25rem;
    fill: currentColor;
}

/* Pagination */
.sas-pagination {
    display: flex;
    gap: .5rem;
    margin-bottom: 2rem;
}

.sas-pagination .sas-pgn-item {
    padding: .5rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: #555;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.sas-pagination .sas-pgn-item-active {
    background-color: #643a6f;
    color: #fff;
}

/* Results */
.sas-result-header {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .8rem;
}

/* Modal Styles */
.sas-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.sas-modal.active {
    display: flex;
}

.sas-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.sas-modal-content {
    position: relative;
    background-color: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 10000;
}

.sas-modal-header {
    position: sticky;
    top: 0;
    background-color: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
    border-radius: 0.75rem 0.75rem 0 0;
}

.sas-modal-close,
.sas-modal-print {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sas-modal-close:hover {
    background-color: #fee2e2;
}

.sas-modal-print {
    background-color: #643A6F;
    color: #fff;
}

.sas-modal-print:hover {
    background-color: #4f2d57;
}

.sas-modal-close svg {
    width: 1.5rem;
    height: 1.5rem;
    color: #ef4444;
}

.sas-modal-print svg {
    width: 1.25rem;
    height: 1.25rem;
    color: #fff;
}

.sas-modal-body {
    padding: 2rem 1.5rem;
    min-height: 200px;
}

.sas-modal-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.member-modal-card {
    background-color: #fff;
}

.member-modal-card h2 {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1rem;
    margin-top: 0;
}

.member-modal-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.member-modal-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .member-modal-info {
        flex-direction: row;
        gap: 2rem;
    }
}

.member-modal-left,
.member-modal-right {
    flex: 1;
}

.member-modal-field {
    margin-bottom: 1rem;
}

.member-modal-field:last-child {
    margin-bottom: 0;
}

.member-modal-field .info-label {
    font-weight: bold;
    color: #333;
    margin-bottom: 0.25rem;
    display: inline-block;
    margin-right: 0.25rem;
}

.member-modal-field .info-value {
    color: #555;
    display: inline;
}

.member-modal-field .info-value.email {
    color: #643A6F;
    text-decoration: none;
}

.member-modal-field .info-value.email:hover {
    text-decoration: underline;
}

.member-modal-services {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.member-modal-services .info-label {
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
    display: block;
}

.member-modal-services .info-value {
    color: #555;
    line-height: 1.6;
}

/* Print styles for modal */
@page {
    margin: 1cm;
    size: auto;
}

@media print {

    /* Hide everything except print container when printing */
    body.sas-printing-member>*:not(#sas-inline-print-container) {
        display: none !important;
    }

    body.sas-printing-member {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    body.sas-printing-member #sas-inline-print-container {
        display: block !important;
        position: static !important;
        width: 100% !important;
        background: white !important;
        padding: 30px !important;
    }

    body.sas-printing-member .member-modal-card {
        display: block !important;
        background: white !important;
        color: #000 !important;
        max-width: 100% !important;
    }

    body.sas-printing-member .member-modal-card h2 {
        display: block !important;
        font-size: 22pt !important;
        font-weight: bold !important;
        color: #000 !important;
        margin: 0 0 20px 0 !important;
        border-bottom: 2px solid #333 !important;
        padding-bottom: 10px !important;
    }

    body.sas-printing-member .member-modal-info {
        display: flex !important;
        flex-direction: row !important;
        gap: 40px !important;
        margin-bottom: 25px !important;
        page-break-inside: avoid !important;
    }

    body.sas-printing-member .member-modal-left,
    body.sas-printing-member .member-modal-right {
        display: block !important;
        flex: 1 !important;
    }

    body.sas-printing-member .member-modal-field {
        display: block !important;
        margin-bottom: 14px !important;
        color: #000 !important;
        line-height: 1.6 !important;
    }

    body.sas-printing-member .member-modal-field .info-label {
        display: inline !important;
        font-weight: bold !important;
        color: #000 !important;
        margin-right: 6px !important;
        font-size: 11pt !important;
    }

    body.sas-printing-member .member-modal-field .info-value {
        display: inline !important;
        color: #000 !important;
        font-size: 11pt !important;
    }

    body.sas-printing-member .member-modal-field .info-value.email {
        color: #0066cc !important;
        text-decoration: underline !important;
    }

    body.sas-printing-member .member-modal-field span,
    body.sas-printing-member .member-modal-field a {
        font-size: 11pt !important;
        line-height: 1.6 !important;
    }

    body.sas-printing-member .member-modal-services {
        display: block !important;
        border-top: 2px solid #333 !important;
        padding-top: 18px !important;
        margin-top: 25px !important;
    }

    body.sas-printing-member .member-modal-services .info-label {
        display: block !important;
        font-weight: bold !important;
        margin-bottom: 12px !important;
        color: #000 !important;
        font-size: 12pt !important;
    }

    body.sas-printing-member .member-modal-services .info-value {
        display: block !important;
        line-height: 1.8 !important;
        color: #000 !important;
        font-size: 11pt !important;
    }

    /* Hide loading spinner if present */
    body.sas-printing-member .sas-modal-loading {
        display: none !important;
    }
}