/* Photo Gallery Manager Frontend Styles */

.pgm-gallery-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pgm-form-header {
    text-align: center;
    margin-bottom: 30px;
}

.pgm-form-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: #8B0000;
    margin: 0 0 15px 0;
    text-align: left;
}

.pgm-form-lines {
    width: 100px;
    height: 2px;
    background: #666;
    margin: 0 auto;
}

.pgm-form-lines::after {
    content: '';
    display: block;
    width: 100px;
    height: 2px;
    background: #666;
    margin-top: 5px;
}

.pgm-gallery-form {
    width: 100%;
}

.pgm-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.pgm-form-field {
    flex: 1;
    min-width: 200px;
}

.pgm-field-label {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    text-align: left;
    position: relative;
}

.pgm-add-btn {
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    margin-left: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.pgm-add-btn:hover {
    background: #005a87;
}

.pgm-field-select,
.pgm-field-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    color: #333;
}

.pgm-field-select:focus,
.pgm-field-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.pgm-file-input-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pgm-file-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pgm-file-label {
    background: white;
    border: 1px solid #ccc;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pgm-file-label:hover {
    background: #f5f5f5;
    border-color: #999;
}

.pgm-file-text {
    color: #666;
    font-size: 14px;
}

/* Image Preview Styles */
.pgm-image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.pgm-preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.pgm-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pgm-preview-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.pgm-preview-delete:hover {
    background: #c82333;
}

.pgm-preview-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pgm-save-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 20px;
}

.pgm-save-btn:hover {
    background: #218838;
}

/* Modal Styles */
.pgm-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.pgm-modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
    text-align: left;
}

.pgm-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 15px;
}

.pgm-close:hover,
.pgm-close:focus {
    color: #000;
}

.pgm-modal h2 {
    margin-top: 0;
    color: #333;
    font-size: 1.5rem;
}

.pgm-modal-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
}

.pgm-modal-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.pgm-modal-btn:hover {
    background: #005a87;
}

/* Success/Error Messages */
.pgm-message {
    padding: 12px 16px;
    margin: 15px 0;
    border-radius: 4px;
    font-weight: 500;
}

.pgm-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.pgm-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pgm-form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .pgm-form-field {
        min-width: 100%;
    }
    
    .pgm-form-title {
        font-size: 2rem;
    }
    
    .pgm-modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 20px;
    }
}

/* Loading State */
.pgm-loading {
    opacity: 0.6;
    pointer-events: none;
}

.pgm-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Gallery Display Styles */
.pgm-gallery-display {
    margin: 20px 0;
}

.pgm-no-galleries {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.pgm-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin: 20px 0;
}

.pgm-gallery-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pgm-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.pgm-gallery-header {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.pgm-gallery-title {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.4rem;
    font-weight: bold;
}

.pgm-gallery-subtitle {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 1rem;
}

.pgm-gallery-year {
    margin: 0;
    color: #8B0000;
    font-size: 0.9rem;
    font-weight: 500;
}

.pgm-gallery-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    padding: 15px;
}

.pgm-photo-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.pgm-photo-item:hover {
    transform: scale(1.05);
}

.pgm-photo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Responsive Design for Gallery Display */
@media (max-width: 768px) {
    .pgm-gallery-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .pgm-gallery-photos {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 6px;
        padding: 10px;
    }
}

/* Gallery Showcase Styles - Matching Reference Design */
.pgm-gallery-showcase {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.pgm-showcase-header {
    margin-bottom: 30px;
}

.pgm-showcase-title {
    font-size: 3rem;
    font-weight: bold;
    color: #8B0000;
    margin: 0 0 15px 0;
    font-family: serif;
}

.pgm-showcase-line {
    width: 100px;
    height: 2px;
    background: #8B0000;
    margin: 0 auto;
}

/* Year Filter Buttons */
.pgm-year-filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.pgm-year-btn {
    padding: 12px 24px;
    border: 1px solid #666;
    background: #4a5568;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-family: sans-serif;
}

.pgm-year-btn:hover {
    background: #2d3748;
    transform: translateY(-1px);
}

.pgm-year-btn.active {
    background: white;
    color: #333;
    border-color: #666;
    font-weight: 600;
}

/* Gallery Content */
.pgm-gallery-content {
    position: relative;
}

.pgm-year-gallery {
    display: none;
}

.pgm-year-gallery.active {
    display: block;
}

/* Gallery List View (Thumbnails) */
.pgm-gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin: 0 auto;
    max-width: 1000px;
}

/* Responsive adjustments for thumbnails */
@media (max-width: 768px) {
    .pgm-gallery-thumbnails {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        max-width: 600px;
    }
}

@media (max-width: 480px) {
    .pgm-gallery-thumbnails {
        grid-template-columns: 1fr;
        gap: 15px;
        max-width: 300px;
    }
}

