/* ==========================================
   ENHANCED UI/UX REFINEMENTS
   York Region Caring Lions Club
   ========================================== */

/* ==========================================
   1. ENHANCED BUTTON ANIMATIONS
   ========================================== */

/* Advanced button base with 3D effect */
.btn {
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Ripple effect on click */
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Shimmer effect on hover */
.btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 50%;
    height: 200%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: skewX(-20deg);
    transition: left 0.7s;
}

.btn:hover::after {
    left: 150%;
}

/* Primary button enhanced */
.btn-primary {
    box-shadow: 0 4px 15px rgba(255, 99, 71, 0.4);
    background: linear-gradient(135deg, var(--primary-color) 0%, #ff4025 100%);
}

.btn-primary:hover {
    box-shadow: 0 6px 25px rgba(255, 99, 71, 0.6);
    transform: translateY(-4px) scale(1.02);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
}

/* Secondary button enhanced */
.btn-secondary {
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, var(--secondary-color) 0%, #ffd000 100%);
}

.btn-secondary:hover {
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6);
    transform: translateY(-4px) scale(1.02);
}

/* Accent button enhanced */
.btn-accent {
    box-shadow: 0 4px 15px rgba(50, 205, 50, 0.4);
    background: linear-gradient(135deg, var(--accent-color) 0%, #2eb82e 100%);
}

.btn-accent:hover {
    box-shadow: 0 6px 25px rgba(50, 205, 50, 0.6);
    transform: translateY(-4px) scale(1.02);
}

/* Outline button enhanced */
.btn-outline {
    position: relative;
    overflow: hidden;
}

.btn-outline::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    transition: left 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: -1;
}

.btn-outline:hover::before {
    left: 0;
}

/* Pulse animation for donate buttons */
.btn-donate {
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 99, 71, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 99, 71, 0);
    }
}

/* ==========================================
   2. ENHANCED COLOR CONTRAST
   ========================================== */

/* Improved text contrast */
.hero {
    background: linear-gradient(135deg, #ff4025 0%, #ff8570 50%, var(--accent-color) 100%);
}

.hero-overlay {
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.1) 100%
    );
}

