/* ----------------------------------------------------------------------
   Global Styles & Variables (Consistent with Blog)
---------------------------------------------------------------------- */
:root {
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;
    --navy: #1a237e;
    --copper: #b87333;
    --blush: #fdeff2;
    --dark-text: #333333;
    --light-text: #666666;
    --border-light: #e9ecef;
    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    color: var(--dark-text);
    line-height: 1.7;
    background-color: #ffffff;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--navy);
    margin-bottom: 0.75em;
}

a {
    color: var(--copper);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--navy);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ----------------------------------------------------------------------
   Layout & Header/Footer
---------------------------------------------------------------------- */
.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.site-header, .site-footer {
    padding: 20px;
    text-align: center;
}

.site-header {
    border-bottom: 1px solid #eee;
    margin-bottom: 40px;
}
.site-footer {
    margin-top: 60px;
    background-color: var(--blush);
}

/* ----------------------------------------------------------------------
   Main Gallery Page (index.php)
---------------------------------------------------------------------- */
.page-header {
    text-align: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
}

.page-header p {
    font-size: 1.1rem;
    color: var(--light-text);
}

/* Quality Notice */
.quality-notice {
    background: linear-gradient(135deg, #fff9e6 0%, #fef7e0 100%);
    border: 1px solid #f0c674;
    border-radius: 10px;
    margin: 0 auto 30px;
    max-width: 600px;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(240, 198, 116, 0.1);
}

.notice-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notice-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.notice-text {
    color: #8b6914;
    font-size: 0.95rem;
    line-height: 1.5;
}

.notice-text strong {
    color: #6d4c0f;
}

/* Filters */
.gallery-filters {
    text-align: center;
    margin-bottom: 30px;
}

.gallery-filters a {
    margin: 0 15px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}

.gallery-filters a.active,
.gallery-filters a:hover {
    background-color: var(--copper);
    color: #fff;
    transform: translateY(-1px);
}

/* Results Info */
.results-info {
    text-align: center;
    margin-bottom: 20px;
    color: var(--light-text);
    font-size: 0.95rem;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.gallery-card {
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 5px 20px var(--shadow-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
}

.gallery-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px var(--shadow-medium);
}

/* Improved Thumbnail Container */
.gallery-thumbnail {
    position: relative;
    cursor: pointer;
    background-color: #f8f9fa;
}

.thumbnail-container {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, #f8f9fa 0%, #e9ecef 100%);
}

.thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: all 0.3s ease;
    opacity: 0;
}

.thumbnail-container.loaded img {
    opacity: 1;
}

.thumbnail-container.loaded .image-loader {
    opacity: 0;
    visibility: hidden;
}

/* Image Loader */
.image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--light-text);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.loader-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid var(--copper);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Video thumbnail play icon */
.gallery-thumbnail .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 80px;
    padding-left: 8px;
    transition: all 0.3s ease;
    z-index: 2;
    backdrop-filter: blur(2px);
}

.gallery-card:hover .play-icon {
    transform: translate(-50%, -50%) scale(1.1);
    background-color: rgba(0, 0, 0, 0.75);
}

/* Card Title */
.gallery-card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 70%, rgba(0,0,0,0) 100%);
    padding: 60px 20px 20px;
    color: #fff;
    z-index: 1;
}

.gallery-card-title h3 {
    color: #fff;
    font-size: 1.2rem;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    line-height: 1.3;
}

/* No Items Message */
.no-items {
    text-align: center;
    grid-column: 1 / -1;
    padding: 60px 20px;
    color: var(--light-text);
    font-size: 1.1rem;
}

/* ----------------------------------------------------------------------
   Pagination Styles
---------------------------------------------------------------------- */
.pagination-nav {
    margin-top: 50px;
    text-align: center;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.pagination-btn,
.pagination-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    color: var(--dark-text);
    border: 1px solid var(--border-light);
    background: #fff;
}

.pagination-btn:hover,
.pagination-number:hover {
    background-color: var(--copper);
    color: #fff;
    border-color: var(--copper);
    transform: translateY(-1px);
}

.pagination-number.current {
    background-color: var(--navy);
    color: #fff;
    border-color: var(--navy);
    cursor: default;
}

.pagination-ellipsis {
    color: var(--light-text);
    padding: 0 8px;
    user-select: none;
}

.pagination-info {
    color: var(--light-text);
    font-size: 0.9rem;
}

/* ----------------------------------------------------------------------
   Single Item Page (item.php) - Unchanged
---------------------------------------------------------------------- */
.single-gallery-item {
    max-width: 900px;
    margin: 40px auto;
}

.single-gallery-item h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 30px;
}

.item-media img {
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Responsive YouTube Embed */
.video-responsive-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    border-radius: 8px;
}

.video-responsive-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.item-description {
    margin-top: 30px;
    font-size: 1.1rem;
    line-height: 1.8;
}

.item-tags {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* ----------------------------------------------------------------------
   Responsive Design
---------------------------------------------------------------------- */
@media (max-width: 768px) {
    .gallery-container {
        padding: 15px;
    }
    
    .page-header h1 {
        font-size: 2.2rem;
    }
    
    .quality-notice {
        margin: 0 10px 25px;
        padding: 12px 15px;
    }
    
    .notice-content {
        gap: 10px;
    }
    
    .notice-text {
        font-size: 0.9rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;
    }
    
    .thumbnail-container {
        height: 280px;
    }
    
    .gallery-filters a {
        margin: 5px 8px;
        padding: 6px 14px;
        font-size: 0.95rem;
    }
    
    .pagination {
        gap: 4px;
    }
    
    .pagination-btn,
    .pagination-number {
        min-width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    .pagination-btn {
        padding: 0 8px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .pagination-numbers {
        order: -1;
        width: 100%;
        margin-bottom: 10px;
    }
}