/**
 * Vibe Awards - Apple Magic
 * The secret sauce that makes interfaces feel magical
 */

/* === APPLE MAGIC FOUNDATION === */

:root {
    /* Apple's Magic Numbers - Based on actual Apple design specs */
    --magic-timing-swift: cubic-bezier(0.4, 0.0, 0.2, 1.0);
    --magic-timing-ease: cubic-bezier(0.25, 0.1, 0.25, 1.0);
    --magic-timing-bounce: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --magic-timing-gentle: cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Magical Shadows - Apple's layered shadow system */
    --magic-shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --magic-shadow-medium: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
    --magic-shadow-strong: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
    --magic-shadow-hero: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
    --magic-shadow-glow: 0 0 20px rgba(0, 113, 227, 0.5), 0 0 40px rgba(0, 113, 227, 0.3);
    
    /* Magical Blurs - Apple's signature depth effects */
    --magic-blur-backdrop: saturate(180%) blur(20px);
    --magic-blur-content: blur(0.5px);
    --magic-blur-heavy: saturate(200%) blur(40px);
    
    /* Magical Curves - Apple's corner radius system */
    --magic-radius-tight: 4px;
    --magic-radius-base: 8px;
    --magic-radius-comfortable: 12px;
    --magic-radius-spacious: 16px;
    --magic-radius-hero: 24px;
    --magic-radius-pill: 50px;
    
    /* Magical Spacing - Apple's 8pt grid system */
    --magic-space-nano: 2px;
    --magic-space-micro: 4px;
    --magic-space-tiny: 8px;
    --magic-space-small: 12px;
    --magic-space-base: 16px;
    --magic-space-medium: 24px;
    --magic-space-large: 32px;
    --magic-space-xl: 48px;
    --magic-space-2xl: 64px;
    --magic-space-3xl: 96px;
    
    /* Magical Materials - Apple's material system */
    --magic-material-thin: rgba(255, 255, 255, 0.03);
    --magic-material-ultra-thin: rgba(255, 255, 255, 0.05);
    --magic-material-thick: rgba(255, 255, 255, 0.08);
    --magic-material-regular: rgba(255, 255, 255, 0.06);
    
    /* Magical Elevations */
    --magic-elevation-0: 0;
    --magic-elevation-1: 1px;
    --magic-elevation-2: 2px;
    --magic-elevation-4: 4px;
    --magic-elevation-8: 8px;
    --magic-elevation-16: 16px;
}

/* === APPLE'S SIGNATURE ANIMATIONS === */

/* The famous spring animation that Apple uses everywhere */
@keyframes magicSpring {
    0% { 
        transform: scale(0.95) translateY(10px);
        opacity: 0;
    }
    60% {
        transform: scale(1.02) translateY(-2px);
        opacity: 0.9;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Apple's signature fade-in animation */
@keyframes magicFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
        filter: blur(1px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Apple's elastic bounce */
@keyframes magicBounce {
    0% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.1); }
    70% { transform: scale(1); }
}

/* Apple's signature floating animation */
@keyframes magicFloat {
    0%, 100% { 
        transform: translateY(0) rotate(0deg);
        filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
    }
    50% { 
        transform: translateY(-8px) rotate(1deg);
        filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.2));
    }
}

/* Apple's magical glow pulse */
@keyframes magicGlow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(0, 113, 227, 0.3);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 40px rgba(0, 113, 227, 0.6), 0 0 60px rgba(0, 113, 227, 0.4);
        transform: scale(1.02);
    }
}

/* Apple's breathing animation for idle states */
@keyframes magicBreathe {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.01);
        opacity: 0.95;
    }
}

/* Enhanced ripple animation */
@keyframes magicRipple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* Apple's signature slide-in animation */
@keyframes magicSlideIn {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Apple's scale bounce animation */
@keyframes magicScaleBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* === MAGICAL GLASS MORPHISM === */

.magic-glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: var(--magic-blur-backdrop);
    -webkit-backdrop-filter: var(--magic-blur-backdrop);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--magic-radius-spacious);
    position: relative;
    overflow: hidden;
}

.magic-glass::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
}

.magic-glass::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.2) 50%, 
        transparent 100%);
}

/* Enhanced glass with inner glow */
.magic-glass-premium {
    @extend .magic-glass;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05),
        var(--magic-shadow-medium);
}

/* === MAGICAL BUTTONS === */

.magic-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--magic-radius-comfortable);
    font-weight: 600;
    font-size: 16px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s var(--magic-timing-swift);
    transform-origin: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}

.magic-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        transparent 50%, 
        rgba(0, 0, 0, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s var(--magic-timing-swift);
}

.magic-btn:hover::before {
    opacity: 1;
}

/* Primary Magic Button */
.magic-btn-primary {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    color: white;
    box-shadow: var(--magic-shadow-medium);
}

.magic-btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--magic-shadow-strong), var(--magic-shadow-glow);
}

.magic-btn-primary:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s var(--magic-timing-swift);
}

/* Ghost Magic Button */
.magic-btn-ghost {
    background: var(--magic-material-thin);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: var(--magic-blur-backdrop);
}

.magic-btn-ghost:hover {
    background: var(--magic-material-thick);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: var(--magic-shadow-soft);
}

/* === MAGICAL CARDS === */

.magic-card {
    background: var(--magic-material-regular);
    backdrop-filter: var(--magic-blur-backdrop);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--magic-radius-spacious);
    padding: var(--magic-space-medium);
    position: relative;
    overflow: hidden;
    transition: all 0.4s var(--magic-timing-gentle);
    cursor: pointer;
    transform-origin: center;
}

.magic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 100%);
}

