/* Floating Product Card Tooltip */
.evs-product-card {
    position: fixed;
    min-width: 220px;
    max-width: 240px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0;
    /* Removed border-radius */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 24px 20px 0 20px;
    /* Reduced bottom padding to 0 */
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 9999999;
    transition: all 0.3s ease;
    outline: none;
    opacity: 0;
    transform: translateY(10px);
    overflow: hidden;
    /* Ensure button touches bottom if needed */
}

.evs-product-card.show {
    opacity: 1;
    transform: translateY(0);
}

.evs-product-card-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 0;
    /* Removed border-radius */
    margin-bottom: 16px;
    background: #f8fafc;
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.evs-product-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
    text-align: center;
    line-height: 1.4;
}

.evs-product-card-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: #1bbf4c;
    margin-bottom: 20px;
    background: rgba(27, 191, 76, 0.1);
    padding: 6px 16px;
    border-radius: 0;
    /* Removed border-radius */
    display: inline-flex;
    align-items: center;
}

.evs-product-card-btn {
    background: #1bbf4c;
    color: #fff !important;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 0;
    /* Removed border-radius */
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: block;
    width: 100%;
    margin: 0 -20px;
    /* Counter-act parent padding to make it full width if desired, or just adjust padding */
    width: calc(100% + 40px);
    /* Make button touch the edges and bottom */
    text-align: center;
}

.evs-product-card-btn:hover:not(.is-disabled) {
    background: #159a3c;
}

.evs-product-card-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f3f4f6;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 0;
    /* Removed border-radius */
    font-size: 18px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    z-index: 10;
}

.evs-product-card-close:hover {
    background: #e5e7eb;
    color: #111827;
}

/* Hotspots */
.evs-hotspot {
    position: absolute;
    cursor: pointer;
    border: none;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    transition: none;
    box-sizing: border-box;
    z-index: 10;
}

.evs-hotspot:hover,
.evs-hotspot.active {
    background: transparent;
    /* Fully transparent in all states */
    box-shadow: none;
    transform: none;
    z-index: 20;
}

/* Hotspot Tooltip */
.evs-hotspot-tooltip {
    position: fixed;
    background: #1a1a1a;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
    z-index: 999999999;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.evs-hotspot-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.evs-hotspot-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #1a1a1a transparent transparent transparent;
}

/* Exploded View System - Public/Frontend Styles */

/* Grid */
.evs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 20px 0;
}

.evs-grid-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.evs-grid-item:hover {
    transform: translateY(-4px);
    border-color: #cbd5e1;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.evs-diagram-image {
    position: relative;
    overflow: hidden;
    padding-bottom: 72%;
    background: #f8fafc;
}

.evs-diagram-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.evs-grid-item:hover .evs-diagram-image img {
    transform: scale(1.04);
}

.evs-diagram-title {
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
    min-height: 54px;
    display: flex;
    align-items: center;
}

.evs-diagram-category {
    padding: 0 16px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.evs-no-diagrams {
    grid-column: 1 / -1;
    padding: 36px;
    text-align: center;
    color: #64748b;
    font-size: 16px;
}

/* Modal */
body.evs-modal-open {
    overflow: hidden !important;
}

#evs-viewer-modal.evs-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2vw, 24px);
    background: rgba(12, 18, 29, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#evs-viewer-modal.evs-modal.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#evs-viewer-modal .evs-modal-dialog {
    width: min(1180px, 100%);
    max-height: min(92vh, 980px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
    position: relative;
    overflow: hidden;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.28s ease;
}

#evs-viewer-modal.show .evs-modal-dialog {
    transform: translateY(0) scale(1);
}

#evs-viewer-modal .evs-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

#evs-viewer-modal .evs-modal-close:hover {
    background: #e2e8f0;
    transform: scale(1.03);
}

#evs-viewer-modal .evs-modal-close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

#evs-viewer-modal .evs-viewer-shell {
    display: flex;
    gap: 0;
    height: min(88vh, 920px);
    min-height: 520px;
}

#evs-viewer-modal .evs-diagram-viewer {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(14px, 2vw, 24px);
}

#evs-viewer-modal .evs-diagram-viewer img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

#evs-hotspots-container {
    position: absolute;
    inset: 0;
    z-index: 10;
}



#evs-viewer-modal .evs-product-popup.hidden {
    display: none;
}

/* Modal Product Details Overlay */
#evs-viewer-modal .evs-product-popup {
    flex: 0 0 320px;
    background: #fff;
    padding: 30px 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    border-left: 1px solid #e2e8f0;
}

#evs-viewer-modal .evs-product-media {
    width: 100%;
    border-radius: 14px;
    border: 1px solid #f1f5f9;
    background: #ffffff;
    padding: 15px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.02);
}

#evs-viewer-modal #evs-product-image {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    display: block;
    margin: 0;
}

#evs-viewer-modal .evs-product-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#evs-viewer-modal #evs-product-name {
    margin: 0;
    font-size: 1.3rem;
    line-height: 1.3;
    font-weight: 700;
    color: #1a1a1a;
}

#evs-viewer-modal #evs-product-price {
    margin: 0;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 8px 18px;
    border-radius: 100px;
    background: rgba(27, 191, 76, 0.1);
    color: #1bbf4c;
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
}

#evs-viewer-modal .evs-product-button {
    margin-top: 10px;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    border-radius: 12px;
    border: 0;
    text-decoration: none;
    background: #1bbf4c;
    color: #ffffff !important;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(27, 191, 76, 0.2);
}

#evs-viewer-modal .evs-product-button:hover {
    background: #159a3c;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(27, 191, 76, 0.3);
}

/* Responsive */
@media (max-width: 980px) {
    #evs-viewer-modal .evs-modal-dialog {
        max-height: 94vh;
    }

    #evs-viewer-modal .evs-viewer-shell {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }

    #evs-viewer-modal .evs-diagram-viewer {
        border-right: 0;
        border-bottom: 1px solid #e2e8f0;
        min-height: 46vh;
    }

    #evs-viewer-modal .evs-product-popup {
        width: 100%;
        flex-basis: auto;
        padding-top: 20px;
    }
}

@media (max-width: 768px) {
    .evs-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }

    #evs-viewer-modal.evs-modal {
        padding: 8px;
    }

    #evs-viewer-modal .evs-modal-dialog {
        border-radius: 12px;
    }

    #evs-viewer-modal .evs-modal-close {
        width: 36px;
        height: 36px;
        top: 10px;
        right: 10px;
        font-size: 22px;
    }

    #evs-viewer-modal .evs-diagram-viewer {
        min-height: 40vh;
        padding: 12px;
    }

    #evs-viewer-modal .evs-product-popup {
        padding: 16px;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .evs-grid {
        grid-template-columns: 1fr;
    }

    .evs-diagram-title {
        min-height: 0;
    }
}

/* Accessibility */
.evs-hotspot:focus {
    outline: 2px solid #1bbf4c;
    outline-offset: 2px;
}

.evs-grid-item:focus-within {
    outline: 2px solid #1bbf4c;
    outline-offset: 2px;
}

/* Print */
@media print {

    #evs-viewer-modal .evs-modal-close,
    #evs-viewer-modal .evs-product-button {
        display: none;
    }
}