/* Head Tracking 3D Page Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--color-bg, #0a0a0f);
    color: var(--color-text, #ffffff);
    min-height: 100vh;
    overflow: hidden;
}

/* Background Gradient */
.bg-gradient {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(168, 85, 247, 0.12) 0%, transparent 50%),
        linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
    z-index: -1;
}

/* Three.js Canvas */
#three-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Camera Container */
.camera-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 200px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 100;
}

.camera-container video,
.camera-container canvas {
    width: 100%;
    display: block;
    transform: scaleX(-1);
}

#face-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.camera-label {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
}

.fps-counter {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #10b981;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 10;
    font-family: 'Inter', monospace;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-text {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
}

/* Permission Overlay */
.permission-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.permission-content {
    text-align: center;
    max-width: 400px;
    padding: 40px;
}

.permission-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.permission-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.permission-content p {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Instructions */
.instructions {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    z-index: 100;
    animation: fadeIn 0.5s ease;
}

.instructions strong {
    color: #a855f7;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Sensitivity Controls */
.sensitivity-controls {
    position: fixed;
    bottom: 180px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    /* Increased gap */
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.control-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #a855f7;
    font-weight: 600;
    margin-bottom: 4px;
    text-align: center;
    width: 100%;
}

.sensitivity-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
}

.sensitivity-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sensitivity-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sensitivity-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

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

#sensitivity-value {
    font-size: 16px;
    font-weight: 600;
    color: #a855f7;
    min-width: 40px;
    text-align: center;
    font-family: 'Inter', monospace;
}

/* Calibration Overlay */
.calibration-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.85);
    z-index: 500;
}

.calibration-instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    padding: 30px 50px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.calibration-instructions h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.calibration-instructions p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    margin-bottom: 15px;
}

.calibration-instructions strong {
    color: #10b981;
}

.calibration-progress {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 15px;
}

.calibration-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.calibration-dot.active {
    background: #6366f1;
    border-color: #6366f1;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.6);
    animation: dotPulse 1s ease-in-out infinite;
}

.calibration-dot.completed {
    background: #10b981;
    border-color: #10b981;
}

@keyframes dotPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.calibration-hint {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

/* Corner Markers */
.corner-marker {
    position: fixed;
    width: 70px;
    height: 70px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.3;
    pointer-events: none;
}

.corner-marker.active {
    opacity: 1;
    pointer-events: auto;
}

.corner-marker.completed {
    opacity: 0.5;
    pointer-events: none;
}

.corner-marker.completed .corner-icon {
    color: #10b981;
}

.corner-marker.top-left {
    top: 20px;
    left: 20px;
}

.corner-marker.top-right {
    top: 20px;
    right: 20px;
}

.corner-marker.bottom-right {
    bottom: 20px;
    right: 20px;
}

.corner-marker.bottom-left {
    bottom: 20px;
    left: 20px;
}

.corner-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.3);
    animation: cornerPulse 2s ease-in-out infinite;
}

.corner-marker.active .corner-pulse {
    background: rgba(99, 102, 241, 0.5);
}

@keyframes cornerPulse {

    0%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.corner-icon {
    font-size: 36px;
    color: #a855f7;
    z-index: 1;
    transition: all 0.2s ease;
}

.corner-marker:hover .corner-icon {
    transform: scale(1.2);
    color: #10b981;
}

.corner-marker.active:hover .corner-pulse {
    animation: none;
    transform: scale(1.5);
    opacity: 0.3;
}

/* Skip Button */
.btn-skip {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 24px;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-skip:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .camera-container {
        width: 140px;
        bottom: 10px;
        right: 10px;
    }

    .instructions {
        padding: 10px 16px;
        font-size: 12px;
    }
}

/* ===== Visitor Counter - Copied from main.css ===== */
.visitor-counter {
    display: flex;
    justify-content: flex-start;
    /* Align left */
    padding: 0;
    position: fixed;
    bottom: 50px;
    left: 40px;
    transform: none;
    /* Remove centering transform */
    z-index: 90;
    pointer-events: none;

    /* 3D Perspective Effect */
    transform: perspective(800px) rotateY(25deg) rotateX(10deg) translateZ(0);
    transform-origin: left bottom;
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.visitor-counter:hover {
    opacity: 1;
    transform: perspective(800px) rotateY(15deg) rotateX(5deg) scale(1.05);
}

.counter-frame {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    background: rgba(20, 20, 30, 0.6);
    /* Slightly darker background */
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(99, 102, 241, 0.1);
    /* Subtle inner glow */
    border-radius: 12px;
    /* Less rounded for tech look */
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.counter-label {
    font-family: 'Inter', sans-serif;
    /* Fallback for --font-primary */
    font-family: var(--font-primary);
    font-size: 12px;
    /* Fallback for --text-xs */
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.6);
    /* Fallback for --color-text-muted opacity */
    color: var(--color-text-muted);
    opacity: 0.6;
}

.counter-display {
    display: flex;
    align-items: center;
}

.counter-number {
    font-family: 'Inter', sans-serif;
    /* Fallback mostly */
    font-family: var(--font-display);
    font-size: 14px;
    /* Fallback for --text-sm */
    font-size: var(--text-sm);
    font-weight: 600;
    color: #a855f7;
    /* Fallback for --color-accent or specific color in headtrack */
    letter-spacing: 0.05em;
    min-width: 60px;
    text-align: center;
}

.counter-badge {
    display: none;
}

/* Subtle pulse on load */
@keyframes counterPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.counter-number.loading {
    animation: counterPulse 0.8s ease-in-out infinite;
}

.counter-number.error {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}