.posimage-gallery-widget {
    width: 100%;
    margin: 2rem 0;
}

.posimage-gallery-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 600;
}

.posimage-upload-section {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 4rem;
    text-align: center;
}

.posimage-upload-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.6rem;
    font-weight: 600;
    color: #333;
}

.posimage-upload-header p {
    margin: 0 0 1rem 0;
    color: #666;
    font-size: 1.2rem;
}

.posimage-upload-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.posimage-upload-field {
    width: 100%;
    max-width: 400px;
}

.posimage-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #fff;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.posimage-upload-label:hover {
    border-color: #f97316;
    background: #fff7ed;
}

.posimage-upload-icon {
    font-size: 2.5rem;
    color: #f97316;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.posimage-upload-text {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.posimage-upload-hint {
    font-size: 1.2rem;
    color: #888;
}

.posimage-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.posimage-upload-button {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.posimage-selected-files {
    margin-top: 1rem;
    font-size: 1.2rem;
    color: #28a745;
    font-weight: 500;
}

.posimage-upload-label.has-files {
    border-color: #28a745;
    background: #f0fff4;
}

.posimage-upload-section .posimage-upload-note {
    margin: 1rem 0 0 0;
    padding: 0;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #888;
}

.posimage-gallery-grid {
    column-count: 4;
    column-gap: 15px;
    padding: 0;
}

.posimage-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    background: #f5f5f5;
    line-height: 0;
    font-size: 0;
    break-inside: avoid;
    margin-bottom: 15px;
}

.posimage-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.posimage-gallery-link {
    display: block;
    position: relative;
    text-decoration: none;
    line-height: 0;
}

.posimage-gallery-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
    vertical-align: bottom;
}

.posimage-gallery-item:hover .posimage-gallery-image {
    transform: scale(1.05);
}

.posimage-gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    line-height: normal;
}

.posimage-gallery-item:hover .posimage-gallery-overlay {
    opacity: 1;
}

/* Lightbox Modal */
.posimage-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.posimage-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.posimage-lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.posimage-lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.posimage-lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 3rem;
    color: #ffffff;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10001;
    padding: 0;
    line-height: 1;
    transition: opacity 0.3s ease;
}

.posimage-lightbox-close:hover {
    opacity: 0.7;
}

.posimage-lightbox-info {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10001;
}

.posimage-lightbox-prev,
.posimage-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    cursor: pointer;
    padding: 1rem 1.5rem;
    z-index: 10001;
    transition: background 0.3s ease;
}

.posimage-lightbox-prev:hover,
.posimage-lightbox-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

.posimage-lightbox-prev {
    left: 20px;
}

.posimage-lightbox-next {
    right: 20px;
}

.posimage-gallery-empty {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
}

.posimage-load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.posimage-load-more-button {
    padding: 1rem 3rem;
    font-size: 1.4rem;
    min-width: 200px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.posimage-load-more-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.posimage-load-more-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.posimage-load-more-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: posimage-spin 0.8s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 1200px) {
    .posimage-gallery-grid {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    .posimage-upload-section {
        padding: 1.5rem;
    }

    .posimage-upload-label {
        padding: 1.5rem;
    }

    .posimage-gallery-grid {
        column-count: 2;
        column-gap: 10px;
    }

    .posimage-gallery-item {
        margin-bottom: 10px;
    }

    .posimage-gallery-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .posimage-lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 2.5rem;
    }

    .posimage-lightbox-prev,
    .posimage-lightbox-next {
        font-size: 2rem;
        padding: 0.5rem 1rem;
    }

    .posimage-lightbox-prev {
        left: 10px;
    }

    .posimage-lightbox-next {
        right: 10px;
    }

    .posimage-lightbox-image {
        max-width: 95%;
        max-height: 85%;
    }
}

@media (max-width: 480px) {
    .posimage-gallery-grid {
        column-count: 1;
    }
}
