/* eCOUNT 3D Viewer — Frontend Styles
 *
 * Glassmorphism UI ported from prototype v4.
 * All colors use CSS custom properties for Elementor theming.
 */

/* ── CSS Custom Properties ── */
.ecount-viewer {
    --ecount-bg: #0c0c18;
    --ecount-accent: #00b464;
    --ecount-accent-glow: rgba(0, 180, 100, 0.4);
    --ecount-glass-bg: rgba(255, 255, 255, 0.07);
    --ecount-glass-border: rgba(255, 255, 255, 0.07);
    --ecount-glass-blur: blur(24px) saturate(1.6);
    --ecount-text: #fff;
    --ecount-text-muted: rgba(255, 255, 255, 0.55);
    --ecount-text-dim: rgba(255, 255, 255, 0.3);
}

/* ── Container ── */
.ecount-viewer {
    position: relative;
    width: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ecount-text);
    background: var(--ecount-bg);
    line-height: 1.5;
}

.ecount-canvas-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.ecount-canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ── Loading State ── */
.ecount-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--ecount-bg);
    z-index: 200;
    transition: opacity 0.4s ease;
}

.ecount-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--ecount-accent);
    border-radius: 50%;
    animation: ecountSpin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.ecount-loading-text {
    font-size: 0.84rem;
    color: var(--ecount-text-muted);
}

.ecount-loading-bar {
    width: 120px;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}

.ecount-loading-progress {
    height: 100%;
    width: 0%;
    background: var(--ecount-accent);
    border-radius: 2px;
    transition: width 0.2s ease;
}

.ecount-error-message {
    color: #f87171;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

/* ── Tooltip (Glassmorphism) ── */
.ecount-tooltip {
    position: absolute;
    background: var(--ecount-glass-bg);
    backdrop-filter: var(--ecount-glass-blur);
    -webkit-backdrop-filter: var(--ecount-glass-blur);
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px) scale(0.97);
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 100;
    max-width: 300px;
    border: 1px solid var(--ecount-glass-border);
}

.ecount-tooltip.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ecount-tooltip-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ecount-text);
    margin-bottom: 3px;
}

.ecount-tooltip-desc {
    font-size: 0.8rem;
    color: var(--ecount-text-muted);
    line-height: 1.45;
}

/* ── Detail Panel (Glassmorphism) ── */
.ecount-detail-panel {
    position: absolute;
    top: 50%;
    right: 36px;
    transform: translateY(-50%) translateX(28px);
    background: rgba(255, 255, 255, 0.055);
    backdrop-filter: blur(40px) saturate(1.8);
    -webkit-backdrop-filter: blur(40px) saturate(1.8);
    border-radius: 22px;
    padding: 30px;
    box-shadow: 0 20px 64px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    width: 370px;
    max-height: 80vh;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 50;
    border: 1px solid rgba(255, 255, 255, 0.055);
}

.ecount-detail-panel.visible {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

.ecount-detail-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: none;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--ecount-text-muted);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ecount-detail-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: var(--ecount-text);
}

.ecount-detail-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--ecount-accent), #00d474);
    color: #fff;
    font-size: 0.68rem;
    padding: 4px 13px;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ecount-detail-title {
    font-size: 1.5rem;
    color: var(--ecount-text);
    margin-bottom: 5px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.ecount-detail-subtitle {
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 22px;
    line-height: 1.5;
}

.ecount-detail-specs {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.ecount-detail-specs .ecount-spec-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 15px;
    background: rgba(255, 255, 255, 0.035);
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s ease;
}

.ecount-detail-specs .ecount-spec-row:hover {
    background: rgba(255, 255, 255, 0.065);
}

.ecount-spec-label {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.ecount-spec-value {
    color: var(--ecount-text);
    font-weight: 500;
    font-size: 0.8rem;
}

.ecount-detail-hotspots-hint {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.76rem;
    color: var(--ecount-text-dim);
    display: flex;
    align-items: center;
    gap: 9px;
}

.ecount-detail-hotspots-hint .dot {
    width: 7px;
    height: 7px;
    background: var(--ecount-accent);
    border-radius: 50%;
    animation: ecountPulseDot 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes ecountPulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.55; }
}

/* ── Hotspot Markers ── */
.ecount-hotspot-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(0, 180, 100, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.88);
    border-radius: 50%;
    cursor: pointer;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 30;
    box-shadow: 0 0 18px var(--ecount-accent-glow);
}

.ecount-hotspot-marker.visible {
    transform: translate(-50%, -50%) scale(1);
}

.ecount-hotspot-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
}

.ecount-hotspot-marker::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 1.5px solid rgba(0, 180, 100, 0.28);
    border-radius: 50%;
    animation: ecountHotspotRing 2.5s ease-out infinite;
}

@keyframes ecountHotspotRing {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2); opacity: 0; }
}

.ecount-hotspot-marker:hover {
    transform: translate(-50%, -50%) scale(1.18);
    box-shadow: 0 0 28px rgba(0, 180, 100, 0.55);
}

/* ── Back Button ── */
.ecount-back-button {
    position: absolute;
    top: 22px;
    left: 22px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    padding: 11px 20px;
    border-radius: 13px;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    gap: 7px;
    opacity: 0;
    transform: translateX(-18px);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 40;
}

.ecount-back-button.visible {
    opacity: 1;
    transform: translateX(0);
}

.ecount-back-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--ecount-text);
}

/* ── Initial Hint ── */
.ecount-initial-hint {
    position: absolute;
    bottom: 44px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--ecount-text-dim);
    font-size: 0.84rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    opacity: 0;
    transition: opacity 0.8s ease;
    text-align: center;
    pointer-events: none;
}

.ecount-initial-hint.visible {
    opacity: 1;
}

.ecount-initial-hint .icon {
    display: block;
    margin-bottom: 7px;
    font-size: 1.3rem;
    animation: ecountFloatIcon 3s ease-in-out infinite;
}

@keyframes ecountFloatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ── Hotspot Container ── */
.ecount-hotspots-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 25;
}

.ecount-hotspots-container .ecount-hotspot-marker {
    pointer-events: auto;
}

/* ── Transparent Background Modifier ── */
.ecount-viewer--transparent {
    background: transparent;
}

.ecount-viewer--transparent .ecount-loading {
    background: rgba(0, 0, 0, 0.5);
}

/* ── Responsive: Mobile ── */
@media (max-width: 768px) {
    .ecount-detail-panel {
        position: absolute;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 50vh;
        border-radius: 22px 22px 0 0;
        transform: translateY(100%);
        padding: 24px 20px;
    }

    .ecount-detail-panel.visible {
        transform: translateY(0);
    }

    .ecount-detail-title {
        font-size: 1.25rem;
    }

    .ecount-back-button {
        top: 12px;
        left: 12px;
        padding: 8px 14px;
        font-size: 0.78rem;
    }
}
