.ambassador-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 24px;
}
.ambassador-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
    border-color: #99cc33;
}
#content a:link, #content a:visited {
    text-decoration: none;
}
.card-image-wrapper {
    position: relative;
    height: 220px;
    width: 100%;
    overflow: hidden;
}
.card-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: top !important;
    display: block;
    transition: transform 0.5s ease;
}
.ambassador-card:hover .card-image-wrapper img {
    transform: scale(1.1);
}
.avatar-placeholder {
    height: 220px;
    background: linear-gradient(135deg, #99cc33 0%, #09989a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3em;
    font-weight: bold;
}
.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}
.card-country {
    position: absolute;
    bottom: 10px;
    left: 12px;
    color: white;
    font-size: 0.85em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.card-body-custom {
    padding: 16px;
}
.card-body-custom h5 {
    color: #1a1a1a;
    font-weight: 700;
    font-size: 1.1em;
    margin-bottom: 4px;
    transition: color 0.2s;
}
.ambassador-card:hover .card-body-custom h5 {
    color: #99cc33;
}
.card-institution {
    color: #6b7280;
    font-size: 0.85em;
    margin-bottom: 12px;
}
.expertise-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.expertise-tag {
    background: #f3f4f6;
    color: #4b5563;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 500;
}
.filter-section {
    background: #f9fafb;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}
.filter-section label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.form-control-custom {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.9em;
}
.form-control-custom:focus {
    border-color: #99cc33;
    outline: none;
    box-shadow: 0 0 0 3px rgba(153, 204, 51, 0.1);
}
.modal-custom .modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}
.modal-custom .modal-header {
    border: none;
    padding: 0;
    position: relative;
}
.modal-photo-wrapper {
    position: relative;
    height: 450px;
    overflow: hidden;
    border-radius: 12px;
}
.modal-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
}
.modal-avatar {
    height: 450px;
    background: linear-gradient(135deg, #99cc33 0%, #09989a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 5em;
    font-weight: bold;
    border-radius: 12px;
}
.modal-name {
    color: #09989a;
    font-size: 1.8em;
    font-weight: 700;
    margin: 0 0 8px 0;
}
.modal-university {
    color: #6b7280;
    font-size: 1.1em;
    margin: 0 0 16px 0;
}
.modal-custom .modal-body {
    padding: 32px;
}
.modal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.modal-badge {
    background: #e8f5d9;
    color: #5a7f2e;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}
.modal-section-title {
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
    font-size: 1.1em;
}
.modal-bio {
    color: #4b5563;
    line-height: 1.7;
    margin-bottom: 24px;
}
.contact-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.contact-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #dcdcdc;
    border-radius: 20px;
    padding: 2px 12px;
    text-decoration: none;
    transition: background .2s ease;
}
.contact-card:hover {
    background: #e8f5d9;
}
.contact-card-label {
    font-size: 0.7em;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
}
.contact-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    color: #3f3c3c;
    font-size: 41px;
    flex-shrink: 0;
    background: transparent;
}
.contact-card-value {
    color: #3f3c3c;
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: .02em;
}
.contact-card:hover .contact-card-value {
    color: #5a7f2e;
}
.contact-card:hover .contact-card-icon {
    color: #5a7f2e;
}
#content img {
    margin: 0px 0px;
}
.modal-custom .close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    opacity: 1;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 1.5em;
    line-height: 1;
}
.modal-custom .close:hover {
    background: white;
}
.modal-orcid {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 18px;
}
.orcid-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #a6ce39;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    font-style: italic;
    flex-shrink: 0;
}
.modal-orcid a {
    color: #555;
    font-size: 1.05rem;
    font-weight: 500;
    text-decoration: none;
    letter-spacing: .03em;
}
.modal-orcid a:hover {
    color: #a6ce39;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.ambassador-tile {
    animation: fadeInUp 0.5s ease-out both;
}
.ambassador-tile:nth-child(1) { animation-delay: 0.05s; }
.ambassador-tile:nth-child(2) { animation-delay: 0.1s; }
.ambassador-tile:nth-child(3) { animation-delay: 0.15s; }
.ambassador-tile:nth-child(4) { animation-delay: 0.2s; }
.ambassador-tile:nth-child(5) { animation-delay: 0.25s; }
.empty-state {
    text-align: center;
    padding: 60px 20px;
    display: none;
}
.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    color: #9ca3af;
}
.empty-state h3 {
    color: #1a1a1a;
    font-weight: 600;
    margin-bottom: 8px;
}
.empty-state p {
    color: #6b7280;
}
.result-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
}
.result-count {
    color: #6b7280;
    font-size: 0.9em;
}
.result-count span {
    color: #1a1a1a;
    font-weight: 600;
}

/* ——— Grid alignment fix ——— */

#ambassadorsContainer {
    display: flex;
    flex-wrap: wrap;
}
#ambassadorsContainer::before,
#ambassadorsContainer::after {
    display: none;
}
#ambassadorsContainer > .ambassador-tile {
    float: none;
    display: flex;
    width: 100%;
}

@media (min-width: 992px) {
    #ambassadorsContainer > .ambassador-tile { width: 33.333333%; }
}
@media (min-width: 1200px) {
    #ambassadorsContainer > .ambassador-tile { width: 25%; }
}
.ambassador-card {
    width: 100%;
    display: flex;
    flex-direction: column;
}
.card-institution {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.9em;
}

/* ——— Grid cards: photo on the right whenever the columns stack (below 992px) ——— */

@media (max-width: 991px) {
    .ambassador-card {
        flex-direction: row-reverse;
    }
    .ambassador-card .card-image-wrapper {
        flex: 0 0 34%;
        max-width: 170px;
        height: 220px;
    }
    .ambassador-card .avatar-placeholder {
        height: 100%;
        font-size: 2em;
    }
    .ambassador-card .card-body-custom {
        flex: 1 1 auto;
        min-width: 0;
    }
}

/* ——— Modal: photo on the right whenever the columns stack (below 992px) ——— */

@media (max-width: 991px) {
    .modal-custom .modal-body .row {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .modal-custom .modal-body .row::before,
    .modal-custom .modal-body .row::after {
        display: none;
    }
    /* let the text column's children become flex items of the row */
    .modal-custom .modal-body .col-md-7 {
        display: contents;
    }
    .modal-custom .modal-body .modal-head {
    order: 2;                /* was 1 */
    flex: 1 1 0;
    min-width: 0;
    }
    .modal-custom .modal-body .modal-col-photo {
	    order: 1;                /* was 2 */
	    float: none;
	    flex: 0 0 34%;
	    max-width: 34%;
	    margin-right: 16px;      /* was margin-left */
	    margin-left: 0;
	    margin-bottom: 0;
	    padding-left: 0;
	    padding-right: 0;
    }
    .modal-custom .modal-body .modal-bio-block {
        order: 3;
        flex: 0 0 100%;
        max-width: 100%;
        margin-top: 14px;
    }
    .modal-custom .modal-body .contact-cards {
        order: 4;
        flex: 0 0 100%;
        max-width: 100%;
    }
    .modal-photo-wrapper {
        height: 0;
        padding-top: 130%;   /* 3:4 */
        position: relative;
    }
    .modal-photo-wrapper img,
    .modal-photo-wrapper .avatar-placeholder {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
    .modal-avatar {
        font-size: 2.2em;
    }
}