/**
 * BIFA+ Events Styles - Enhanced Design
 * Theme: Professional Blue with Gold & Silver Accents
 * "BRICS nations building bridges through football"
 */

/* ========================================
   CSS Variables & Theme
   ======================================== */
:root {
    /* BIFA+ Brand Colors */
    --bifa-primary-blue: #1e3a8a;
    --bifa-deep-blue: #1e40af;
    --bifa-light-blue: #3b82f6;
    --bifa-sky-blue: #60a5fa;
    --bifa-gold: #fbbf24;
    --bifa-gold-light: #fcd34d;
    --bifa-silver: #e5e7eb;
    --bifa-silver-dark: #9ca3af;
    
    /* Gradients */
    --bifa-gradient-main: linear-gradient(135deg, var(--bifa-primary-blue) 0%, var(--bifa-deep-blue) 100%);
    --bifa-gradient-gold: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --bifa-gradient-silver: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    
    /* Shadows */
    --bifa-shadow-sm: 0 2px 4px rgba(30, 58, 138, 0.1);
    --bifa-shadow-md: 0 4px 12px rgba(30, 58, 138, 0.15);
    --bifa-shadow-lg: 0 8px 24px rgba(30, 58, 138, 0.2);
    --bifa-shadow-xl: 0 16px 48px rgba(30, 58, 138, 0.25);
    
    /* Animations */
    --bifa-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --bifa-transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Main Container with Pattern Background
   ======================================== */
.bifa-events {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
    position: relative;
    background-color: #f8fafc;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(251, 191, 36, 0.03) 0%, transparent 50%);
}

.bifa-events::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, 
        var(--bifa-primary-blue) 0%, 
        var(--bifa-gold) 25%, 
        var(--bifa-primary-blue) 50%, 
        var(--bifa-gold) 75%, 
        var(--bifa-primary-blue) 100%);
    animation: shimmer 3s linear infinite;
}

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

/* ========================================
   Section Header (if needed)
   ======================================== */
.bifa-events-header {
    text-align: center;
    margin-bottom: 48px;
}

.bifa-events-title {
    font-size: 42px;
    font-weight: 800;
    color: var(--bifa-primary-blue);
    margin: 0 0 16px;
    position: relative;
    display: inline-block;
}

.bifa-events-subtitle {
    font-size: 18px;
    color: var(--bifa-silver-dark);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ========================================
   Enhanced Event Card
   ======================================== */
.bifa-event-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--bifa-shadow-md);
    transition: var(--bifa-transition);
    position: relative;
    height: 100%;
    border: 1px solid rgba(30, 58, 138, 0.08);
}

.bifa-event-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--bifa-gradient-main);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bifa-event-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--bifa-shadow-xl);
    border-color: var(--bifa-light-blue);
}

.bifa-event-card:hover::before {
    opacity: 1;
}

/* Urgent Card Special Style */
.bifa-event-card--urgent {
    border: 2px solid var(--bifa-gold);
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.bifa-event-card--urgent::after {
    content: '⚡';
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 24px;
    animation: pulse-gold 2s infinite;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
}

@keyframes pulse-gold {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* Image Container with Overlay */
.event-card-image {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: var(--bifa-gradient-main);
}

.event-card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        transparent 60%, 
        rgba(30, 58, 138, 0.8) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bifa-event-card:hover .event-card-image::after {
    opacity: 1;
}

.event-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.bifa-event-card:hover .event-card-image img {
    transform: scale(1.1) rotate(1deg);
}

/* Enhanced Badges */
.event-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: var(--bifa-gradient-main);
    color: white;
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 2;
    box-shadow: var(--bifa-shadow-md);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge-urgent {
    background: var(--bifa-gradient-gold);
    color: var(--bifa-primary-blue);
    animation: badge-glow 2s ease-in-out infinite;
}

@keyframes badge-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(251, 191, 36, 0.6); }
    50% { box-shadow: 0 0 30px rgba(251, 191, 36, 0.8); }
}

/* Content Area */
.event-card-content {
    padding: 28px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, white 0%, #f8fafc 100%);
}

