.mepf-projects-grid {
    display: grid;
    grid-template-columns: repeat(var(--mepf-grid-columns, 3), minmax(0, 1fr));
    gap: 28px;
    width: 100%;
}

.mepf-project-card {
    width: 100%;
}

.mepf-flip-link {
    display: block;
    text-decoration: none !important;
}

.mepf-flip-box {
    position: relative;
    width: 100%;
    height: 270px;
    perspective: 1200px;
    overflow: hidden;
}

.mepf-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s ease;
    transform-style: preserve-3d;
}

.mepf-flip-box:hover .mepf-flip-inner,
.mepf-flip-link:focus .mepf-flip-inner {
    transform: rotateY(180deg);
}

.mepf-flip-side {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    border-radius: 0;
    background: #f2f2f2;
}

.mepf-flip-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mepf-flip-back {
    transform: rotateY(180deg);
}

.mepf-card-content {
    padding: 14px 0 0;
    text-align: left;
}

.mepf-card-title {
    margin: 0 0 5px;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 700;
}

.mepf-card-title a {
    color: inherit;
    text-decoration: none !important;
}

.mepf-card-location {
    font-size: 15px;
    line-height: 1.4;
    opacity: 0.75;
}

.mepf-project-single {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr);
    column-gap: var(--mepf-column-gap, 32px);
    width: 100%;
    height: var(--mepf-section-height, 760px);
    min-height: 520px;
    overflow: hidden;
    background: #ffffff;
}

.mepf-project-col {
    min-width: 0;
    height: 100%;
}

.mepf-project-info-col {
    overflow-y: auto;
    padding: 34px 28px;
}

.mepf-project-text-col {
    overflow-y: auto;
    padding: 34px 28px;
    border-left: 1px solid rgba(0,0,0,0.06);
}

.mepf-project-gallery-col {
    position: relative;
    background: #f7f7f7;
    overflow: hidden;
}

.mepf-project-details-box {
    color: #2e3437;
    font-family: inherit;
}

.mepf-detail-group {
    margin-bottom: 29px;
}

