/* ============================================
   CUORE DI LUNA - Premium Enhancements
   Advanced effects, glassmorphism, and polish
   ============================================ */

/* ==================== PRELOADER ==================== */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #fdfbf7 0%, #f5f0e8 50%, #f8f4f0 100%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-logo {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
    opacity: 0;
    animation: preloaderFadeIn 1s ease 0.2s forwards;
}

.preloader-logo span {
    color: var(--accent-gold);
    font-style: italic;
}

.preloader-crystal {
    position: relative;
    width: 60px;
    height: 80px;
}

.crystal-shape {
    position: absolute;
    width: 100%;
    height: 100%;
    animation: crystalPulse 2s ease-in-out infinite;
}

.crystal-shape svg {
    width: 100%;
    height: 100%;
}

.crystal-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(212, 165, 116, 0.4) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    animation: glowPulse 2s ease-in-out infinite;
}

.preloader-text {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0;
    animation: preloaderFadeIn 1s ease 0.5s forwards;
}

.preloader-dots {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
}

.preloader-dots span {
    width: 4px;
    height: 4px;
    background: var(--accent-gold);
    border-radius: 50%;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.preloader-dots span:nth-child(2) { animation-delay: 0.2s; }
.preloader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes preloaderFadeIn {
    to { opacity: 1; }
}

@keyframes crystalPulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.05) rotate(2deg); }
}

@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ==================== CUSTOM CURSOR ==================== */
.cursor {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    mix-blend-mode: difference;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-gold);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease, width 0.3s ease, height 0.3s ease, background 0.3s ease;
}

.cursor-ring {
    width: 40px;
    height: 40px;
    border: 1px solid var(--accent-gold);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.15s ease-out, width 0.3s ease, height 0.3s ease, border-color 0.3s ease;
    opacity: 0.5;
}

/* Cursor states */
.cursor-hover .cursor-dot {
    transform: translate(-50%, -50%) scale(2);
    background: var(--accent-rose);
}

.cursor-hover .cursor-ring {
    transform: translate(-50%, -50%) scale(1.5);
    border-color: var(--accent-rose);
    opacity: 0.3;
}

.cursor-click .cursor-dot {
    transform: translate(-50%, -50%) scale(0.5);
}

.cursor-click .cursor-ring {
    transform: translate(-50%, -50%) scale(0.8);
}

/* Hide on touch devices */
@media (hover: none) and (pointer: coarse) {
    .cursor { display: none; }
}

/* ==================== BACK TO TOP BUTTON ==================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: white;
    border: 1px solid var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 20px rgba(45, 41, 38, 0.1);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(212, 165, 116, 0.3);
}

.back-to-top svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-secondary);
    transition: stroke 0.3s ease, transform 0.3s ease;
}

.back-to-top:hover svg {
    stroke: white;
    transform: translateY(-2px);
}

/* Progress ring around button */
.back-to-top-progress {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 56px;
    height: 56px;
}

.back-to-top-progress svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.back-to-top-progress circle {
    fill: none;
    stroke: var(--accent-gold);
    stroke-width: 2;
    stroke-dasharray: 164;
    stroke-dashoffset: 164;
    transition: stroke-dashoffset 0.1s linear;
}

/* ==================== SECTION SEPARATORS ==================== */
.section-separator {
    position: relative;
    height: 120px;
    overflow: hidden;
    pointer-events: none;
}

/* Wave separator */
.separator-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
}

.separator-wave svg {
    display: block;
    width: 100%;
    height: 80px;
}

.separator-wave path {
    fill: var(--bg-secondary);
}

.separator-wave.flip {
    top: 0;
    bottom: auto;
    transform: rotate(180deg);
}

.separator-wave.flip path {
    fill: var(--bg-primary);
}

/* Crystal separator */
.separator-crystal {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.separator-crystal-icon {
    position: relative;
}

.separator-crystal-icon svg {
    width: 40px;
    height: 50px;
    fill: none;
    stroke: var(--accent-gold);
    stroke-width: 1;
    opacity: 0.6;
}

.separator-crystal-line {
    position: absolute;
    top: 50%;
    width: 150px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    opacity: 0.3;
}

.separator-crystal-line.left {
    right: 100%;
    margin-right: 20px;
}

.separator-crystal-line.right {
    left: 100%;
    margin-left: 20px;
}

/* Dots separator */
.separator-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    height: 100%;
}

.separator-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-gold);
    border-radius: 50%;
    opacity: 0.4;
}

.separator-dot:nth-child(2) {
    width: 8px;
    height: 8px;
    opacity: 0.6;
}

.separator-dot:nth-child(3) {
    width: 10px;
    height: 10px;
    opacity: 1;
}

.separator-dot:nth-child(4) {
    width: 8px;
    height: 8px;
    opacity: 0.6;
}

