/**
 * CC Framework - Custom Cursor Styles
 * VERSION 4.1 - Modulare CSS-Datei
 * Elegante Farben: #1D1459 (Dunkelblau), #9C8B7C (Taupe), Weiß
 */

/* =================================================================
   CUSTOM CURSOR BASE STYLES
   ================================================================= */

.cc-custom-cursor {
    position: fixed !important;
    /* Don't set top/left - they override JavaScript transforms! */
    /* top: 0 !important; */
    /* left: 0 !important; */
    width: 60px !important;
    height: 60px !important;
    background: #1D1459 !important;
    border: 2px solid #FFFFFF !important;
    border-radius: 50% !important;
    pointer-events: none !important;
    z-index: 999999 !important;
    transition: opacity 0.15s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease !important;
    /* transform managed by JavaScript */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #FFFFFF !important;
    font-size: 12px !important;
    font-weight: bold !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 15px rgba(29, 20, 89, 0.4) !important;
    opacity: 1 !important;
    will-change: transform, opacity !important;
    contain: layout style paint !important;
    letter-spacing: 0.5px !important;
    text-shadow: none !important;
    transform-origin: 0 0 !important;
}

/* =================================================================
   CURSOR STATES - FARBSCHEMA
   ================================================================= */

/* CLICK STATE - Taupe */
.cc-custom-cursor.click-active {
    background: #9C8B7C !important;
    border-color: #FFFFFF !important;
    color: #FFFFFF !important;
    box-shadow: 0 6px 25px rgba(156, 139, 124, 0.6) !important;
}

/* HOVER STATE - Weiß mit dunklem Border */
.cc-custom-cursor.hover-link {
    background: #FFFFFF !important;
    border: 3px solid #1D1459 !important;
    color: #1D1459 !important;
    box-shadow: 0 6px 25px rgba(255, 255, 255, 0.8) !important;
    font-weight: 700 !important;
}

/* ROOM HOVER STATE - Taupe mit dunklem Border */
.cc-custom-cursor.room-hover {
    background: #9C8B7C !important;
    border: 3px solid #1D1459 !important;
    color: #FFFFFF !important;
    box-shadow: 0 6px 25px rgba(156, 139, 124, 0.6) !important;
    font-weight: 700 !important;
}

/* =================================================================
   TOUCH FEEDBACK
   ================================================================= */

.touch-feedback {
    position: fixed !important;
    width: 40px !important;
    height: 40px !important;
    background: radial-gradient(circle, rgba(29, 20, 89, 0.6) 0%, rgba(29, 20, 89, 0.2) 40%, transparent 70%) !important;
    border-radius: 50% !important;
    pointer-events: none !important;
    z-index: 999998 !important;
    animation: cc-touch-ripple 0.6s ease-out forwards !important;
}

@keyframes cc-touch-ripple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* =================================================================
   HAPTIC FEEDBACK ANIMATION
   ================================================================= */

.haptic-feedback {
    animation: cc-haptic-pulse 0.1s ease-in-out !important;
}

@keyframes cc-haptic-pulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1); 
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.05); 
    }
}

/* =================================================================
   SYSTEM CURSOR OVERRIDE
   ================================================================= */

/* Hide system cursor when custom cursor is active */
body.cc-cursor-active,
body.cc-cursor-active * {
    cursor: none !important;
}

/* Interactive elements keep pointer behavior */
body.cc-cursor-active a,
body.cc-cursor-active button,
body.cc-cursor-active .btn,
body.cc-cursor-active .button,
body.cc-cursor-active .room-nav-item,
body.cc-cursor-active .room-card,
body.cc-cursor-active .content-card,
body.cc-cursor-active .cc-content-item,
body.cc-cursor-active [role="button"],
body.cc-cursor-active [tabindex]:not([tabindex="-1"]) {
    cursor: none !important;
}

/* Text inputs keep text cursor */
body.cc-cursor-active input[type="text"],
body.cc-cursor-active input[type="email"],
body.cc-cursor-active input[type="password"],
body.cc-cursor-active input[type="search"],
body.cc-cursor-active textarea,
body.cc-cursor-active [contenteditable="true"] {
    cursor: text !important;
}

