/**
 * Frontend Styles
 * 
 * @package Catalog_PDF_Processor_v2
 */

.cpp2-diagram-gallery {
    margin: 20px 0;
}

.cpp2-sections-filter {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cpp2-filter-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}

.cpp2-filter-btn:hover {
    background: #f5f5f5;
}

.cpp2-filter-btn.active {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.cpp2-diagrams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.cpp2-diagram-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.cpp2-diagram-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.cpp2-diagram-item img {
    width: 100%;
    height: auto;
    display: block;
}

.cpp2-diagram-info {
    padding: 10px;
    background: #f9f9f9;
    text-align: center;
}

.cpp2-diagram-info strong {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

.cpp2-diagram-info span {
    font-size: 12px;
    color: #666;
}

/* Lightbox */
.cpp2-lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    cursor: pointer;
}

.cpp2-lightbox-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpp2-lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.cpp2-lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
}

.cpp2-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    line-height: 1;
}

/* Reglas movidas desde templates inline */
.yamaha-despiece-link {
    border: 2px solid transparent;
    border-radius: .5rem;
    padding: .25rem;
    transition: border-color 0.2s ease;
}

.yamaha-despiece-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.yamaha-despiece-link:hover {
    border-color: #dc3545;
}

.yamaha-despiece-link:hover .yamaha-despiece-card {
    transform: translateY(-3px);
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15) !important;
}

.yamaha-despiece-thumb {
    height: 240px;
    object-fit: contain;
    background: #fff;
}

.yamaha-despiece-thumb-placeholder {
    height: 240px;
    background: #fff;
}

.single-despiece-page,
.single-despiece-page .row,
.single-despiece-page .col-lg-6,
.single-despiece-page .col-xl-6 {
    overflow: visible !important;
}

@media (min-width: 992px) {
    .single-despiece-sticky-col {
        align-self: flex-start;
    }

    .single-despiece-sticky-wrap {
        position: -webkit-sticky;
        position: sticky;
        top: 1rem;
        z-index: 2;
    }
}

/* Agrupa visualmente varias referencias con el mismo número del diagrama (single despiece). */
.yamaha-ref-position-group {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.02);
    overflow: hidden;
}

.yamaha-ref-position-group__rail {
    width: 2.5rem;
    background: rgba(0, 0, 0, 0.03);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.yamaha-ref-position-group__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem 0.75rem;
}

.yamaha-ref-position-group__body .referencia-item {
    margin-bottom: 0 !important;
}

.yamaha-ref-remarks-tip:focus {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: 2px;
}

.yamaha-ref-remarks-tip--sm {
    width: 1.2rem;
    height: 1.2rem;
    cursor: help;
    font-size: 0.65rem;
    line-height: 1;
}

.yamaha-ref-remarks-tip:focus:not(:focus-visible) {
    outline: none;
}

/* Skeleton mientras cargan referencias (single despiece, AJAX). */
.yamaha-despiece-skeleton-line {
    height: 4.5rem;
    background: linear-gradient(90deg, #e9ecef 25%, #f1f3f5 50%, #e9ecef 75%);
    background-size: 200% 100%;
    animation: yamaha-skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes yamaha-skeleton-shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

/* Lightbox despiece: alto = viewport del dispositivo, imagen contenida sin scroll inicial */
.yamaha-despiece-lightbox-modal.modal .modal-dialog {
    height: 100vh;
    max-height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
}

.yamaha-despiece-lightbox-modal .yamaha-despiece-lightbox-content {
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.yamaha-despiece-lightbox-modal .yamaha-despiece-lightbox-body {
    min-height: 0;
}

.yamaha-despiece-lightbox-modal .yamaha-despiece-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