.mepf-detail-label {
    font-size: 13px;
    line-height: 1.4;
    letter-spacing: -0.02em;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.mepf-detail-value {
    font-size: 16px;
    line-height: 1.55;
    font-weight: 700;
}

.mepf-project-description-list {
    margin: 8px 0 0 0;
    padding-left: 18px;
}

.mepf-project-description-list li {
    margin: 0 0 4px;
    font-size: 16px;
    line-height: 1.45;
    font-weight: 700;
}

.mepf-project-rich-text {
    font-size: 16px;
    line-height: 1.75;
    color: #2e3437;
}

.mepf-project-rich-text p:first-child {
    margin-top: 0;
}

.mepf-gallery-scroll {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    gap: var(--mepf-image-gap, 5px);
    overflow-x: hidden;
    overflow-y: hidden;
    scroll-behavior: smooth;
    outline: none;
    overscroll-behavior: contain;
    scrollbar-width: none;
}

.mepf-gallery-scroll::-webkit-scrollbar {
    display: none;
}

.mepf-gallery-panel {
    flex: 0 0 auto;
    width: auto;
    height: 100%;
    overflow: hidden;
    background: transparent;
}

.mepf-gallery-panel-error {
    display: none;
}

.mepf-gallery-panel img {
    width: auto;
    height: 100%;
    max-width: none;
    object-fit: contain;
    display: block;
}

.mepf-gallery-empty {
    display: block;
    height: 100%;
    padding: 0;
    text-align: center;
    color: transparent;
}

.mepf-single-project-page {
    width: 100%;
}


.mepf-project-info-col img,
.mepf-project-text-col img {
    max-width: 100%;
}

.mepf-project-gallery-col .mepf-gallery-panel img {
    max-width: none !important;
}

.elementor-widget-mepf_project_detail,
.elementor-widget-mepf_project_detail .elementor-widget-container {
    width: 100%;
}


@media (max-width: 1024px) {
    .mepf-projects-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mepf-project-single {
        grid-template-columns: 1fr;
        row-gap: var(--mepf-column-gap, 32px);
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .mepf-project-info-col,
    .mepf-project-text-col,
    .mepf-project-gallery-col {
        height: auto;
    }

    .mepf-project-text-col {
        border-left: 0;
        border-top: 1px solid rgba(0,0,0,0.06);
    }

    .mepf-project-gallery-col,
    .mepf-gallery-scroll,
    .mepf-gallery-panel {
        height: 520px;
    }

    .mepf-gallery-panel img {
        height: 100%;
        width: auto;
        max-width: none;
    }
}

@media (max-width: 640px) {
    .mepf-projects-grid {
        grid-template-columns: 1fr;
    }

    .mepf-flip-box {
        height: 230px;
    }

    .mepf-project-info-col,
    .mepf-project-text-col {
        padding: 24px 18px;
    }

    .mepf-project-gallery-col,
    .mepf-gallery-scroll,
    .mepf-gallery-panel {
        height: 420px;
    }

    .mepf-gallery-panel img {
        height: 100%;
        width: auto;
        max-width: none;
    }
}

/* MEPF Add Project Form */
.mepf-frontend-form-shell,
.mepf-project-form {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    box-sizing: border-box;
}

.mepf-form-main-title {
    margin: 0 0 22px;
    font-size: clamp(26px, 3vw, 42px);
    line-height: 1.15;
    font-weight: 800;
}

.mepf-project-form *,
.mepf-project-form *::before,
.mepf-project-form *::after {
    box-sizing: border-box;
}

.mepf-form-card {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    padding: 26px;
    margin: 0 0 22px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.05);
}

.mepf-form-section-head {
    margin-bottom: 22px;
}

.mepf-form-section-head h3 {
    margin: 0 0 7px;
    font-size: 22px;
    line-height: 1.25;
    font-weight: 800;
}

.mepf-form-section-head p {
    margin: 0;
    color: rgba(0, 0, 0, 0.62);
    font-size: 15px;
    line-height: 1.6;
}

.mepf-form-grid {
    display: grid;
    gap: 18px;
}

.mepf-form-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mepf-form-field label {
    display: block;
    margin: 0 0 8px;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.35;
    color: #202427;
}

.mepf-form-field label span {
    color: #c62828;
}

.mepf-form-field input[type="text"],
.mepf-form-field input[type="url"],
.mepf-form-field input[type="email"],
.mepf-form-field input[type="number"],
.mepf-form-field select,
.mepf-form-field textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    color: #1f2428;
    font-size: 15px;
    line-height: 1.45;
    outline: none;
    box-shadow: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mepf-form-field input[type="file"] {
    width: 100%;
    min-height: 46px;
    border: 1px dashed rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
}

.mepf-form-field textarea {
    min-height: 150px;
    resize: vertical;
}

.mepf-form-field input:focus,
.mepf-form-field select:focus,
.mepf-form-field textarea:focus {
    border-color: rgba(0, 0, 0, 0.45);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
}

.mepf-form-field small {
    display: block;
    margin-top: 7px;
    color: rgba(0, 0, 0, 0.58);
    font-size: 12px;
    line-height: 1.45;
}

.mepf-form-preview {
    min-height: 120px;
    border: 1px dashed rgba(0, 0, 0, 0.18);
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.025);
}

.mepf-form-preview:empty::before {
    content: "No image selected";
    color: rgba(0, 0, 0, 0.45);
    font-size: 13px;
}

.mepf-form-preview img {
    max-width: 100%;
    max-height: 180px;
    width: auto;
    height: auto;
    display: block;
}

.mepf-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.mepf-submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    border: 0;
    border-radius: 999px;
    padding: 14px 30px;
    background: #111;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.mepf-submit-button:hover,
.mepf-submit-button:focus {
    color: #fff;
    opacity: 0.88;
    transform: translateY(-1px);
}

.mepf-alert {
    border-radius: 14px;
    padding: 14px 16px;
    margin: 0 0 20px;
    font-weight: 700;
    line-height: 1.5;
}

.mepf-alert-success {
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.mepf-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

@media (max-width: 782px) {
    .mepf-form-card {
        border-radius: 14px;
        padding: 20px;
    }

    .mepf-form-grid-2 {
        grid-template-columns: 1fr;
    }

    .mepf-form-actions {
        justify-content: stretch;
    }

    .mepf-submit-button {
        width: 100%;
    }
}

.mepf-new-project-type-field {
    transition: all 0.2s ease;
}

.mepf-import-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mepf-import-columns code {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.06);
    color: #1f2428;
    font-size: 12px;
    line-height: 1;
}

.mepf-gallery-fallback-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.mepf-gallery-folder-fallback {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

@media (max-width: 1024px) {
    .mepf-gallery-folder-fallback,
    .mepf-gallery-fallback-frame {
        height: 520px;
    }
}

@media (max-width: 640px) {
    .mepf-gallery-folder-fallback,
    .mepf-gallery-fallback-frame {
        height: 420px;
    }
}
