/**
 * Pannellum 360 Tours - Frontend CSS
 * 
 * Minimal structural styles only.
 * Developers retain full control over visual styling.
 * 
 * @package P360Tours
 */

/* ==========================================================================
   Tour Container
   ========================================================================== */

.p360-tour {
    position: relative;
    width: 100%;
    max-width: 100%;
}

.p360-viewer-wrapper {
    position: relative;
    width: 100%;
    height: 750px;
    background: #000;
}

.p360-viewer {
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   Debug Overlay
   ========================================================================== */

.p360-debug-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 15px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    max-width: 300px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.p360-debug--visible .p360-debug-overlay {
    opacity: 1;
    visibility: visible;
}

.p360-debug-overlay h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: bold;
    color: #4CAF50;
}

.p360-debug-data p {
    margin: 5px 0;
    line-height: 1.4;
}

.p360-debug-hotspot {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.p360-debug-json {
    width: 100%;
    min-height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 8px;
    font-family: monospace;
    font-size: 11px;
    margin: 10px 0;
    resize: vertical;
}

.p360-debug-copy {
    background: #4CAF50;
    color: #fff;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 12px;
}

.p360-debug-copy:hover {
    background: #45a049;
}

/* Debug mode center crosshair */
.p360-debug-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.p360-debug--visible .p360-debug-crosshair {
    opacity: 1;
    visibility: visible;
}

/* Center red dot */
.p360-debug-crosshair::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #ff0000;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.3),
                0 0 10px rgba(255, 0, 0, 0.5);
}

/* Horizontal line */
.p360-debug-crosshair::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 2px;
    background: rgba(255, 0, 0, 0.6);
}

/* Vertical line */
.p360-debug-crosshair-vertical {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    background: rgba(255, 0, 0, 0.6);
}

/* ==========================================================================
   Drawer
   ========================================================================== */

.p360-drawer {
    position: relative;
    width: 100%;
    background: #f5f5f5;
    border-top: 2px solid #ddd;
}

.p360-drawer-toggle {
    width: 100%;
    padding: 12px 20px;
    background: #333;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.p360-drawer-toggle:hover {
    background: #444;
}

.p360-drawer-toggle-icon {
    transition: transform 0.3s ease;
}

.p360-drawer--open .p360-drawer-toggle-icon {
    transform: rotate(180deg);
}

.p360-drawer-inner {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.p360-drawer--open .p360-drawer-inner {
    max-height: 300px;
    overflow-y: auto;
}

.p360-thumb-list {
    list-style: none;
    margin: 0;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.p360-thumb-item {
    flex: 0 0 auto;
}

.p360-thumb-button {
    background: #fff;
    border: 2px solid #ddd;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.p360-thumb-button:hover {
    border-color: #4CAF50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.p360-thumb--active .p360-thumb-button {
    border-color: #4CAF50;
    background: #f0f8f0;
}

.p360-thumb-image {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
}

.p360-thumb-placeholder {
    width: 100%;
    height: 80px;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.p360-thumb-placeholder .dashicons {
    font-size: 32px;
    color: #999;
}

.p360-thumb-title {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    text-align: center;
    line-height: 1.3;
}

/* ==========================================================================
   Hotspot Styling
   ========================================================================== */

/* CRITICAL: Override Pannellum's default visibility: hidden */
.pnlm-hotspot-base {
    visibility: visible !important;
}

/* Base hotspot styling - applies to ALL hotspots */
.pnlm-hotspot {
    visibility: visible !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 2px solid rgba(0, 0, 0, 0.8) !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5) !important;
    cursor: pointer !important;
    background-image: none !important;
    transition: all 0.3s ease !important;
}

/* Hover effect for all hotspots */
.pnlm-hotspot:hover {
    transform: scale(1.3) !important;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.9) !important;
}

/* Scene hotspots - green navigation circles */
.pnlm-hotspot.pnlm-scene {
    background: rgba(76, 175, 80, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.9) !important;
}

.pnlm-hotspot.pnlm-scene:hover {
    background: rgba(76, 175, 80, 1) !important;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.8) !important;
}

/* Info hotspots - blue information circles */
.pnlm-hotspot.pnlm-info {
    background: rgba(33, 150, 243, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.9) !important;
}

.pnlm-hotspot.pnlm-info:hover {
    background: rgba(33, 150, 243, 1) !important;
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.8) !important;
}

/* Tour hotspots - red tour link circles */
.pnlm-hotspot.pnlm-tour {
    background: rgba(214, 54, 56, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.9) !important;
}

.pnlm-hotspot.pnlm-tour:hover {
    background: rgba(214, 54, 56, 1) !important;
    box-shadow: 0 0 20px rgba(214, 54, 56, 0.8) !important;
}

/* Custom class overrides - users can add these in admin panel */
.pnlm-hotspot.hotspot-scene-link {
    /* Inherits base scene styles, can be customized */
}

.pnlm-hotspot.hotspot-info {
    /* Inherits base info styles, can be customized */
}

.pnlm-hotspot.custom-hotspot {
    /* Custom styling can be added here */
}

/* Tooltip styling */
div.pnlm-tooltip span {
    visibility: visible !important;
    background-color: rgba(0, 0, 0, 0.9) !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
}

/* Pulse animation for hotspots */
@keyframes hotspot-pulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
}

.pnlm-hotspot {
    animation: hotspot-pulse 2s ease-in-out infinite;
}

/* ==========================================================================
   Error Messages
   ========================================================================== */

.p360-error {
    padding: 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    border-radius: 4px;
    font-size: 14px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .p360-viewer-wrapper {
        height: 400px;
    }

    .p360-debug-overlay {
        font-size: 10px;
        padding: 10px;
        max-width: 200px;
    }

    .p360-thumb-list {
        gap: 10px;
    }

    .p360-thumb-button {
        min-width: 100px;
    }

    .p360-thumb-image,
    .p360-thumb-placeholder {
        height: 60px;
    }
}