/* =================================================================
   CC FRAMEWORK ELEMENTS INTEGRATION
   ================================================================= */

/* Room Navigation */
.room-nav-item {
    transition: all 0.3s ease;
}

.room-nav-item:hover {
    transform: translateX(5px);
}

/* Room Cards */
.room-card,
.room-overview-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.room-card:hover,
.room-overview-card:hover {
    transform: translateY(-5px);
}

/* Content Cards */
.content-card,
.cc-content-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-card:hover,
.cc-content-item:hover {
    transform: translateY(-8px) scale(1.02);
}

/* Breadcrumbs */
.semantic-breadcrumbs a {
    transition: color 0.3s ease;
}

/* =================================================================
   MOBILE TOUCH SUPPORT
   ================================================================= */

@media screen and (max-width: 768px) {
    
    /* Custom cursor stays visible on mobile for feedback */
    .cc-custom-cursor {
        display: flex !important;
        opacity: 0 !important;
    }
    
    /* Touch highlight colors */
    a, button, .btn, .button, 
    .menu-toggle, .mobile-menu-button,
    .room-nav-item a, .room-card a,
    .content-card, .cc-content-item,
    .back-to-rooms, .cc-back-to-rooms {
        -webkit-tap-highlight-color: rgba(29, 20, 89, 0.15) !important;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Active touch states */
    a:active, button:active,
    .content-card:active,
    .cc-content-item:active,
    .room-card:active {
        opacity: 0.8 !important;
        transform: scale(1.02) !important;
        transition: all 0.2s ease !important;
    }
    
    /* Text inputs can be selected on mobile */
    input[type="text"], input[type="email"], 
    input[type="password"], input[type="search"],
    textarea, [contenteditable="true"] {
        -webkit-user-select: text !important;
        -moz-user-select: text !important;
        -ms-user-select: text !important;
        user-select: text !important;
        -webkit-tap-highlight-color: rgba(29, 20, 89, 0.1) !important;
    }
}

/* =================================================================
   WORDPRESS BLOCK EDITOR SUPPORT
   ================================================================= */

.wp-block {
    cursor: inherit !important;
}

.wp-block a, .wp-block button {
    cursor: pointer !important;
}

body.cc-cursor-active .wp-block a,
body.cc-cursor-active .wp-block button {
    cursor: none !important;
}

/* =================================================================
   ELEMENTOR COMPATIBILITY
   ================================================================= */

/* Elementor motion effects override */
.elementor-motion-effects-element,
.elementor-section[data-settings*="cursor"],
.elementor-section[data-settings*="cursor"] *,
.elementor-widget[data-settings*="cursor"],
.elementor-widget[data-settings*="cursor"] *,
.elementor-column[data-settings*="cursor"],
.elementor-column[data-settings*="cursor"] * {
    cursor: none !important;
}

/* =================================================================
   ACCESSIBILITY IMPROVEMENTS
   ================================================================= */

/* Focus states remain visible even with custom cursor */
a:focus, button:focus, input:focus, textarea:focus,
.room-nav-item a:focus, .room-card:focus, .content-card:focus,
.cc-content-item:focus, .back-to-rooms:focus {
    outline: 2px solid var(--room-color, #2196f3) !important;
    outline-offset: 2px !important;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .cc-custom-cursor {
        border-width: 3px !important;
        box-shadow: 0 0 0 2px rgba(0,0,0,0.8) !important;
    }
    
    .cc-custom-cursor.hover-link {
        border-width: 4px !important;
    }
    
    .cc-custom-cursor.room-hover {
        border-width: 4px !important;
    }
}

/* =================================================================
   REDUCED MOTION SUPPORT
   ================================================================= */

@media (prefers-reduced-motion: reduce) {
    .cc-custom-cursor,
    .touch-feedback,
    .haptic-feedback {
        animation: none !important;
        transition: none !important;
    }
    
    /* DISABLED - was blocking JavaScript transform
    .cc-custom-cursor.click-active,
    .cc-custom-cursor.hover-link,
    .cc-custom-cursor.room-hover {
    transform: translate(-50%, -50%) !important;
    }
    */
    
    /* Disable hover effects for motion sensitivity */
    .room-nav-item:hover,
    .room-card:hover,
    .room-overview-card:hover,
    .content-card:hover,
    .cc-content-item:hover {
        transform: none !important;
    }
}

/* =================================================================
   DARK MODE SUPPORT
   ================================================================= */

@media (prefers-color-scheme: dark) {
    .cc-custom-cursor {
        background: #9C8B7C !important;
        border-color: #FFFFFF !important;
        color: #1D1459 !important;
        box-shadow: 0 4px 15px rgba(156, 139, 124, 0.4) !important;
    }
    
    .cc-custom-cursor.click-active {
        background: #1D1459 !important;
        color: #FFFFFF !important;
        box-shadow: 0 6px 25px rgba(29, 20, 89, 0.6) !important;
    }
    
    .cc-custom-cursor.hover-link {
        background: #000000 !important;
        border-color: #9C8B7C !important;
        color: #FFFFFF !important;
        box-shadow: 0 6px 25px rgba(0, 0, 0, 0.8) !important;
    }
    
    .cc-custom-cursor.room-hover {
        background: #1D1459 !important;
        border-color: #9C8B7C !important;
        color: #FFFFFF !important;
    }
    
    .touch-feedback {
        background: radial-gradient(circle, rgba(156, 139, 124, 0.6) 0%, rgba(156, 139, 124, 0.2) 40%, transparent 70%) !important;
    }
}

/* =================================================================
   PRINT STYLES
   ================================================================= */

@media print {
    .cc-custom-cursor,
    .touch-feedback {
        display: none !important;
    }
    
    /* Restore normal cursor for print */
    body.cc-cursor-active,
    body.cc-cursor-active * {
        cursor: auto !important;
    }
}

/* =================================================================
   PERFORMANCE OPTIMIZATIONS
   ================================================================= */

/* GPU acceleration for smooth animations */
.cc-custom-cursor {
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

/* Container queries support (future-proofing) */
@supports (container-type: inline-size) {
    .cc-custom-cursor {
        container-type: inline-size;
    }
}

/* =================================================================
   LEGACY BROWSER FALLBACKS
   ================================================================= */

/* Fallback for browsers without backdrop-filter */
@supports not (backdrop-filter: blur(10px)) {
    .cc-custom-cursor {
        background: rgba(29, 20, 89, 0.9) !important;
        border: 2px solid rgba(255, 255, 255, 0.9) !important;
    }
    
    .cc-custom-cursor.click-active {
        background: rgba(156, 139, 124, 0.9) !important;
    }
    
    .cc-custom-cursor.hover-link {
        background: rgba(255, 255, 255, 0.95) !important;
    }
}

/* Fallback for browsers without CSS custom properties */
.room-building-plan .cc-custom-cursor { --room-color: #2196F3; }
.room-reception-hall .cc-custom-cursor { --room-color: #4CAF50; }
.room-brand-core .cc-custom-cursor { --room-color: #FF9800; }
.room-offer-zone .cc-custom-cursor { --room-color: #E91E63; }
.room-knowledge-wing .cc-custom-cursor { --room-color: #9C27B0; }
.room-entertainment-stage .cc-custom-cursor { --room-color: #F44336; }
.room-trust-chamber .cc-custom-cursor { --room-color: #607D8B; }
.room-security-wing .cc-custom-cursor { --room-color: #795548; }
.room-community-garden .cc-custom-cursor { --room-color: #8BC34A; }
.room-innovation-lab .cc-custom-cursor { --room-color: #00BCD4; }
.room-memory-room .cc-custom-cursor { --room-color: #9E9E9E; }
.room-future-port .cc-custom-cursor { --room-color: #3F51B5; }

/* =================================================================
   JAVASCRIPT INLINE STYLE OVERRIDES
   ================================================================= */

/* Force color scheme even when JavaScript sets inline styles */
.cc-custom-cursor[style*="background"],
.cc-custom-cursor[style*="color"],
.cc-custom-cursor[style*="border"] {
    background: #1D1459 !important;
    background-color: #1D1459 !important;
    background-image: none !important;
    color: #FFFFFF !important;
    border: 2px solid #FFFFFF !important;
}

.cc-custom-cursor.click-active[style*="background"] {
    background: #9C8B7C !important;
    background-color: #9C8B7C !important;
}

.cc-custom-cursor.hover-link[style*="background"] {
    background: #FFFFFF !important;
    background-color: #FFFFFF !important;
    color: #1D1459 !important;
}

.cc-custom-cursor.room-hover[style*="background"] {
    background: #9C8B7C !important;
    background-color: #9C8B7C !important;
    color: #FFFFFF !important;
}

/* =================================================================
   DEBUG & DEVELOPMENT
   ================================================================= */

/* Debug mode styles (nur wenn WP_DEBUG aktiv) */
.cc-framework-debug .cc-custom-cursor::after {
    content: 'DEBUG';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: #f44336;
    background: rgba(0,0,0,0.8);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

/* Development grid overlay (nur für Testing) */
.cc-cursor-grid-debug {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(rgba(255,0,0,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,0,0,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 999990;
    opacity: 0.3;
}

/* =================================================================
   UTILITY CLASSES
   ================================================================= */

/* Force cursor visibility */
.cc-force-cursor-visible .cc-custom-cursor {
    opacity: 1 !important;
}

/* Disable cursor temporarily */
.cc-disable-cursor .cc-custom-cursor {
    display: none !important;
}

/* Large cursor for accessibility */
.cc-large-cursor .cc-custom-cursor {
    width: 80px !important;
    height: 80px !important;
    font-size: 14px !important;
}

/* Minimal cursor mode */
.cc-minimal-cursor .cc-custom-cursor {
    width: 40px !important;
    height: 40px !important;
    font-size: 10px !important;
}

/* High contrast cursor */
.cc-high-contrast .cc-custom-cursor {
    background: #000000 !important;
    border: 3px solid #FFFFFF !important;
    box-shadow: 0 0 0 1px #000000, 0 4px 15px rgba(0,0,0,0.8) !important;
}

/* =================================================================
   ANIMATION PERFORMANCE OPTIMIZATIONS
   ================================================================= */

/* Optimized animations for different devices */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices - simplified animations */
    .cc-custom-cursor {
        transition: transform 0.05s ease, opacity 0.2s ease !important;
    }
}

@media (hover: hover) and (pointer: fine) {
    /* Desktop - smooth animations */
    .cc-custom-cursor {
        transition: opacity 0.15s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease !important;
    }
}

/* Reduce animation on slower devices */
@media (update: slow) {
    .cc-custom-cursor,
    .touch-feedback {
        transition-duration: 0.05s !important;
        animation-duration: 0.3s !important;
    }
}

/* =================================================================
   FINAL OVERRIDES & SPECIFICITY
   ================================================================= */

/* Ensure custom cursor always has highest specificity */
html body.cc-cursor-active #cc-custom-cursor.cc-custom-cursor {
    background: #1D1459 !important;
    border: 2px solid #FFFFFF !important;
    color: #FFFFFF !important;
    opacity: 1 !important;
    z-index: 2147483647 !important; /* Maximum z-index */
}

html body.cc-cursor-active #cc-custom-cursor.cc-custom-cursor.click-active {
    background: #9C8B7C !important;
}

html body.cc-cursor-active #cc-custom-cursor.cc-custom-cursor.hover-link {
    background: #FFFFFF !important;
    color: #1D1459 !important;
    border: 3px solid #1D1459 !important;
}

html body.cc-cursor-active #cc-custom-cursor.cc-custom-cursor.room-hover {
    background: #9C8B7C !important;
    color: #FFFFFF !important;
    border: 3px solid #1D1459 !important;
}
