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

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

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

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

.parishes-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;
}

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

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

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

.parishes-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;
}

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

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

/* Reset Button */
.parishes-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;
}

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

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

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

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

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

/* ==========================================
   Parish Card
   ========================================== */
.parish-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px 25px;
    background-color: #FFFFFF;
    border: 1.5px solid #E0E0E0;
    border-radius: 16px;
    min-height: 160px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.2s ease;
}

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

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

/* Parish Title */
.parish-title {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: #072538;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

/* Parish Links */
.parish-links {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.parish-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: #04141E;
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.parish-link-icon {
    display: flex;
    align-items: center;
}

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

.parish-separator {
    width: 1px;
    height: 20px;
    background-color: #D0D5DD;
}

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

.parishes-pagination-top {
    margin-top: 0;
    margin-bottom: 30px;
}

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

.parishes-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;
}

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

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

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

/* ==========================================
   Loading Spinner
   ========================================== */
.parishes-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;
}

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

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

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

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

/* Large Tablet (1024px and below) */
@media (max-width: 1024px) {
    .parishes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

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

    .parishes-filter-search {
        min-width: 180px;
        max-width: 300px;
    }

    .parishes-search-input {
        padding: 10px 16px;
        font-size: 15px;
    }

    .parishes-filter-select {
        font-size: 15px;
    }

    .parishes-reset-btn {
        font-size: 15px;
    }

    .parish-card {
        padding: 25px 20px;
        min-height: 140px;
    }

    .parish-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .parish-link {
        font-size: 15px;
    }

    .parishes-load-more-btn {
        font-size: 15px;
    }
}

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

    .parishes-filter-bar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px;
        margin-bottom: 20px;
    }

    .parishes-filter-search {
        flex: 1 1 100%;
        max-width: none;
        min-width: unset;
        order: 1;
    }

    .parishes-search-input {
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 20px;
    }

    /* Filter dropdowns in a row */
    .parishes-filter-dropdowns {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        flex: 1 1 100%;
        order: 2;
    }

    .parishes-filter-dropdown {
        flex: 1;
        min-width: 0;
        max-width: none;
        padding: 10px 12px;
        background-color: #FFFFFF;
        border-radius: 8px;
    }

    .parishes-filter-select {
        font-size: 14px;
        padding-right: 18px;
    }

    .parishes-reset-btn {
        flex: 0 0 auto;
        padding: 10px 12px;
        background-color: #FFFFFF;
        border-radius: 8px;
        font-size: 14px;
        order: 3;
    }

    .parish-card {
        padding: 20px 16px;
        min-height: 130px;
        border-radius: 12px;
    }

    .parish-title {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .parish-links {
        gap: 12px;
    }

    .parish-link {
        font-size: 14px;
        gap: 4px;
    }

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

    .parish-separator {
        height: 16px;
    }

    .parishes-pagination {
        margin-top: 25px;
        gap: 15px;
    }

    .parishes-load-more-btn {
        font-size: 14px;
    }

    .parishes-no-results {
        padding: 40px 15px;
        font-size: 14px;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    .parishes-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .parishes-filter-bar {
        gap: 8px;
        padding: 10px;
        margin-bottom: 15px;
    }

    .parishes-search-input {
        padding: 10px 12px;
        font-size: 14px;
    }

    .parishes-filter-dropdown {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
        padding: 8px 10px;
    }

    .parishes-filter-select {
        font-size: 13px;
        padding-right: 16px;
    }

    .parishes-dropdown-icon svg {
        width: 8px;
        height: 5px;
    }

    .parishes-reset-btn {
        flex: 1 1 100%;
        justify-content: center;
        padding: 10px;
        font-size: 13px;
    }

    .parishes-reset-icon svg {
        width: 12px;
        height: 12px;
    }

    .parish-card {
        padding: 16px 14px;
        min-height: auto;
        border-radius: 10px;
    }

    .parish-title {
        font-size: 14px;
        margin-bottom: 8px;
        line-height: 1.4;
    }

    .parish-links {
        gap: 10px;
    }

    .parish-link {
        font-size: 13px;
    }

    .parish-link-icon svg {
        width: 9px;
        height: 9px;
    }

    .parish-separator {
        height: 14px;
    }

    .parishes-pagination {
        margin-top: 20px;
        gap: 12px;
    }

    .parishes-load-more-btn {
        font-size: 13px;
        gap: 8px;
    }

    .parishes-load-more-arrow svg {
        width: 8px;
        height: 8px;
    }

    .parishes-no-results {
        padding: 30px 10px;
        font-size: 13px;
    }

    .parishes-spinner {
        width: 32px;
        height: 32px;
        border-width: 2px;
    }
}

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

    .parishes-spinner {
        animation: none;
    }
}

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

