/* Gallery Split Layout */
.gallery-layout {
    display: grid;
    grid-template-columns: 1fr 500px;
    height: calc(100vh - 80px);
    position: relative;
}

/* Left Sidebar */
.gallery-sidebar {
    background: var(--white);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    overflow-y: auto;
    height: 100%;
    max-width: 100%;
}

.gallery-header {
    padding: 2rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 10;
}

.gallery-header h1 {
    font-size: 1.75rem;
    color: var(--dark-navy);
    margin-bottom: 0.25rem;
}

.gallery-count {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Filter Buttons */
.gallery-filters {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 90px;
    background: var(--white);
    z-index: 9;
    overflow-x: auto;
}

/* Alphabetical Navigation */
.alphabet-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 145px;
    background: var(--white);
    z-index: 8;
    justify-content: center;
}

.alphabet-link {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--light-gray);
    color: var(--text-dark);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.alphabet-link:hover {
    background: var(--primary-blue);
    color: var(--white);
    transform: scale(1.1);
}

.alphabet-link.active {
    background: var(--primary-blue);
    color: var(--white);
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: var(--white);
    color: var(--text-dark);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.filter-btn.active {
    background: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
}

/* Product Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1px;
    background: rgba(0, 0, 0, 0.06);
    padding: 0;
}

/* Mobile-optimized grid */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* Hide alphabet scrubber on desktop */
.alphabet-scrubber {
    display: none;
}

@media (max-width: 768px) {
    .alphabet-scrubber {
        display: flex;
    }
}

/* Letter Section Headers */
.letter-section {
    grid-column: 1 / -1;
    background: var(--white);
    padding: 0;
    border-bottom: 2px solid var(--primary-blue);
}

.letter-header {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    padding: 0.75rem 1.5rem;
    background: linear-gradient(to right, var(--light-gray) 0%, var(--white) 100%);
}

.gallery-item {
    background: var(--white);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
}

.gallery-item-image {
    aspect-ratio: 1;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.gallery-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
}

.gallery-placeholder svg {
    color: var(--primary-blue);
    opacity: 0.3;
}

.gallery-item-label {
    padding: 0.5rem 0.75rem;
    background: var(--white);
    border-top: 1px solid #e8ecf1;
    text-align: center;
}

.gallery-item-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--dark-navy);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.6em;
}