.magic-card:hover {
    transform: translateY(-8px) scale(1.02);
    background: var(--magic-material-thick);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: var(--magic-shadow-hero);
}

.magic-card:hover::before {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.5) 50%, 
        transparent 100%);
}

.magic-card:active {
    transform: translateY(-4px) scale(1.01);
    transition: all 0.1s var(--magic-timing-swift);
}

/* Premium magic card with inner shadows */
.magic-card-premium {
    @extend .magic-card;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1),
        var(--magic-shadow-medium);
}

.magic-card-premium:hover {
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05),
        var(--magic-shadow-hero),
        0 0 40px rgba(0, 113, 227, 0.3);
}

/* === MAGICAL INPUTS === */

.magic-input {
    width: 100%;
    padding: 16px 20px;
    background: var(--magic-material-thin);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--magic-radius-comfortable);
    color: rgba(255, 255, 255, 0.95);
    font-size: 16px;
    font-weight: 400;
    transition: all 0.3s var(--magic-timing-swift);
    backdrop-filter: var(--magic-blur-backdrop);
    position: relative;
}

.magic-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s var(--magic-timing-swift);
}

.magic-input:focus {
    outline: none;
    background: var(--magic-material-thick);
    border-color: #007AFF;
    box-shadow: 
        0 0 0 3px rgba(0, 122, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        var(--magic-shadow-soft);
    transform: scale(1.02);
}

.magic-input:focus::placeholder {
    color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

/* === MAGICAL NAVIGATION === */

.magic-nav {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: var(--magic-blur-backdrop);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.magic-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.2) 50%, 
        transparent 100%);
}

.magic-nav-item {
    position: relative;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: var(--magic-radius-base);
    transition: all 0.3s var(--magic-timing-swift);
    cursor: pointer;
}

.magic-nav-item:hover {
    color: white;
    background: var(--magic-material-thin);
    transform: translateY(-1px);
}

.magic-nav-item:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s var(--magic-timing-swift);
}

/* === MAGICAL DROPDOWNS === */

.magic-dropdown {
    position: relative;
}

.magic-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px) scale(0.95);
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: var(--magic-blur-heavy);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--magic-radius-spacious);
    padding: 8px;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s var(--magic-timing-gentle);
    box-shadow: var(--magic-shadow-hero);
    z-index: 1000;
}

.magic-dropdown:hover .magic-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.magic-dropdown-item {
    display: block;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: var(--magic-radius-base);
    transition: all 0.2s var(--magic-timing-swift);
    position: relative;
    overflow: hidden;
}

.magic-dropdown-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.1) 50%, 
        transparent 100%);
    transition: left 0.3s var(--magic-timing-swift);
}

.magic-dropdown-item:hover {
    color: white;
    background: var(--magic-material-thin);
    transform: translateX(4px);
}

.magic-dropdown-item:hover::before {
    left: 100%;
}

/* === MAGICAL SCROLLBARS === */

/* Webkit browsers */
.magic-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.magic-scroll::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.magic-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    transition: background 0.3s var(--magic-timing-swift);
}

.magic-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Firefox */
.magic-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* === MAGICAL LOADING STATES === */

.magic-loading {
    position: relative;
    overflow: hidden;
}

.magic-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.2) 50%, 
        transparent 100%);
    animation: magicShimmer 2s infinite;
}

@keyframes magicShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.magic-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: magicSpin 1s linear infinite;
}

@keyframes magicSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === MAGICAL FOCUS STATES === */

.magic-focus-ring:focus {
    outline: none;
    box-shadow: 
        0 0 0 3px rgba(0, 122, 255, 0.3),
        0 0 0 6px rgba(0, 122, 255, 0.1);
    border-color: #007AFF;
}

/* === MAGICAL ANIMATIONS === */

.magic-fade-in {
    animation: magicFadeIn 0.6s var(--magic-timing-gentle) forwards;
}

.magic-spring {
    animation: magicSpring 0.8s var(--magic-timing-bounce) forwards;
}

.magic-float {
    animation: magicFloat 6s ease-in-out infinite;
}

.magic-glow {
    animation: magicGlow 2s ease-in-out infinite;
}

/* Staggered animations */
.magic-stagger-1 { animation-delay: 0.1s; }
.magic-stagger-2 { animation-delay: 0.2s; }
.magic-stagger-3 { animation-delay: 0.3s; }
.magic-stagger-4 { animation-delay: 0.4s; }
.magic-stagger-5 { animation-delay: 0.5s; }

/* === MAGICAL BACKGROUNDS === */

.magic-gradient-mesh {
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%),
        linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    background-size: 400% 400%;
    animation: magicMeshShift 20s ease infinite;
}

@keyframes magicMeshShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* === MAGICAL UTILITIES === */

.magic-transform-gpu {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

.magic-smooth-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.magic-no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.magic-preserve-3d {
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

/* === RESPONSIVE MAGIC === */

@media (max-width: 768px) {
    .magic-card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .magic-btn:hover {
        transform: translateY(-1px) scale(1.01);
    }
    
    /* Reduce motion on mobile for better performance */
    .magic-float {
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .magic-fade-in,
    .magic-spring,
    .magic-float,
    .magic-glow {
        animation: none;
    }
    
    .magic-card:hover,
    .magic-btn:hover {
        transform: none;
    }
}

/* === MAGICAL DARK MODE === */

@media (prefers-color-scheme: dark) {
    :root {
        --magic-material-thin: rgba(255, 255, 255, 0.05);
        --magic-material-thick: rgba(255, 255, 255, 0.1);
    }
}

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

@media print {
    .magic-glass,
    .magic-card,
    .magic-btn {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
    }
}