/* Modal Trigger Button - styled like a link */
button.parish-modal-trigger {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

/* Modal Overlay */
.parish-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 */
.parish-modal {
    position: relative;
    background-color: #F4F3F8;
    max-width: 850px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 50px 60px;
    box-sizing: border-box;
    border-radius: 20px;
}

/* Modal Close Button */
.parish-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;
}

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

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

.parish-modal-close svg {
    display: block;
    width: 28px;
    height: 28px;
}

/* Modal Header */
.parish-modal-header {
    margin-bottom: 40px;
}

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

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

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

.parish-modal-left {
    flex: 0 0 35%;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.parish-modal-right {
    flex: 1;
}

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

.parish-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 */
.parish-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;
}

.parish-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;
}

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

.parish-modal-directions-link svg {
    width: 10px;
    height: auto;
}

/* Vicar Section */
.parish-modal-vicar-photo {
    width: 100px;
    height: 110px;
    overflow: hidden;
    margin-bottom: 14px;
}

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

.parish-modal-vicar-name {
    font-family: var(--marthoma-font-body, 'Inter', sans-serif);
    font-size: 16px;
    font-weight: 400;
    color: #04141E;
    line-height: 1.5;
    margin: 0;
}

/* Assistant Vicar Section */
.parish-modal-asst-vicar-photo {
    width: 100px;
    height: 110px;
    overflow: hidden;
    margin-bottom: 14px;
}

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

.parish-modal-asst-vicar-name {
    font-family: var(--marthoma-font-body, 'Inter', sans-serif);
    font-size: 16px;
    font-weight: 400;
    color: #04141E;
    line-height: 1.5;
    margin: 0;
}

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

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

.parish-modal-contact-item svg {
    flex-shrink: 0;
    margin-top: 3px;
    color: #04141E;
}

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

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

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

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

.parish-modal-overlay.parish-modal-closing {
    animation: parishModalFadeOut 0.2s ease-in forwards;
}

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

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

.parish-modal-overlay.parish-modal-active .parish-modal {
    animation: parishModalSlideIn 0.3s ease-out forwards;
}

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

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

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

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

    .parish-modal-body {
        gap: 50px;
    }

    .parish-modal-label {
        font-size: 16px;
    }

    .parish-modal-address,
    .parish-modal-vicar-name,
    .parish-modal-asst-vicar-name,
    .parish-modal-contact-item a,
    .parish-modal-contact-item span,
    .parish-modal-directions-link {
        font-size: 15px;
    }
}

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

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

    .parish-modal-header {
        margin-bottom: 30px;
    }

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

    .parish-modal-body {
        flex-direction: column;
        gap: 35px;
    }

    .parish-modal-left {
        flex: 1;
        gap: 30px;
    }

    .parish-modal-label {
        font-size: 17px;
        margin-bottom: 14px;
    }

    .parish-modal-address,
    .parish-modal-vicar-name,
    .parish-modal-asst-vicar-name,
    .parish-modal-contact-item a,
    .parish-modal-contact-item span,
    .parish-modal-directions-link {
        font-size: 14px;
    }

    .parish-modal-contact-list {
        gap: 13px;
    }

    .parish-modal-contact-item {
        gap: 12px;
    }
}

/* ==========================================
   MODAL REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .parish-modal-overlay.parish-modal-active,
    .parish-modal-overlay.parish-modal-closing,
    .parish-modal-overlay.parish-modal-active .parish-modal {
        animation: none;
    }
}

/* ==========================================
   ELEMENTOR EDITOR
   ========================================== */

.elementor-editor-active .marthoma-parishes-widget {
    min-height: 150px;
}

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