.separator-dot:nth-child(5) {
    width: 6px;
    height: 6px;
    opacity: 0.4;
}

/* ==================== GLASSMORPHISM ==================== */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.glass-dark {
    background: rgba(45, 41, 38, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-gold {
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.1) 0%, rgba(232, 196, 184, 0.1) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 165, 116, 0.2);
}

/* Glass cards */
.pietra-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    position: relative;
    overflow: hidden;
}

.pietra-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
}

.pietra-card:hover::before {
    left: 100%;
}

/* Glass navigation */
.main-nav {
    background: rgba(253, 251, 247, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Glass chakra detail */
.chakra-detail {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Glass quiz container */
.quiz-content {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* ==================== ENHANCED BUTTONS ==================== */
.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-glow:hover::before {
    width: 300px;
    height: 300px;
}

/* Magnetic button effect */
.btn-magnetic {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: rippleEffect 0.6s linear;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ==================== ENHANCED HERO PARTICLES ==================== */
.particle {
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}

.particle-glow {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-gold);
    border-radius: 50%;
    box-shadow:
        0 0 10px var(--accent-gold),
        0 0 20px var(--accent-gold),
        0 0 30px rgba(212, 165, 116, 0.5);
    animation: particleGlow 3s ease-in-out infinite;
}

@keyframes particleGlow {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.5);
    }
}

/* Floating crystals in hero */
.hero-crystal {
    position: absolute;
    opacity: 0.15;
    animation: floatCrystal 8s ease-in-out infinite;
}

.hero-crystal:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.hero-crystal:nth-child(2) {
    top: 60%;
    right: 15%;
    animation-delay: 2s;
}

.hero-crystal:nth-child(3) {
    bottom: 20%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes floatCrystal {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* ==================== ENHANCED CHAKRA CAROUSEL ==================== */
.chakra-circle {
    position: relative;
    background: linear-gradient(135deg, white 0%, #f8f4f0 100%);
    box-shadow:
        0 4px 20px rgba(45, 41, 38, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.chakra-item.active .chakra-circle {
    box-shadow:
        0 8px 40px rgba(var(--chakra-color-rgb), 0.4),
        0 0 0 3px rgba(var(--chakra-color-rgb), 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Chakra glow ring */
.chakra-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.chakra-item.active .chakra-glow {
    opacity: 1;
    animation: chakraGlowPulse 2s ease-in-out infinite;
}

@keyframes chakraGlowPulse {
    0%, 100% {
        box-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        box-shadow: 0 0 30px currentColor, 0 0 60px currentColor;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Orbit path visualization */
.chakra-orbit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 50%;
    border: 1px dashed rgba(212, 165, 116, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* ==================== MICRO-INTERACTIONS ==================== */

/* Link underline animation */
.link-animated {
    position: relative;
    display: inline-block;
}

.link-animated::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.link-animated:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Icon bounce on hover */
.icon-bounce:hover svg {
    animation: iconBounce 0.4s ease;
}

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

/* Card tilt on hover */
.card-tilt {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.card-tilt:hover {
    transform: rotateX(2deg) rotateY(-2deg);
}

/* Input focus glow */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    box-shadow:
        0 0 0 3px rgba(212, 165, 116, 0.1),
        0 4px 20px rgba(212, 165, 116, 0.15);
}

/* Checkbox/Radio custom */
.custom-check {
    position: relative;
    padding-left: 30px;
    cursor: pointer;
}

.custom-check input {
    position: absolute;
    opacity: 0;
}

.custom-check .checkmark {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent-gold);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.custom-check input:checked ~ .checkmark {
    background: var(--accent-gold);
}

.custom-check .checkmark::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s ease;
}

.custom-check input:checked ~ .checkmark::after {
    transform: rotate(45deg) scale(1);
}

/* ==================== SMOOTH SCROLL ENHANCEMENTS ==================== */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Section reveal on scroll */
section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Skip initial animation for hero */
.hero {
    opacity: 1;
    transform: none;
}

/* ==================== LOADING STATES ==================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        var(--bg-accent) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==================== NOTIFICATION ENHANCEMENTS ==================== */
.notification {
    animation: notificationSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==================== SCROLL INDICATOR ENHANCEMENT ==================== */
.scroll-indicator {
    position: absolute;
    bottom: 2rem;
}

.scroll-arrow {
    position: relative;
}

.scroll-arrow::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    font-size: 0.7rem;
    color: var(--text-light);
    letter-spacing: 0.1em;
    white-space: nowrap;
    opacity: 0;
    animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* ==================== COLLECTION CARD ENHANCEMENTS ==================== */
.collezione-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.collezione-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow:
        0 20px 60px rgba(45, 41, 38, 0.15),
        0 0 0 1px rgba(212, 165, 116, 0.2);
}

.collezione-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-rose), var(--accent-sage));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.collezione-card:hover::after {
    opacity: 1;
}
