/* ============================================
   AksesHub - Custom Styles & Animations
   ============================================ */

/* Base Reset & Accessibility */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --cursor-size: 48px;
    --button-size: 64px;
    --dwell-time: 1500ms;
    --primary-glow: rgba(59, 130, 246, 0.3);
    --accent-glow: rgba(34, 197, 94, 0.3);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #1f2937;
}
::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Page Transitions */
.page {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Virtual Cursor */
#virtual-cursor {
    transition: transform 0.05s ease-out;
}

#virtual-cursor .cursor-glow {
    box-shadow: 0 0 20px 8px rgba(250, 204, 21, 0.3),
                0 0 40px 16px rgba(250, 204, 21, 0.1);
}

#virtual-cursor.clicking .cursor-glow {
    background: rgba(250, 204, 21, 0.6);
    border-color: #facc15;
    transform: scale(0.8);
    box-shadow: 0 0 30px 12px rgba(250, 204, 21, 0.5);
}

#virtual-cursor.hovering .cursor-glow {
    background: rgba(59, 130, 246, 0.4);
    border-color: #3b82f6;
    box-shadow: 0 0 25px 10px rgba(59, 130, 246, 0.3);
}

/* Cursor Trail Effect */
#cursor-trail {
    opacity: 0.3;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}

/* Dwell Click Progress */
#dwell-ring svg circle:last-child {
    transition: stroke-dashoffset 0.1s linear;
}

/* Camera PIP */
#camera-pip {
    transition: all 0.3s ease;
}
#camera-pip:hover {
    transform: scale(1.05);
}
#camera-pip.minimized {
    width: 120px;
    height: 90px;
}
#camera-pip.minimized video,
#camera-pip.minimized canvas {
    width: 120px;
    height: 90px;
}

/* Social Media Quick Cards */
.social-quick-card {
    min-height: var(--button-size);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-quick-card:hover {
    transform: translateY(-4px) scale(1.02);
}

.social-quick-card:active {
    transform: translateY(0) scale(0.98);
}

.social-quick-card.dwell-active {
    animation: dwellPulse 0.5s ease-in-out infinite alternate;
}

@keyframes dwellPulse {
    from { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    to { box-shadow: 0 0 0 12px rgba(59, 130, 246, 0); }
}

/* Button Focus States (Accessibility) */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 2px;
}

/* Toggle Switch */
#dwell-toggle .toggle-dot {
    transition: transform 0.2s ease;
}

#dwell-toggle.active {
    background-color: #22c55e;
}

#dwell-toggle.active .toggle-dot,
#dwell-toggle.active > div:first-child {
    transform: translateX(100%);
}

/* Settings Slider Custom */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: #374151;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 3px solid #1e3a8a;
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

input[type="range"]:focus {
    outline: none;
}

/* Toast Animation */
#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Bounce Slow Animation */
@keyframes bounceSlow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-bounce-slow {
    animation: bounceSlow 2s ease-in-out infinite;
}

/* Calibration Animation */
@keyframes calibrationPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 0 0 20px rgba(59, 130, 246, 0); }
}

.calibration-active {
    animation: calibrationPulse 1.5s ease-in-out infinite;
}

/* Voice Indicator Bars */
@keyframes voiceBar {
    0%, 100% { height: 4px; }
    50% { height: 16px; }
}

.voice-bar {
    animation: voiceBar 0.5s ease-in-out infinite;
}

.voice-bar:nth-child(2) { animation-delay: 0.1s; }
.voice-bar:nth-child(3) { animation-delay: 0.2s; }
.voice-bar:nth-child(4) { animation-delay: 0.3s; }

/* Smooth Scroll for Settings */
#page-settings main {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Head Tracking Visualization */
.head-pose-indicator {
    transition: transform 0.1s ease-out;
}

/* Large Touch Targets for Accessibility */
@media (pointer: coarse) {
    button, a, input[type="range"] {
        min-height: 48px;
        min-width: 48px;
    }

    .social-quick-card {
        min-height: 80px;
    }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
.high-contrast {
    --primary-glow: rgba(255, 255, 0, 0.5);
    --accent-glow: rgba(0, 255, 255, 0.5);
}

.high-contrast #virtual-cursor .cursor-glow {
    border-color: #ff0;
    background: rgba(255, 255, 0, 0.3);
    box-shadow: 0 0 30px 15px rgba(255, 255, 0, 0.4);
}

/* Loading Spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #374151;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Social Media Icon Hover Glow */
.social-quick-card:hover svg {
    filter: drop-shadow(0 0 8px currentColor);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #1f2937;
}

/* Camera Face Detection Box */
.face-detection-box {
    position: absolute;
    border: 2px solid #22c55e;
    border-radius: 8px;
    pointer-events: none;
    transition: all 0.1s ease-out;
}

/* Gesture Feedback Overlay */
.gesture-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gesture-feedback.show {
    opacity: 1;
}

.gesture-feedback .icon {
    font-size: 64px;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5));
}

/* Voice Command Echo Effect */
@keyframes echo {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(2); opacity: 0; }
}

.voice-echo {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid #22c55e;
    border-radius: 50%;
    animation: echo 1s ease-out forwards;
}
