/**
 * Custom 3D Cursor & Scrollbar - PQCrypta KeyVault
 * CSP-Compliant: No inline styles
 */

/* Hide default cursor */
body,
body * {
    cursor: none !important;
}

/* Custom Cursor Container */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

/* Outer Ring - 3D Effect */
.cursor-outer {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(0, 212, 255, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%) rotateX(60deg);
    transform-style: preserve-3d;
    animation: cursor-rotate 3s linear infinite;
    box-shadow:
        0 0 10px rgba(0, 212, 255, 0.4),
        inset 0 0 10px rgba(0, 212, 255, 0.2);
}

/* Inner Core - Glowing Center */
.cursor-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #00d4ff, #7b2cbf);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow:
        0 0 15px rgba(0, 212, 255, 0.8),
        0 0 30px rgba(123, 44, 191, 0.6);
    animation: cursor-pulse 2s ease-in-out infinite;
}

/* Cursor Trail Particle */
.cursor-trail {
    position: fixed;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.8), rgba(123, 44, 191, 0.4));
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    animation: trail-fade 0.6s ease-out forwards;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}

/* Hover State - Expand */
.custom-cursor.hover .cursor-outer {
    width: 60px;
    height: 60px;
    border-color: rgba(123, 44, 191, 0.8);
}

.custom-cursor.hover .cursor-inner {
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, #7b2cbf, #ff1493);
}

/* Click State - Shrink */
.custom-cursor.click .cursor-outer {
    width: 30px;
    height: 30px;
    border-width: 3px;
}

.custom-cursor.click .cursor-inner {
    width: 6px;
    height: 6px;
}

/* Animations */
@keyframes cursor-rotate {
    0% {
        transform: translate(-50%, -50%) rotateX(60deg) rotateZ(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotateX(60deg) rotateZ(360deg);
    }
}

@keyframes cursor-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.8;
    }
}

@keyframes trail-fade {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* ===== Branded Scrollbar ===== */

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.6) rgba(10, 10, 30, 0.8);
}

/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: linear-gradient(180deg, rgba(10, 10, 30, 0.9), rgba(20, 10, 40, 0.9));
    border-radius: 10px;
    border: 1px solid rgba(123, 44, 191, 0.2);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.7), rgba(123, 44, 191, 0.7));
    border-radius: 10px;
    border: 2px solid rgba(10, 10, 30, 0.5);
    box-shadow:
        0 0 10px rgba(0, 212, 255, 0.4),
        inset 0 0 5px rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.9), rgba(123, 44, 191, 0.9));
    box-shadow:
        0 0 15px rgba(0, 212, 255, 0.6),
        inset 0 0 8px rgba(255, 255, 255, 0.3);
}

::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #00d4ff, #7b2cbf);
}

/* Scrollbar Corner */
::-webkit-scrollbar-corner {
    background: rgba(10, 10, 30, 0.9);
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
    /* Smaller cursor on mobile */
    .custom-cursor {
        width: 30px;
        height: 30px;
    }

    .cursor-outer {
        width: 30px;
        height: 30px;
    }

    .cursor-inner {
        width: 6px;
        height: 6px;
    }

    /* Thinner scrollbar on mobile */
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
}

/* Touch devices - restore default cursor */
@media (hover: none) and (pointer: coarse) {
    body,
    body * {
        cursor: auto !important;
    }

    .custom-cursor,
    .cursor-trail {
        display: none !important;
    }
}