.event-card-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 12px;
    color: var(--bifa-primary-blue);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.bifa-event-card:hover .event-card-title {
    color: var(--bifa-light-blue);
}

.event-card-excerpt {
    font-size: 15px;
    line-height: 1.6;
    color: #64748b;
    margin: 0 0 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Enhanced Meta Information */
.event-card-meta {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--bifa-silver);
}

.event-meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #64748b;
    transition: color 0.3s ease;
}

.event-meta-item:hover {
    color: var(--bifa-light-blue);
}

.meta-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--bifa-light-blue);
}

/* Country Flags with Glow */
.country-flag {
    font-size: 22px;
    margin-right: 6px;
    vertical-align: middle;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    animation: flag-wave 3s ease-in-out infinite;
}

@keyframes flag-wave {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* ========================================
   Grid Layout - Enhanced
   ======================================== */
.bifa-events--grid .events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 32px;
    margin: 0 auto;
}

/* ========================================
   List Layout - Enhanced
   ======================================== */
.bifa-events--list .events-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.bifa-events--list .bifa-event-card {
    display: flex;
    flex-direction: row;
    height: auto;
}

.bifa-events--list .event-card-image {
    width: 300px;
    height: 200px;
    flex-shrink: 0;
}

.bifa-events--list .event-card-link {
    flex-direction: row;
}

/* ========================================
   Carousel Layout - Enhanced
   ======================================== */
.bifa-events--carousel {
    position: relative;
    padding: 80px 0;
    overflow: hidden;
}

.bifa-events--carousel::before,
.bifa-events--carousel::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    z-index: 2;
    pointer-events: none;
}

.bifa-events--carousel::before {
    left: 0;
    background: linear-gradient(90deg, #f8fafc 0%, transparent 100%);
}

.bifa-events--carousel::after {
    right: 0;
    background: linear-gradient(90deg, transparent 0%, #f8fafc 100%);
}

.carousel-container {
    overflow: hidden;
    margin: 0 80px;
    position: relative;
}

.carousel-track {
    display: flex;
    gap: 28px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Navigation Buttons */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: white;
    border: 2px solid var(--bifa-light-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--bifa-transition);
    z-index: 3;
    box-shadow: var(--bifa-shadow-md);
}

.carousel-nav:hover {
    background: var(--bifa-gradient-main);
    border-color: var(--bifa-primary-blue);
    transform: translateY(-50%) scale(1.1);
    box-shadow: var(--bifa-shadow-lg);
}

.carousel-nav:hover svg {
    color: white;
}

.carousel-nav svg {
    width: 24px;
    height: 24px;
    color: var(--bifa-primary-blue);
    transition: color 0.3s ease;
}

/* Enhanced Dots */
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 40px;
}

.carousel-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bifa-silver);
    border: none;
    cursor: pointer;
    transition: var(--bifa-transition);
    position: relative;
}

.carousel-dots .dot:hover {
    background: var(--bifa-light-blue);
    transform: scale(1.2);
}

.carousel-dots .dot.active {
    background: var(--bifa-gradient-main);
    width: 32px;
    border-radius: 16px;
}

/* ========================================
   Calendar Layout - Enhanced
   ======================================== */
.bifa-events--calendar .events-calendar {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: var(--bifa-shadow-lg);
    padding: 40px;
    border: 1px solid rgba(30, 58, 138, 0.08);
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--bifa-silver);
}

.calendar-month {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: var(--bifa-primary-blue);
    display: flex;
    align-items: center;
    gap: 12px;
}

.calendar-month::before,
.calendar-month::after {
    content: '';
    width: 40px;
    height: 3px;
    background: var(--bifa-gradient-gold);
    border-radius: 2px;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 40px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--bifa-primary-blue);
    padding: 12px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #f8fafc;
    border-radius: 12px;
    transition: var(--bifa-transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.calendar-day:hover {
    background: white;
    border-color: var(--bifa-light-blue);
    transform: scale(1.05);
    box-shadow: var(--bifa-shadow-md);
}

.calendar-day.today {
    background: var(--bifa-gradient-main);
    color: white;
    font-weight: 700;
}

.calendar-day.has-events {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: var(--bifa-light-blue);
}

.event-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--bifa-gradient-gold);
    color: var(--bifa-primary-blue);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    box-shadow: var(--bifa-shadow-sm);
}

