/**
 * Marthoma Church Theme - Clergy Widget Styles
 *
 * @package MarthomaChurch
 */

/* ==========================================
   Widget Container
   ========================================== */
.marthoma-clergy-widget {
    position: relative;
    width: 100%;
}

/* ==========================================
   Filter Bar
   ========================================== */
.clergy-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    padding: 18px;
    background-color: #F4F3F8;
    margin-bottom: 30px;
}

/* Search Input */
.clergy-filter-search {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.clergy-search-input {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 22px;
    background-color: #FFFFFF;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    color: #04141E;
    outline: none;
    transition: box-shadow 0.2s ease;
}

.clergy-search-input::placeholder {
    color: #D9D9D9;
}

.clergy-search-input:focus {
    box-shadow: 0 0 0 2px rgba(55, 94, 251, 0.3);
}

/* Filter Dropdowns */
.clergy-filter-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 120px;
}

.clergy-filter-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    color: #04141E;
    cursor: pointer;
    padding-right: 20px;
    outline: none;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clergy-dropdown-icon {
    position: absolute;
    right: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
}

.clergy-dropdown-icon svg {
    width: 10px;
    height: 6px;
}

/* Reset Button */
.clergy-reset-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    color: #04141E;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.clergy-reset-btn:hover {
    color: #375EFB;
}

.clergy-reset-icon {
    display: flex;
    align-items: center;
}

.clergy-reset-icon svg {
    width: 14px;
    height: 14px;
}

/* ==========================================
   Clergy Grid - 4 columns
   ========================================== */
.clergy-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    transition: opacity 0.3s ease;
}

.clergy-grid-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ==========================================
   Clergy Card
   ========================================== */
.clergy-card {
    display: flex;
    flex-direction: column;
    background-color: #FFFFFF;
    border: 1.5px solid #E0E0E0;
    border-radius: 16px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.2s ease;
}

.clergy-card.clergy-card-visible {
    opacity: 1;
    transform: translateY(0);
}

.clergy-card:hover {
    border-color: #375EFB;
}

/* Clergy Photo */
.clergy-photo {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #F4F3F8;
}

.clergy-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.clergy-card:hover .clergy-photo img {
    transform: scale(1.05);
}

.clergy-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: #F4F3F8;
    color: #999;
}

.clergy-photo-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

/* Clergy Info */
.clergy-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    gap: 15px;
}

/* Clergy Name */
.clergy-name {
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: #072538;
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

/* Clergy Link Arrow */
.clergy-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    color: #04141E;
    text-decoration: none;
    transition: color 0.2s ease;
}

.clergy-link:hover {
    color: #375EFB;
}

.clergy-link svg {
    width: 12px;
    height: 12px;
}

/* ==========================================
   Pagination
   ========================================== */
.clergy-pagination {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
}

.clergy-pagination-line {
    flex: 1;
    height: 1px;
    background-color: #D0D5DD;
}

.clergy-load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: #072538;
    cursor: pointer;
    padding: 10px 0;
    transition: color 0.2s ease;
}

.clergy-load-more-btn:hover {
    color: #375EFB;
}

.clergy-load-more-arrow {
    display: flex;
    align-items: center;
}

.clergy-load-more-arrow svg {
    width: 9px;
    height: 9px;
}

/* ==========================================
   Loading Spinner
   ========================================== */
.clergy-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.clergy-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #E0E0E0;
    border-top-color: #375EFB;
    border-radius: 50%;
    animation: clergy-spin 0.8s linear infinite;
}

@keyframes clergy-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   No Results
   ========================================== */
.clergy-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

/* ==========================================
   Responsive Styles
   ========================================== */

/* Large Tablet / Small Desktop */
@media (max-width: 1200px) {
    .clergy-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .clergy-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .clergy-filter-bar {
        gap: 15px;
        padding: 14px;
    }

    .clergy-filter-search {
        min-width: 180px;
    }

    .clergy-info {
        padding: 15px;
    }

    .clergy-name {
        font-size: 15px;
    }
}

