/* ===========================
   ULTIMATE PREMIUM FLIP CARDS
   World-Class Animation Design
   =========================== */

/* Speakers Grid */
.speakers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 40px;
    margin-bottom: 60px;
    padding: 20px;
}

/* ===========================
   FLIP CARD CONTAINER
   =========================== */
.speaker-flip-card {
    height: 480px;
    cursor: pointer;
    perspective: 2000px;
    position: relative;
}

/* Animated Glow Ring */
.speaker-flip-card::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, 
        #EB0028, #ff4444, #EB0028, #ff6666, 
        #EB0028, #ff4444, #EB0028);
    background-size: 400% 400%;
    border-radius: 24px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
    animation: glowRotate 4s linear infinite;
    filter: blur(8px);
}

.speaker-flip-card:hover::before {
    opacity: 0.7;
}

@keyframes glowRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Inner Container */
.speaker-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    border-radius: 20px;
}

/* Flip Animation */
.speaker-flip-card.flipped .speaker-flip-inner {
    transform: rotateY(180deg);
}

/* Front and Back Base */
.speaker-flip-front,
.speaker-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
}

/* ===========================
   FRONT FACE - SPECTACULAR
   =========================== */
.speaker-flip-front {
    background: #fff;
    z-index: 2;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.speaker-flip-card:hover .speaker-flip-front {
    box-shadow: 
        0 30px 80px rgba(235, 0, 40, 0.25),
        0 0 0 1px rgba(235, 0, 40, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Animated Top Border */
.speaker-flip-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #EB0028 20%, 
        #ff4444 50%, 
        #EB0028 80%, 
        transparent 100%);
    z-index: 100;
    transform: scaleX(0);
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.speaker-flip-card:hover .speaker-flip-front::before {
    transform: scaleX(1);
}

/* Corner Accent */
.speaker-flip-front::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, transparent 50%, rgba(235, 0, 40, 0.1) 50%);
    z-index: 5;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.speaker-flip-card:hover .speaker-flip-front::after {
    opacity: 1;
}

/* Speaker Image Container */
.speaker-flip-front .speaker-image {
    position: relative;
    width: 100%;
    height: 340px;
    overflow: hidden;
}

/* Image with Ken Burns Effect */
.speaker-flip-front .speaker-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                filter 0.5s ease;
    filter: brightness(1) saturate(1);
}

.speaker-flip-card:hover .speaker-flip-front .speaker-image img {
    transform: scale(1.12);
    filter: brightness(0.9) saturate(1.1);
}

/* Multi-Layer Overlay */
.speaker-flip-front .speaker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(to top, 
            rgba(0, 0, 0, 0.95) 0%, 
            rgba(0, 0, 0, 0.5) 30%,
            rgba(0, 0, 0, 0.1) 60%,
            transparent 100%),
        linear-gradient(135deg, 
            rgba(235, 0, 40, 0.1) 0%, 
            transparent 50%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 25px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.speaker-flip-card:hover .speaker-flip-front .speaker-overlay {
    opacity: 1;
}

/* Premium Click Hint Button */
.click-hint {
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    padding: 14px 30px;
    background: linear-gradient(135deg, #EB0028 0%, #ff3333 50%, #EB0028 100%);
    background-size: 200% 200%;
    border-radius: 50px;
    box-shadow: 
        0 10px 30px rgba(235, 0, 40, 0.5),
        0 0 20px rgba(235, 0, 40, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(30px) scale(0.9);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: btnPulse 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.click-hint::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
}

.speaker-flip-card:hover .click-hint {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.speaker-flip-card:hover .click-hint::before {
    left: 100%;
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 10px 30px rgba(235, 0, 40, 0.5), 0 0 20px rgba(235, 0, 40, 0.3); }
    50% { box-shadow: 0 10px 40px rgba(235, 0, 40, 0.7), 0 0 30px rgba(235, 0, 40, 0.5); }
}

/* Speaker Info Section */
.speaker-flip-front .speaker-info {
    padding: 25px 20px;
    text-align: center;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0a0a0a 100%);
    color: #fff;
    height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Animated Background Pattern */
.speaker-flip-front .speaker-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(235, 0, 40, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(235, 0, 40, 0.05) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.speaker-flip-card:hover .speaker-flip-front .speaker-info::before {
    opacity: 1;
}

.speaker-flip-front .speaker-info h3 {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 10px;
    color: #fff;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 2;
    transition: transform 0.4s ease, text-shadow 0.4s ease;
}

.speaker-flip-card:hover .speaker-flip-front .speaker-info h3 {
    transform: translateY(-2px);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.speaker-flip-front .speaker-info .speaker-title {
    font-size: 11px;
    color: #EB0028;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    z-index: 2;
    transition: color 0.4s ease, letter-spacing 0.4s ease;
}

.speaker-flip-card:hover .speaker-flip-front .speaker-info .speaker-title {
    color: #ff4444;
    letter-spacing: 3px;
}

/* ===========================
   BACK FACE - SPECTACULAR
   =========================== */
.speaker-flip-back {
    background: linear-gradient(160deg, 
        #EB0028 0%, 
        #c4001d 30%, 
        #8B0000 60%, 
        #5a0015 100%);
    transform: rotateY(180deg);
    z-index: 1;
    padding: 35px 30px;
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 25px 60px rgba(235, 0, 40, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

/* Animated Background Pattern */
.speaker-flip-back::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 0% 0%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(0,0,0,0.2) 0%, transparent 50%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
    animation: patternMove 20s linear infinite;
}

@keyframes patternMove {
    0% { background-position: 0 0, 100% 100%, 0 0; }
    100% { background-position: 0 0, 100% 100%, 60px 60px; }
}

/* Glowing Orb */
.speaker-flip-back::after {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    pointer-events: none;
    animation: orbFloat 6s ease-in-out infinite;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-20px, 20px); }
}

.back-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    color: #fff;
    position: relative;
    z-index: 2;
}

/* Speaker Name with Glow */
.back-content h3 {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 20px;
    padding-bottom: 18px;
    text-align: center;
    position: relative;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.back-content h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    border-radius: 2px;
    animation: lineGlow 2s ease-in-out infinite;
}

@keyframes lineGlow {
    0%, 100% { opacity: 0.5; width: 60px; }
    50% { opacity: 1; width: 100px; }
}

/* Bio Text */
.back-bio {
    font-size: 14px;
    line-height: 1.8;
    flex: 1;
    overflow-y: auto;
    padding-right: 12px;
    text-align: justify;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Custom Scrollbar */
.back-bio::-webkit-scrollbar {
    width: 6px;
}

.back-bio::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.back-bio::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0.3));
    border-radius: 3px;
    transition: background 0.3s ease;
}

.back-bio::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.5));
}