/* ========================================
   Empty State - Enhanced
   ======================================== */
.bifa-events__empty {
    text-align: center;
    padding: 80px 20px;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 32px;
    opacity: 0.2;
    color: var(--bifa-primary-blue);
    animation: float 3s ease-in-out infinite;
}

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

.empty-message {
    font-size: 24px;
    font-weight: 700;
    color: var(--bifa-primary-blue);
    margin: 0 0 12px;
}

.empty-hint {
    font-size: 16px;
    color: var(--bifa-silver-dark);
    margin: 0;
}

/* ========================================
   Loading State - Enhanced
   ======================================== */
.bifa-events-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bifa-silver);
    border-top-color: var(--bifa-primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   Animations - Enhanced
   ======================================== */
.bifa-event-card {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

.bifa-event-card:nth-child(1) { animation-delay: 0.1s; }
.bifa-event-card:nth-child(2) { animation-delay: 0.2s; }
.bifa-event-card:nth-child(3) { animation-delay: 0.3s; }
.bifa-event-card:nth-child(4) { animation-delay: 0.4s; }
.bifa-event-card:nth-child(5) { animation-delay: 0.5s; }
.bifa-event-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   BIFA+ Branding Elements
   ======================================== */
.bifa-branding {
    text-align: center;
    margin: 48px 0;
    padding: 32px;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.03) 0%, rgba(251, 191, 36, 0.03) 100%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.bifa-branding::before {
    content: '⚽';
    position: absolute;
    font-size: 120px;
    opacity: 0.05;
    top: -20px;
    right: -20px;
    transform: rotate(-15deg);
}

.bifa-tagline {
    font-size: 20px;
    font-weight: 600;
    color: var(--bifa-primary-blue);
    margin: 0 0 8px;
}

.bifa-subtitle {
    font-size: 16px;
    color: var(--bifa-silver-dark);
    font-style: italic;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .bifa-events--grid .events-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 767px) {
    .bifa-events {
        padding: 40px 16px;
    }
    
    .bifa-events--grid .events-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .bifa-events--list .event-card-image {
        width: 100%;
        height: 180px;
    }
    
    .bifa-events--list .bifa-event-card,
    .bifa-events--list .event-card-link {
        flex-direction: column;
    }
    
    .event-card-content {
        padding: 20px;
    }
    
    .event-card-title {
        font-size: 20px;
    }
    
    .carousel-container {
        margin: 0 50px;
    }
    
    .carousel-nav {
        width: 44px;
        height: 44px;
    }
    
    .bifa-events--carousel .bifa-event-card {
        flex: 0 0 280px;
        width: 280px;
    }
    
    .calendar-month {
        font-size: 22px;
    }
    
    .calendar-month::before,
    .calendar-month::after {
        display: none;
    }
}

/* ========================================
   Dark Mode Support
   ======================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --bifa-primary-blue: #3b82f6;
        --bifa-deep-blue: #2563eb;
        --bifa-light-blue: #60a5fa;
    }
    
    .bifa-events {
        background-color: #0f172a;
    }
    
    .bifa-event-card {
        background: #1e293b;
        border-color: rgba(59, 130, 246, 0.2);
    }
    
    .event-card-content {
        background: linear-gradient(to bottom, #1e293b 0%, #0f172a 100%);
    }
    
    .event-card-title {
        color: #e2e8f0;
    }
    
    .event-card-excerpt,
    .event-meta-item {
        color: #94a3b8;
    }
    
    .calendar-day {
        background: #1e293b;
    }
    
    .bifa-events--calendar .events-calendar {
        background: #1e293b;
        border-color: rgba(59, 130, 246, 0.2);
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .bifa-events {
        background: white;
    }
    
    .carousel-nav,
    .carousel-dots,
    .bifa-events-loading {
        display: none;
    }
    
    .bifa-event-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}