.gallery-item:hover {
    box-shadow: 0 4px 12px rgba(44, 62, 122, 0.15);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item.active {
    outline: 3px solid var(--primary-blue);
    outline-offset: -3px;
    z-index: 1;
}

.gallery-item.hidden {
    display: none;
}

/* Right Detail Panel */
.gallery-detail {
    background: var(--white);
    overflow-y: auto;
    height: 100%;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

/* Hide close button on desktop */
.detail-close-btn {
    display: none;
}

.detail-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.detail-image-container {
    background: var(--light-gray);
    border-radius: 0;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.detail-image-container img {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
}

.detail-info {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.detail-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-blue) 100%);
    color: var(--white);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.detail-info h2 {
    font-size: 1.5rem;
    color: var(--dark-navy);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.detail-metal {
    font-size: 1rem;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.detail-location {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.detail-description {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.detail-description h3 {
    font-size: 1rem;
    color: var(--dark-navy);
    margin-bottom: 0.5rem;
}

.detail-description p {
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 0.95rem;
}

.detail-features {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.detail-features h3 {
    font-size: 1rem;
    color: var(--dark-navy);
    margin-bottom: 0.75rem;
}

.detail-features ul {
    list-style: none;
    padding: 0;
}

.detail-features li {
    color: var(--text-dark);
    line-height: 1.6;
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.detail-features li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-blue);
    font-weight: bold;
}

.detail-guarantee {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--light-gray);
    border-radius: 0;
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--gold);
}

.detail-guarantee svg {
    color: var(--gold);
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.detail-guarantee strong {
    display: block;
    color: var(--dark-navy);
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.detail-guarantee p {
    color: var(--text-dark);
    font-size: 0.85rem;
    margin: 0;
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.detail-actions .btn {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
}

.detail-actions svg {
    width: 18px;
    height: 18px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .gallery-layout {
        grid-template-columns: 380px 1fr;
    }

    .gallery-header {
        padding: 1.5rem 1rem 0.75rem;
    }

    .gallery-header h1 {
        font-size: 1.5rem;
    }

    .gallery-filters {
        padding: 0.75rem 1rem;
        top: 75px;
    }

    .detail-content {
        padding: 2rem 1.5rem;
    }

    .detail-image-container {
        padding: 2rem;
        min-height: 300px;
    }

    .detail-info {
        padding: 2rem;
    }

    .detail-info h2 {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .gallery-layout {
        grid-template-columns: 1fr;
        height: auto;
        display: block;
    }

    .gallery-sidebar {
        height: auto;
        border-right: none;
        border-bottom: none;
        min-height: 100vh;
    }

    .gallery-header {
        position: static;
        padding: 1.5rem 1rem 0.75rem;
    }

    .gallery-filters {
        position: static;
        padding: 0.75rem 1rem;
        top: auto;
    }

    .alphabet-nav {
        position: static;
        top: auto;
        padding: 0.75rem 1rem;
        display: none;
        /* Hide horizontal nav on mobile */
    }

    /* Vertical A-Z scrubber for mobile */
    .alphabet-scrubber {
        display: flex !important;
        position: fixed;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        flex-direction: column;
        gap: 2px;
        padding: 0.5rem 0.25rem;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-radius: 12px 0 0 12px;
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
        z-index: 100;
        max-height: 80vh;
        overflow-y: auto;
    }

    .alphabet-scrubber::-webkit-scrollbar {
        display: none;
    }

    .alphabet-scrubber .alphabet-link {
        width: 24px;
        height: 20px;
        font-size: 0.7rem;
        padding: 0;
        background: transparent;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        color: var(--primary-blue);
        transition: all 0.15s ease;
        flex-shrink: 0;
    }

    .alphabet-scrubber .alphabet-link:hover,
    .alphabet-scrubber .alphabet-link.active {
        background: var(--primary-blue);
        color: var(--white);
        transform: scale(1.2);
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        max-height: none;
        overflow-y: visible;
        gap: 0.5rem;
        padding-bottom: 1rem;
    }

    .gallery-item-label {
        padding: 0.4rem 0.5rem;
    }

    .gallery-item-name {
        font-size: 0.7rem;
        min-height: 2.4em;
    }

    /* Modal overlay for detail panel on mobile */
    .gallery-detail {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1000;
        background: var(--white);
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        display: none;
    }

    .gallery-detail.active {
        display: block;
        transform: translateY(0);
    }

    .detail-close-btn {
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        background: var(--white);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        padding: 1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        z-index: 10;
    }

    .detail-close-btn button {
        background: var(--light-gray);
        border: none;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 1.5rem;
        color: var(--text-dark);
        transition: all 0.2s ease;
    }

    .detail-close-btn button:hover {
        background: var(--primary-blue);
        color: var(--white);
    }

    .detail-close-btn h3 {
        font-size: 1rem;
        color: var(--text-light);
        margin: 0;
    }

    .detail-content {
        padding: 1rem;
    }

    .detail-image-container {
        padding: 1.5rem;
        min-height: 250px;
    }

    .detail-info {
        padding: 1.5rem 1rem;
    }

    .detail-info h2 {
        font-size: 1.5rem;
    }

    .detail-actions {
        flex-direction: column;
    }

    .detail-actions .btn {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .gallery-header h1 {
        font-size: 1.25rem;
    }

    .filter-btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.85rem;
    }

    .gallery-item-label {
        padding: 0.35rem 0.4rem;
    }

    .gallery-item-name {
        font-size: 0.65rem;
        min-height: 2.2em;
        line-height: 1.2;
    }

    .alphabet-nav {
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .alphabet-link {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .letter-header {
        font-size: 1.25rem;
        padding: 0.75rem 0.5rem 0.5rem;
    }

    .detail-content {
        padding: 1.5rem 1rem;
    }

    .detail-image-container {
        padding: 1rem;
        min-height: 200px;
    }

    .detail-info {
        padding: 1rem;
    }

    .detail-info h2 {
        font-size: 1.25rem;
    }
}