.fcpg-profile-gallery {
    box-sizing: border-box;
    width: 100%;
    margin: 22px 0;
    padding: 22px;
    border: 1px solid #e8ecf3;
    border-radius: 8px;
    background: #ffffff;
    color: #172033;
    box-shadow: 0 14px 38px rgba(17, 24, 39, 0.07);
    content-visibility: auto;
    contain-intrinsic-size: 420px;
}

.fcpg-hidden-by-portfolio {
    display: none !important;
}

.fcpg-portfolio-panel {
    direction: rtl;
}

.fcpg-portfolio-tab,
.fcpg-portfolio-tab-active {
    cursor: pointer;
}

.fcpg-portfolio-tab-active {
    background: #4ade80 !important;
    color: #ffffff !important;
    border-radius: 8px;
}

.fcpg-portfolio-panel[hidden] {
    display: none !important;
}

.fcpg-profile-gallery *,
.fcpg-profile-gallery *::before,
.fcpg-profile-gallery *::after {
    box-sizing: border-box;
}

.fcpg-gallery-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
}

.fcpg-gallery-heading h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 800;
    color: inherit;
}

.fcpg-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.fcpg-gallery-empty {
    margin: 0;
    color: #697386;
    font-size: 16px;
    line-height: 1.6;
}

.fcpg-portfolio-editor {
    direction: rtl;
}

.fcpg-editor-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.fcpg-editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.fcpg-editor-item {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 7px;
}

.fcpg-editor-preview {
    width: 100%;
}

.fcpg-editor-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fcpg-editor-title,
.fcpg-editor-description,
.fcpg-comment-textarea {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid #d8dee9;
    border-radius: 7px;
    background: #ffffff;
    color: #172033;
    font: inherit;
}

.fcpg-editor-title {
    min-height: 38px;
    padding: 8px 10px;
    font-weight: 700;
}

.fcpg-editor-description,
.fcpg-comment-textarea {
    min-height: 82px;
    padding: 9px 10px;
    resize: vertical;
}

.fcpg-editor-title:focus,
.fcpg-editor-description:focus,
.fcpg-comment-textarea:focus {
    outline: 3px solid rgba(34, 197, 94, 0.18);
    border-color: #22c55e;
}

.fcpg-editor-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #fecaca;
    border-radius: 7px;
    background: #fff5f5;
    color: #b91c1c;
    font-size: 14px;
    cursor: pointer;
}

.fcpg-editor-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.fcpg-editor-file {
    display: none;
}

.fcpg-editor-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    color: #172033;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.fcpg-editor-save {
    border-color: #22c55e;
    background: #22c55e;
    color: #ffffff;
}

.fcpg-editor-status {
    min-height: 22px;
    margin: 0;
    color: #15803d;
    font-size: 14px;
    line-height: 1.45;
}

.fcpg-editor-status-error {
    color: #b91c1c;
}

.fcpg-gallery-trigger {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    aspect-ratio: 1;
    border: 0;
    border-radius: 8px;
    background: #f1f5f9;
    cursor: zoom-in;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.fcpg-gallery-tile-title {
    position: absolute;
    right: 10px;
    bottom: 10px;
    left: 10px;
    display: block;
    overflow: hidden;
    padding: 7px 9px;
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.68);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fcpg-gallery-trigger:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 3px;
}

.fcpg-gallery-trigger img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 180ms ease, filter 180ms ease;
}

.fcpg-gallery-trigger:hover img {
    transform: scale(1.04);
    filter: saturate(1.06);
}

.fcpg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10, 15, 25, 0.82);
}

.fcpg-lightbox-dialog {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 18px;
    max-width: min(980px, 100%);
    max-height: 100%;
}

.fcpg-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 120px);
    border-radius: 8px;
    background: #101827;
    object-fit: contain;
}

.fcpg-lightbox-info {
    display: flex;
    min-height: 0;
    max-height: calc(100vh - 120px);
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    padding: 18px;
    border-radius: 8px;
    background: #ffffff;
    color: #172033;
    direction: rtl;
}

.fcpg-lightbox-title {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
}

.fcpg-lightbox-description,
.fcpg-lightbox-caption {
    margin: 0;
    color: #4b5563;
    font-size: 15px;
    line-height: 1.55;
    text-align: right;
}

.fcpg-lightbox-comments {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.fcpg-comments-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.fcpg-comment-item {
    padding: 10px;
    border-radius: 8px;
    background: #f8fafc;
}

.fcpg-comment-item strong {
    display: block;
    margin-bottom: 3px;
    font-size: 13px;
    color: #111827;
}

.fcpg-comment-item p,
.fcpg-comments-empty {
    margin: 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.45;
}

.fcpg-comment-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.fcpg-comment-submit {
    align-self: flex-start;
    min-height: 36px;
    padding: 7px 13px;
    border: 0;
    border-radius: 7px;
    background: #22c55e;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.fcpg-lightbox-close,
.fcpg-lightbox-nav {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #172033;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.fcpg-lightbox-close {
    top: -14px;
    right: -14px;
    width: 36px;
    height: 36px;
    font-size: 20px;
    line-height: 1;
}

.fcpg-lightbox-nav {
    top: 50%;
    width: 42px;
    height: 42px;
    font-size: 26px;
    transform: translateY(-50%);
}

.fcpg-lightbox-prev {
    left: -56px;
}

.fcpg-lightbox-next {
    right: -56px;
}

@media (max-width: 700px) {
    .fcpg-profile-gallery {
        padding: 14px;
    }

    .fcpg-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .fcpg-lightbox {
        padding: 14px;
    }

    .fcpg-lightbox-dialog {
        display: flex;
        width: 100%;
        max-height: calc(100vh - 28px);
        flex-direction: column;
        gap: 10px;
        overflow: auto;
    }

    .fcpg-lightbox-image,
    .fcpg-lightbox-info {
        max-height: none;
    }

    .fcpg-lightbox-nav {
        top: auto;
        bottom: -54px;
        transform: none;
    }

    .fcpg-lightbox-prev {
        left: calc(50% - 54px);
    }

    .fcpg-lightbox-next {
        right: calc(50% - 54px);
    }

    .fcpg-lightbox-caption {
        margin-right: 0;
        margin-left: 0;
    }
}