/* Enhanced footer contrast */
.footer {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.footer-text {
    color: rgba(255, 255, 255, 0.9);
}

/* Better card contrast */
.stat-card,
.program-card,
.event-card {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stat-card:hover,
.program-card:hover,
.event-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   3. ENHANCED TYPOGRAPHY
   ========================================== */

/* Improved heading hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-family: var(--font-heading);
}

.hero-title {
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.8),
        0 4px 8px rgba(0, 0, 0, 0.6),
        0 8px 16px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(0, 0, 0, 0.5);
    line-height: 1.1;
    font-weight: 900;
}

.section-title {
    position: relative;
    padding-bottom: calc(var(--grid-spacing) * 2);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

/* Better body text readability */
p {
    line-height: 1.8;
    font-size: 1.05rem;
}

/* Chinese text optimization */
body[data-lang="zh"] {
    letter-spacing: 0.03em;
}

body[data-lang="zh"] h1,
body[data-lang="zh"] h2,
body[data-lang="zh"] h3 {
    letter-spacing: 0.05em;
}

/* ==========================================
   4. MOBILE NAVIGATION ENHANCEMENTS
   ========================================== */

/* Better touch targets */
.bottom-nav-item {
    min-height: 56px;
    padding: calc(var(--grid-spacing) * 1.5);
    position: relative;
}

/* Active indicator animation */
.bottom-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 60%;
    height: 3px;
    background: var(--primary-color);
    border-radius: 0 0 3px 3px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bottom-nav-item.active::before,
.bottom-nav-item:active::before {
    transform: translateX(-50%) scaleX(1);
}

/* Haptic feedback effect */
.bottom-nav-item:active {
    transform: scale(0.95);
    transition: transform 0.1s;
}

/* Improved hamburger menu */
.nav-toggle {
    position: relative;
    width: 30px;
    height: 30px;
    cursor: pointer;
}

.nav-toggle span {
    position: absolute;
    left: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-toggle span:nth-child(1) {
    top: 0;
}

.nav-toggle span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.nav-toggle span:nth-child(3) {
    bottom: 0;
}

/* Animated X when open */
.nav-menu.active ~ .nav-toggle span:nth-child(1) {
    transform: rotate(45deg);
    top: 50%;
}

.nav-menu.active ~ .nav-toggle span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.nav-menu.active ~ .nav-toggle span:nth-child(3) {
    transform: rotate(-45deg);
    bottom: 50%;
}

/* ==========================================
   5. SCROLL ANIMATIONS
   ========================================== */

/* Fade in from bottom */
.scroll-animate {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animation delays */
.scroll-animate:nth-child(1) { transition-delay: 0.1s; }
.scroll-animate:nth-child(2) { transition-delay: 0.2s; }
.scroll-animate:nth-child(3) { transition-delay: 0.3s; }
.scroll-animate:nth-child(4) { transition-delay: 0.4s; }

/* Parallax effect for hero */
.hero-parallax {
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Scale on scroll */
.scale-on-scroll {
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scale-on-scroll.visible {
    transform: scale(1);
    opacity: 1;
}

/* ==========================================
   6. ENHANCED GALLERY LIGHTBOX
   ========================================== */

/* Smooth lightbox appearance */
.lightbox {
    backdrop-filter: blur(10px);
    animation: lightboxFadeIn 0.3s ease;
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.lightbox-content {
    animation: lightboxZoomIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes lightboxZoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-img {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

/* Gallery item hover effect */
.gallery-item {
    overflow: hidden;
    position: relative;
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 99, 71, 0.8) 0%,
        rgba(50, 205, 50, 0.8) 100%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.gallery-item:hover::before {
    opacity: 1;
}

.gallery-item::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 3rem;
    color: white;
    z-index: 2;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gallery-item:hover::after {
    transform: translate(-50%, -50%) scale(1);
}

.gallery-item img {
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* ==========================================
   7. ANIMATED COUNTERS
   ========================================== */

.stat-number {
    display: inline-block;
    transition: transform 0.3s ease;
}

.stat-card:hover .stat-number {
    transform: scale(1.1);
    color: var(--accent-color);
}

/* Counter animation preparation */
.stat-number[data-count] {
    opacity: 0;
    transform: translateY(20px);
}

.stat-number[data-count].counting {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================
   8. PAGE TRANSITIONS
   ========================================== */

/* Loading overlay */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.page-transition.active {
    opacity: 1;
    pointer-events: all;
}

.page-transition-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Page fade in */
body {
    animation: pageFadeIn 0.5s ease;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==========================================
   9. MICRO-INTERACTIONS
   ========================================== */

/* Form input focus effect */
input:focus,
textarea:focus,
select:focus {
    transform: scale(1.01);
    box-shadow: 0 4px 20px rgba(255, 99, 71, 0.2);
}

/* Card lift effect */
.stat-card,
.program-card,
.event-card,
.leader-card {
    transform-style: preserve-3d;
}

/* Icon bounce on hover */
.program-icon,
.stat-card i {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.program-card:hover .program-icon,
.stat-card:hover i {
    transform: translateY(-5px) scale(1.1);
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(-5px) scale(1.1); }
    50% { transform: translateY(-10px) scale(1.15); }
}

/* Link underline animation */
.footer-links a {
    position: relative;
}

.footer-links a::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary-color);
    transition: width 0.3s ease;
}

.footer-links a:hover::before {
    width: 100%;
}

/* ==========================================
   10. ACCESSIBILITY ENHANCEMENTS
   ========================================== */

/* Focus indicators */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Reduced motion support */
@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 */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .btn-primary {
        background: #cc0000;
    }
    
    .btn-secondary {
        background: #cc9900;
        color: #000;
    }
}