/* ============================================ */
/* WEBROTATE360 LAZY LOADING VIEWER STYLES     */
/* Used by: Osteology bone pages with 360° viewers */
/* ============================================ */

/* WebRotate360 Lazy Loading Styles */
.wr360-lazy-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin-bottom: 2rem;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    background-color: #f2f2f2;
}

.wr360-preview {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #f2f2f2;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.wr360-preview:hover {
    transform: scale(1.01);
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.wr360-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
    padding: 0;
    z-index: 10;
}

.wr360-play-button:hover {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 0.9;
}

.play-text {
    position: absolute;
    bottom: -45px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.wr360-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 249, 250, 0.98);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top-color: #007aff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.wr360-loading p {
    margin-top: 1.5rem;
    color: #333;
    font-weight: 500;
    font-size: 16px;
}

.wr360-viewer {
    background-color: #f2f2f2;
    border-radius: 15px;
    width: 100%;
    height: 100%;
}

/* Ensure WebRotate360 player fills container */
.wr360-viewer .wr360_player,
.wr360-viewer .wr360_player .container {
    width: 100% !important;
    height: 100% !important;
}

/* Custom sizing for pelvic surface viewer - fits 600x388px images exactly */
.wr360-pelvic-surface .wr360-preview,
.wr360-pelvic-surface .wr360-viewer {
    height: 388px;
    max-width: 600px;
    margin: 0 auto;
}

.wr360-pelvic-surface .wr360-preview {
    padding: 0;
}

.wr360-pelvic-surface .preview-image {
    object-fit: contain;
    object-position: center;
}

@media (max-width: 768px) {
    .wr360-play-button svg {
        width: 60px;
        height: 60px;
    }

    .play-text {
        font-size: 12px;
        bottom: -38px;
        padding: 8px 16px;
    }
}

/* Override WebRotate360 library default white background */
.wr360_player {
    background-color: #f2f2f2 !important;
}

/* ============================================ */
/* WEBROTATE360 TOOLBAR - Always visible        */
/* ============================================ */

/* Make toolbar always visible (default is hidden) */
.wr360_player .container .theme_panel {
    visibility: visible !important;
}

/* Enable pointer events on toolbar buttons */
.wr360_player .container .theme_panel .toolbar {
    pointer-events: auto;
}

.wr360_player .container .theme_panel .toolbar > a {
    pointer-events: auto;
    cursor: pointer;
}

/* Force system fonts for 360 viewer elements */
.play-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* ============================================ */
/* CTA BUTTON - Get Full 3D Experience         */
/* ============================================ */

.wr360-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wr360-cta-btn:hover {
    background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.wr360-cta-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

.wr360-cta-btn svg {
    flex-shrink: 0;
}

/* CTA Buttons Container */
.wr360-cta-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* 3D App Button (Green) - Enhanced shadows for more "pop" */
.wr360-cta-3d {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.wr360-cta-3d:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.5);
}

/* XR/Immersive App Button (Purple gradient - simplified for clarity) */
.wr360-cta-xr {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.wr360-cta-xr:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
}

/* Focus states for keyboard accessibility (WCAG compliance) */
.wr360-cta-btn:focus-visible {
    outline: 3px solid rgba(34, 197, 94, 0.6);
    outline-offset: 3px;
}

.wr360-cta-3d:focus-visible {
    outline-color: rgba(34, 197, 94, 0.6);
}

.wr360-cta-xr:focus-visible {
    outline-color: rgba(139, 92, 246, 0.6);
}

@media (max-width: 768px) {
    .wr360-cta-btn {
        padding: 12px 24px;
        font-size: 14px;
    }

    .wr360-cta-container {
        flex-direction: column;
        gap: 10px;
    }
}

/* ============================================ */
/* SHARE VIEWER BUTTON                         */
/* ============================================ */

.viewer-caption {
    flex-wrap: wrap;
    gap: 8px;
}

.share-viewer-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s, background-color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.share-viewer-btn:hover {
    opacity: 1;
    border-color: #007bff;
    background-color: rgba(0, 123, 255, 0.05);
}

.share-viewer-btn:active {
    transform: scale(0.95);
}

.share-viewer-btn svg {
    width: 16px;
    height: 16px;
    stroke: #555;
}

.share-viewer-btn:hover svg {
    stroke: #007bff;
}

/* ============================================ */
/* SHARE TOAST NOTIFICATION                    */
/* ============================================ */

.share-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.share-toast.show {
    opacity: 1;
}

@media (max-width: 768px) {
    .share-viewer-btn {
        padding: 8px 12px;
    }

    .share-toast {
        bottom: 20px;
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* ============================================ */
/* SHARE MODAL                                 */
/* ============================================ */

.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.share-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.share-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 420px;
    width: 100%;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: shareModalIn 0.2s ease-out;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@keyframes shareModalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.share-modal-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.share-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.share-modal-close:hover {
    background-color: #f5f5f5;
    color: #333;
}

/* Social Platform Icons */
.share-platforms {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.share-platform {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

.share-platform:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.share-platform:active {
    transform: scale(0.95);
}

.share-platform svg {
    width: 24px;
    height: 24px;
}

/* Platform colors */
.share-platform[data-platform="facebook"] {
    background: #1877f2;
}

.share-platform[data-platform="twitter"] {
    background: #000;
}

.share-platform[data-platform="linkedin"] {
    background: #0a66c2;
}

.share-platform[data-platform="whatsapp"] {
    background: #25d366;
}

.share-platform[data-platform="telegram"] {
    background: #0088cc;
}

.share-platform[data-platform="email"] {
    background: #ea4335;
}

/* Copy Link Section */
.share-link-container {
    display: flex;
    gap: 10px;
}

.share-link-container input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: #f9f9f9;
    min-width: 0;
}

.share-link-container input:focus {
    outline: none;
    border-color: #007bff;
    background: #fff;
}

.share-link-container button {
    padding: 12px 24px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.share-link-container button:hover {
    background: #0056b3;
}

.share-link-container button.copied {
    background: #28a745;
}

/* Prevent body scroll when modal is open */
body.share-modal-open {
    overflow: hidden;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .share-modal-content {
        padding: 20px;
        border-radius: 12px;
    }

    .share-modal-header h4 {
        font-size: 16px;
    }

    .share-platforms {
        gap: 10px;
    }

    .share-platform {
        width: 46px;
        height: 46px;
    }

    .share-platform svg {
        width: 20px;
        height: 20px;
    }

    .share-link-container {
        flex-direction: column;
    }

    .share-link-container button {
        width: 100%;
    }
}