.pgm-gallery-thumbnail {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.pgm-gallery-thumbnail:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.pgm-thumbnail-image {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.pgm-thumbnail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pgm-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pgm-gallery-thumbnail:hover .pgm-thumbnail-overlay {
    opacity: 1;
}

.pgm-gallery-thumbnail:hover .pgm-thumbnail-image img {
    transform: scale(1.1);
}

.pgm-thumbnail-icon {
    font-size: 24px;
    color: white;
    background: rgba(139, 0, 0, 0.8);
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pgm-thumbnail-title {
    padding: 15px;
    background: white;
    color: #8B0000;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    font-family: sans-serif;
    line-height: 1.4;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Gallery Detail View */
.pgm-gallery-detail {
    display: none;
}

.pgm-gallery-detail.active {
    display: block;
}

.pgm-gallery-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.pgm-back-btn,
.pgm-back-to-titles {
    background: #8B0000;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.pgm-back-btn:hover,
.pgm-back-to-titles:hover {
    background: #660000;
}

/* Title Detail View */
.pgm-title-detail {
    display: none;
    animation: fadeIn 0.3s ease;
}

/* Subtitle Filters (Tabs) */
.pgm-subtitle-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 30px 0;
    padding: 0 20px;
}

.pgm-subtitle-btn {
    background: white;
    color: #333;
    border: 2px solid #ddd;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pgm-subtitle-btn:hover {
    background: #f8f8f8;
    border-color: #8B0000;
    color: #8B0000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.15);
}

.pgm-subtitle-btn.active {
    background: #8B0000;
    color: white;
    border-color: #8B0000;
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.25);
}

.pgm-subtitle-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.pgm-gallery-detail-title {
    color: #8B0000;
    font-size: 2rem;
    font-weight: bold;
    margin: 0;
    font-family: serif;
}

.pgm-gallery-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 0 auto;
    max-width: 1200px;
}

.pgm-detail-image {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pgm-detail-image:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.pgm-detail-image img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.pgm-detail-image:hover img {
    transform: scale(1.05);
}

/* Responsive Design for Showcase */
@media (max-width: 768px) {
    .pgm-showcase-title {
        font-size: 2.5rem;
    }
    
    .pgm-year-filters {
        gap: 10px;
        margin-bottom: 30px;
    }
    
    .pgm-year-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .pgm-gallery-thumbnails {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .pgm-thumbnail-image {
        height: 120px;
    }
    
    .pgm-thumbnail-title {
        padding: 10px;
        font-size: 14px;
        min-height: 40px;
    }
    
    .pgm-gallery-detail-title {
        font-size: 1.5rem;
    }
    
    .pgm-gallery-images {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .pgm-detail-image img {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .pgm-gallery-thumbnails {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .pgm-year-filters {
        flex-direction: column;
        align-items: center;
    }
    
    .pgm-year-btn {
        width: 200px;
    }
    
    .pgm-gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .pgm-gallery-detail-title {
        font-size: 1.3rem;
    }
    
    .pgm-gallery-images {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Field Description Styles */
.pgm-field-description {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Lightbox Styles */
.pgm-frontend-lightbox {
    position: fixed !important;
    z-index: 9999999 !important;
    left: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: rgba(0, 0, 0, 0.95) !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    transform: none !important;
}

.pgm-frontend-lightbox.pgm-show {
    display: flex !important;
}

/* Ensure lightbox is always on top of WordPress admin bar */
.admin-bar .pgm-frontend-lightbox {
    z-index: 9999999 !important;
}

#pgm-frontend-lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    animation: pgm-zoom-in 0.3s ease;
}

@keyframes pgm-zoom-in {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.pgm-frontend-lightbox .pgm-lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    transition: color 0.3s ease;
}

.pgm-frontend-lightbox .pgm-lightbox-close:hover,
.pgm-frontend-lightbox .pgm-lightbox-close:focus {
    color: #dc3232;
}

.pgm-frontend-lightbox .pgm-lightbox-prev,
.pgm-frontend-lightbox .pgm-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    padding: 16px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    user-select: none;
    transition: all 0.3s ease;
    z-index: 10;
}

.pgm-frontend-lightbox .pgm-lightbox-prev:hover,
.pgm-frontend-lightbox .pgm-lightbox-next:hover {
    background-color: rgba(220, 50, 50, 0.8);
}

.pgm-frontend-lightbox .pgm-lightbox-prev {
    left: 20px;
}

.pgm-frontend-lightbox .pgm-lightbox-next {
    right: 20px;
}

#pgm-frontend-lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    text-align: center;
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    font-size: 14px;
    z-index: 10;
}

.pgm-lightbox-trigger {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.pgm-detail-image:hover .pgm-lightbox-trigger,
.pgm-photo-item:hover .pgm-lightbox-trigger {
    transform: scale(1.05);
}

/* Mobile responsive lightbox */
@media (max-width: 768px) {
    #pgm-frontend-lightbox-img {
        max-width: 95vw;
        max-height: 85vh;
    }
    
    .pgm-frontend-lightbox .pgm-lightbox-prev,
    .pgm-frontend-lightbox .pgm-lightbox-next {
        font-size: 30px;
        padding: 12px;
    }
    
    .pgm-frontend-lightbox .pgm-lightbox-prev {
        left: 10px;
    }
    
    .pgm-frontend-lightbox .pgm-lightbox-next {
        right: 10px;
    }
    
    .pgm-frontend-lightbox .pgm-lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }
    
    #pgm-frontend-lightbox-caption {
        bottom: 10px;
        font-size: 12px;
        padding: 8px 15px;
    }
}