/* Premium Close Button */
.back-close {
    display: inline-block;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    padding: 14px 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    margin-top: 20px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.back-close::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    transform: translateX(-100%);
    transition: transform 0.4s ease;
    z-index: -1;
}

.back-close:hover {
    color: #EB0028;
    border-color: #fff;
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
}

.back-close:hover::before {
    transform: translateX(0);
}

/* ===========================
   HOVER LIFT EFFECT
   =========================== */
.speaker-flip-card:hover {
    z-index: 100;
}

.speaker-flip-card:not(.flipped):hover .speaker-flip-inner {
    transform: translateY(-12px) rotateX(5deg);
}

/* ===========================
   ENTRANCE ANIMATIONS
   =========================== */
.speaker-flip-card {
    opacity: 0;
    transform: translateY(50px) rotateX(-10deg);
    animation: cardEntrance 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.speaker-flip-card:nth-child(1) { animation-delay: 0.1s; }
.speaker-flip-card:nth-child(2) { animation-delay: 0.2s; }
.speaker-flip-card:nth-child(3) { animation-delay: 0.3s; }
.speaker-flip-card:nth-child(4) { animation-delay: 0.4s; }
.speaker-flip-card:nth-child(5) { animation-delay: 0.5s; }
.speaker-flip-card:nth-child(6) { animation-delay: 0.6s; }
.speaker-flip-card:nth-child(7) { animation-delay: 0.7s; }
.speaker-flip-card:nth-child(8) { animation-delay: 0.8s; }
.speaker-flip-card:nth-child(9) { animation-delay: 0.9s; }

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(50px) rotateX(-10deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */
@media (max-width: 1200px) {
    .speakers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .speakers-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
        padding: 10px;
    }
    
    .speaker-flip-card {
        height: 460px;
    }
    
    .speaker-flip-front .speaker-image {
        height: 320px;
    }
    
    .speaker-flip-front .speaker-info {
        height: 140px;
    }
    
    .speaker-flip-back {
        padding: 28px 25px;
    }
    
    .back-bio {
        font-size: 13px;
        line-height: 1.7;
    }
    
    .speaker-flip-card:not(.flipped):hover .speaker-flip-inner {
        transform: translateY(-8px);
    }
}

@media (max-width: 480px) {
    .speaker-flip-card {
        height: 440px;
    }
    
    .speaker-flip-front .speaker-image {
        height: 300px;
    }
    
    .speaker-flip-front .speaker-info {
        height: 140px;
        padding: 20px 15px;
    }
    
    .speaker-flip-front .speaker-info h3 {
        font-size: 20px;
    }
    
    .speaker-flip-back {
        padding: 25px 20px;
    }
    
    .back-content h3 {
        font-size: 22px;
    }
    
    .back-bio {
        font-size: 12px;
    }
    
    .click-hint {
        font-size: 10px;
        padding: 12px 22px;
        letter-spacing: 2px;
    }
    
    .back-close {
        padding: 12px 25px;
        font-size: 10px;
    }
}