/* Small Tablet */
@media (max-width: 768px) {
    .clergy-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .clergy-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }

    .clergy-filter-search {
        max-width: none;
        width: 100%;
    }

    .clergy-filter-dropdown {
        width: 100%;
        max-width: none;
        padding: 10px 15px;
        background-color: #FFFFFF;
        border-radius: 8px;
    }

    .clergy-filter-select {
        width: 100%;
        font-size: 14px;
    }

    .clergy-reset-btn {
        justify-content: center;
        padding: 12px;
        background-color: #FFFFFF;
        border-radius: 8px;
    }

    .clergy-info {
        padding: 12px;
    }

    .clergy-name {
        font-size: 14px;
    }

    .clergy-pagination {
        margin-top: 30px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .clergy-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .clergy-info {
        padding: 10px;
    }

    .clergy-name {
        font-size: 13px;
    }

    .clergy-link {
        width: 28px;
        height: 28px;
    }

    .clergy-link svg {
        width: 10px;
        height: 10px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .clergy-card {
        opacity: 1;
        transform: none;
        transition: border-color 0.2s ease;
    }

    .clergy-photo img {
        transition: none;
    }

    .clergy-spinner {
        animation: none;
    }
}

/* ==========================================
   CLERGY MODAL STYLES
   ========================================== */

/* Make entire card clickable */
.clergy-card {
    cursor: pointer;
}

/* Arrow animation on card hover */
.clergy-card .clergy-link svg {
    transition: transform 0.3s ease;
}

.clergy-card:hover .clergy-link svg {
    transform: translate(2px, -2px);
}

/* Modal Trigger Button - styled like link */
button.clergy-modal-trigger {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

/* Modal Overlay */
.clergy-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(4, 20, 30, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

/* Modal Container */
.clergy-modal {
    position: relative;
    background-color: #F4F3F8;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 50px 60px;
    box-sizing: border-box;
    border-radius: 20px;
}

/* Modal Header */
.clergy-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.clergy-modal-title {
    font-family: var(--marthoma-font-heading, 'Montserrat', sans-serif);
    font-size: 35px;
    font-weight: 700;
    color: #04141E;
    margin: 0;
    line-height: 1.2;
    flex: 1;
    padding-right: 40px;
}

/* Modal Close Button */
.clergy-modal-close {
    position: absolute;
    top: 25px;
    right: 25px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #04141E;
    transition: color 0.3s ease, transform 0.2s ease;
    z-index: 10;
}

.clergy-modal-close:hover {
    color: #375EFB;
    transform: scale(1.05);
}

.clergy-modal-close:focus,
.clergy-modal-close:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.clergy-modal-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, #04141E 0%, transparent 100%);
    margin-bottom: 40px;
}

/* Modal Body - Two Column Layout */
.clergy-modal-body {
    display: flex;
    flex-direction: row;
    gap: 60px;
}

.clergy-modal-left {
    flex: 0 0 45%;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.clergy-modal-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Photo */
.clergy-modal-photo {
    width: 100%;
    max-width: 180px;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #F9A825;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clergy-modal-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.clergy-modal-photo svg {
    width: 60px;
    height: 60px;
    color: #fff;
    opacity: 0.7;
}

/* Details Table */
.clergy-modal-details-table {
    width: 100%;
    border-collapse: collapse;
}

.clergy-modal-details-table th,
.clergy-modal-details-table td {
    font-family: var(--marthoma-font-body, 'Inter', sans-serif);
    font-size: 14px;
    padding: 10px 0;
    text-align: left;
    vertical-align: top;
}

.clergy-modal-details-table th {
    font-weight: 400;
    color: #666;
    width: 45%;
    padding-right: 15px;
}

.clergy-modal-details-table td {
    font-weight: 500;
    color: #04141E;
}

.clergy-modal-details-table td::before {
    content: ': ';
    margin-right: 5px;
}

/* Establishment Tags */
.clergy-modal-establishment {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.clergy-est-tag {
    display: inline-block;
    padding: 4px 12px;
    background-color: #F4F3F8;
    color: #04141E;
    font-size: 13px;
    font-weight: 500;
    border-radius: 20px;
    line-height: 1.4;
}

/* Keep colon for establishment cell, align with flex layout */
.clergy-modal-row-establishment td::before {
    content: ': ';
    margin-right: 5px;
    flex-shrink: 0;
}

/* Modal Sections */
.clergy-modal-section {
    display: flex;
    flex-direction: column;
}

.clergy-modal-label {
    font-family: var(--marthoma-font-heading, 'Montserrat', sans-serif);
    font-size: 18px;
    font-weight: 700;
    color: #04141E;
    margin: 0 0 15px 0;
}

/* Address Section */
.clergy-modal-address {
    font-family: var(--marthoma-font-body, 'Inter', sans-serif);
    font-size: 16px;
    font-weight: 400;
    color: #04141E;
    line-height: 1.5;
    margin: 0 0 15px 0;
    white-space: pre-line;
}

.clergy-modal-directions-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--marthoma-font-body, 'Inter', sans-serif);
    font-size: 16px;
    font-weight: 700;
    color: #04141E;
    text-decoration: none;
    transition: color 0.3s ease;
}

.clergy-modal-directions-link:hover {
    color: #375EFB;
}

/* Contact Section */
.clergy-modal-contact-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.clergy-modal-contact-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
}

.clergy-modal-contact-item svg {
    flex-shrink: 0;
    color: #04141E;
}

.clergy-modal-contact-item a {
    font-family: var(--marthoma-font-body, 'Inter', sans-serif);
    font-size: 16px;
    font-weight: 400;
    color: #04141E;
    text-decoration: none;
    word-break: break-word;
}

.clergy-modal-contact-item a:hover {
    color: #375EFB;
}

.clergy-modal-contact-label {
    font-family: var(--marthoma-font-body, 'Inter', sans-serif);
    font-size: 14px;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
    min-width: 70px;
}

/* Body scroll lock */
body.clergy-modal-open {
    overflow: hidden;
}

/* Modal Animation */
.clergy-modal-overlay.clergy-modal-active {
    animation: clergyModalFadeIn 0.3s ease-out forwards;
}

.clergy-modal-overlay.clergy-modal-closing {
    animation: clergyModalFadeOut 0.2s ease-in forwards;
}

@keyframes clergyModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes clergyModalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.clergy-modal-overlay.clergy-modal-active .clergy-modal {
    animation: clergyModalSlideIn 0.3s ease-out forwards;
}

@keyframes clergyModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   CLERGY MODAL RESPONSIVE STYLES
   ========================================== */

/* Tablet */
@media (max-width: 1024px) {
    .clergy-modal {
        padding: 40px 35px;
    }

    .clergy-modal-title {
        font-size: 26px;
    }

    .clergy-modal-body {
        gap: 40px;
    }

    .clergy-modal-left {
        flex: 0 0 40%;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .clergy-modal {
        padding: 30px 25px;
        max-height: 85vh;
    }

    .clergy-modal-close {
        top: 15px;
        right: 15px;
    }

    .clergy-modal-title {
        font-size: 21px;
        padding-right: 30px;
    }

    .clergy-modal-body {
        flex-direction: column;
        gap: 30px;
    }

    .clergy-modal-left {
        flex: 1;
        flex-direction: row;
        gap: 20px;
        align-items: flex-start;
    }

    .clergy-modal-photo {
        max-width: 120px;
        flex-shrink: 0;
    }

    .clergy-modal-details-table {
        flex: 1;
    }

    .clergy-modal-details-table th,
    .clergy-modal-details-table td {
        font-size: 13px;
        padding: 6px 0;
    }

    .clergy-modal-label {
        font-size: 17px;
    }

    .clergy-modal-address,
    .clergy-modal-contact-item a,
    .clergy-modal-directions-link {
        font-size: 14px;
    }
}

/* Very Small Mobile */
@media (max-width: 480px) {
    .clergy-modal-left {
        flex-direction: column;
    }

    .clergy-modal-photo {
        max-width: 100px;
    }
}

/* Reduced Motion for Modal */
@media (prefers-reduced-motion: reduce) {
    .clergy-modal-overlay.clergy-modal-active,
    .clergy-modal-overlay.clergy-modal-closing,
    .clergy-modal-overlay.clergy-modal-active .clergy-modal {
        animation: none;
    }
}

/* Hide modal in Elementor editor */
.elementor-editor-active .clergy-modal-overlay {
    display: none !important;
}
