/* ==========================================
   PHONE SCREEN ANIMATIONS V2
   Compatible with existing HTML structure
   ========================================== */

/* === NOTIFICATION SCREEN ANIMATIONS === */

.notif-phone,
.notification-phone-screen {
    position: relative;
    overflow: hidden;
}

.notif-screen,
.notification-phone-screen {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
}

.notif-status-bar {
    padding: 8px 15px;
    display: flex;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.notif-date {
    text-align: center;
    color: rgba(255,255,255,0.6);
    font-size: 11px;
    padding: 15px 0 10px;
}

.notif-stack,
.notification-list {
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notif-stack .notif-item,
.notification-list .notif-item {
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    opacity: 0;
    transform: translateX(100px) scale(0.8);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Staggered notification animations */
.notif-stack .notif-item.notif-anim-1,
.notif-stack .notif-item:nth-child(1) {
    animation: notifSlideInNew 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.5s;
}

.notif-stack .notif-item.notif-anim-2,
.notif-stack .notif-item:nth-child(2) {
    animation: notifSlideInNew 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 1.5s;
}

.notif-stack .notif-item.notif-anim-3,
.notif-stack .notif-item:nth-child(3) {
    animation: notifSlideInNew 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 2.5s;
}

.notif-stack .notif-item:nth-child(4) {
    animation: notifSlideInNew 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 3.5s;
}

@keyframes notifSlideInNew {
    0% {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
    60% {
        opacity: 1;
        transform: translateX(-8px) scale(1.02);
    }
    80% {
        transform: translateX(4px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Notification item hover and glow */
.notif-stack .notif-item:hover {
    transform: scale(1.03) translateX(-5px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
}

.notif-item .notif-app-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

.notif-item .notif-app-icon.loyalty {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.notif-item .notif-app-icon.reminder {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.notif-item .notif-app-icon.order {
    background: linear-gradient(135deg, #10b981, #059669);
}

.notif-item .notif-content {
    flex: 1;
}

.notif-item .notif-content strong {
    font-size: 12px;
    font-weight: 600;
    color: #1f2937;
    display: block;
    margin-bottom: 2px;
}

.notif-item .notif-content p {
    font-size: 11px;
    color: #4b5563;
    margin: 0;
    line-height: 1.3;
}

/* Notification highlights animation */
.notif-highlights {
    margin-top: 20px;
}

.notif-highlight {
    opacity: 0;
    transform: translateY(20px);
    animation: highlightFadeIn 0.5s ease forwards;
}

.notif-highlight:nth-child(1) { animation-delay: 3.5s; }
.notif-highlight:nth-child(2) { animation-delay: 3.8s; }
.notif-highlight:nth-child(3) { animation-delay: 4.1s; }

@keyframes highlightFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.highlight-icon {
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* === LOYALTY CARD ANIMATIONS === */

.loyalty-card-demo,
.loyalty-main-card {
    position: relative;
    overflow: hidden;
    animation: cardFloat 4s ease-in-out infinite;
}

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

/* Card shine effect */
.loyalty-card-demo::before,
.loyalty-main-card::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: linear-gradient(
        135deg,
        transparent 0%,
        transparent 40%,
        rgba(255,255,255,0.15) 50%,
        transparent 60%,
        transparent 100%
    );
    animation: cardShineMove 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes cardShineMove {
    0% { transform: translateX(-50%) translateY(-50%) rotate(45deg); }
    100% { transform: translateX(50%) translateY(50%) rotate(45deg); }
}

/* Loyalty stars animation */
.loyalty-stars i,
.loyalty-stamps .stamp {
    opacity: 0;
    transform: scale(0);
}

.loyalty-stars i:nth-child(1),
.loyalty-stamps .stamp:nth-child(1) {
    animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.5s;
}

.loyalty-stars i:nth-child(2),
.loyalty-stamps .stamp:nth-child(2) {
    animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.8s;
}

.loyalty-stars i:nth-child(3),
.loyalty-stamps .stamp:nth-child(3) {
    animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 1.1s;
}

.loyalty-stars i:nth-child(4),
.loyalty-stamps .stamp:nth-child(4) {
    animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 1.4s;
}

.loyalty-stars i:nth-child(5),
.loyalty-stamps .stamp:nth-child(5) {
    animation: starPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 1.7s;
}

@keyframes starPop {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    60% {
        transform: scale(1.3) rotate(10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

/* Loyalty points counter */
.loyalty-points .points-number,
.loyalty-points-display .points-count {
    display: inline-block;
    animation: pointsGlow 2s ease-in-out infinite;
}

@keyframes pointsGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(255,255,255,0.3);
    }
    50% {
        text-shadow: 0 0 20px rgba(255,255,255,0.6), 0 0 30px rgba(139, 92, 246, 0.4);
    }
}

/* Loyalty progress bar */
.loyalty-progress .progress-fill,
.loyalty-progress-fill {
    position: relative;
    animation: progressGrow 2s ease-out forwards;
    animation-delay: 2s;
    
}

.loyalty-progress .progress-fill.animated,
.loyalty-progress-fill.animated {
    width: 75% !important;
}

@keyframes progressGrow {
    to { width: 75%; }
}

.loyalty-progress .progress-fill::after,
.loyalty-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: progressShimmer 1.5s ease-in-out infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Next reward badge */
.loyalty-next-reward,
.loyalty-reward-banner {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    animation: rewardBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 3s;
}

@keyframes rewardBounce {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === E-COMMERCE CART ANIMATIONS === */

.cart-demo,
.cart-phone-screen {
    background: #f8fafc;
}

.cart-items .product-item,
.cart-items .cart-item {
    opacity: 0;
    transform: translateX(-50px);
}

.cart-items .product-item:nth-child(1),
.cart-items .cart-item:nth-child(1) {
    animation: cartItemSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.5s;
}

.cart-items .product-item:nth-child(2),
.cart-items .cart-item:nth-child(2) {
    animation: cartItemSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 1s;
}

.cart-items .product-item:nth-child(3),
.cart-items .cart-item:nth-child(3) {
    animation: cartItemSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 1.5s;
}

@keyframes cartItemSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-50px);
    }
    60% {
        transform: translateX(10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Cart item hover */
.product-item:hover,
.cart-item:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

/* Cart total animation */
.cart-total .total-price,
.cart-total-amount {
    animation: priceCountUp 0.5s ease-out;
}

@keyframes priceCountUp {
    0% { transform: scale(1.2); color: #10b981; }
    100% { transform: scale(1); }
}

/* Order button animation */
.cart-button,
.cart-checkout-btn {
    position: relative;
    overflow: hidden;
    animation: buttonPulse 2s ease-in-out infinite;
    animation-delay: 2s;
}

@keyframes buttonPulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
    50% { box-shadow: 0 4px 25px rgba(139, 92, 246, 0.6); }
}

.cart-button::before,
.cart-checkout-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: buttonShine 3s ease-in-out infinite;
}

@keyframes buttonShine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

/* === VISIBILITY/SEARCH ANIMATIONS === */

.visibility-phone,
.visibility-phone-screen {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
}

/* Typing animation for search */
.search-input,
.visibility-search-bar input {
    animation: typingCursor 1s step-end infinite;
}

@keyframes typingCursor {
    0%, 100% { border-right: 2px solid transparent; }
    50% { border-right: 2px solid #8b5cf6; }
}

/* Search results */
.search-result,
.search-result-item {
    opacity: 0;
    transform: translateY(30px);
}

.search-result:nth-child(1),
.search-result-item:nth-child(1) {
    animation: resultFadeIn 0.5s ease forwards;
    animation-delay: 2s;
}

.search-result:nth-child(2),
.search-result-item:nth-child(2) {
    animation: resultFadeIn 0.5s ease forwards;
    animation-delay: 2.3s;
}

.search-result:nth-child(3),
.search-result-item:nth-child(3) {
    animation: resultFadeIn 0.5s ease forwards;
    animation-delay: 2.6s;
}

@keyframes resultFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Featured result highlight */
.search-result.featured,
.search-result-item.featured {
    animation: resultFadeIn 0.5s ease forwards, featuredGlow 2s ease-in-out infinite 2.5s;
}

@keyframes featuredGlow {
    0%, 100% { box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.5); }
    50% { box-shadow: 0 0 20px 2px rgba(139, 92, 246, 0.8); }
}

/* === HERO PHONE ANIMATIONS === */

.hero-phone .phone-screen,
.hero-visual .phone-screen {
    position: relative;
}

/* Floating notifications in hero */
.floating-notif {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
}

.floating-notif.floating-1 {
    animation: floatNotif 0.6s ease forwards 1s, floatHover 3s ease-in-out infinite 1.6s;
}

.floating-notif.floating-2 {
    animation: floatNotif 0.6s ease forwards 1.5s, floatHover 3s ease-in-out infinite 2.1s;
}

.floating-notif.floating-3 {
    animation: floatNotif 0.6s ease forwards 2s, floatHover 3s ease-in-out infinite 2.6s;
}

@keyframes floatNotif {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

/* App cards in hero phone */
.app-cards .app-card {
    opacity: 0;
    transform: scale(0.5);
}

.app-cards .app-card:nth-child(1) {
    animation: appCardPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.5s;
}

.app-cards .app-card:nth-child(2) {
    animation: appCardPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.7s;
}

.app-cards .app-card:nth-child(3) {
    animation: appCardPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.9s;
}

.app-cards .app-card:nth-child(4) {
    animation: appCardPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 1.1s;
}

@keyframes appCardPop {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Order confirmed animation */
.app-order-confirmed {
    opacity: 0;
    transform: scale(0.5);
    animation: orderConfirmed 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 2s;
}

@keyframes orderConfirmed {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.app-order-confirmed i {
    animation: checkBounce 0.6s ease 2.3s;
}

@keyframes checkBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* === COMPARISON BARS ANIMATION === */

.comparison-bars .bar-fill {
    
    animation: barGrow 1s ease-out forwards;
    animation-delay: 0.5s;
}

.comparison-bars .comparison-bar:nth-child(1) .bar-fill {
    animation-delay: 0.5s;
}

.comparison-bars .comparison-bar:nth-child(2) .bar-fill {
    animation-delay: 0.8s;
}

.comparison-bars .bar-fill[style*="20%"] {
    animation: barGrow20 1s ease-out forwards;
}

.comparison-bars .bar-fill[style*="90%"],
.comparison-bars .bar-fill.push {
    animation: barGrow90 1s ease-out forwards;
}

@keyframes barGrow20 {
    to { width: 20%; }
}

@keyframes barGrow90 {
    to { width: 90%; }
}

/* === iOS APP GRID ANIMATIONS === */

.ios-apps-grid .ios-app {
    opacity: 0;
    transform: scale(0.5);
}

.ios-apps-grid .ios-app:nth-child(1) { animation: iosAppPop 0.4s ease forwards 0.3s; }
.ios-apps-grid .ios-app:nth-child(2) { animation: iosAppPop 0.4s ease forwards 0.5s; }
.ios-apps-grid .ios-app:nth-child(3) { animation: iosAppPop 0.4s ease forwards 0.7s; }
.ios-apps-grid .ios-app:nth-child(4) { animation: iosAppPop 0.4s ease forwards 0.9s; }

@keyframes iosAppPop {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Your app highlight */
.ios-app.your-app {
    animation: iosAppPop 0.4s ease forwards 0.9s, yourAppGlow 2s ease-in-out infinite 1.5s;
}

@keyframes yourAppGlow {
    0%, 100% {
        box-shadow: 0 0 0 transparent;
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
        transform: scale(1.05);
    }
}

/* Notification badge bounce */
.app-notification-badge {
    animation: badgeBounce 0.5s ease forwards 1.2s, badgePulse 2s ease-in-out infinite 1.7s;
    transform: scale(0);
}

@keyframes badgeBounce {
    0% { transform: scale(0); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* === SCROLL TRIGGER RESET === */
/* Animations restart when element comes into view */

.scroll-reveal .notif-item,
.scroll-reveal .product-item,
.scroll-reveal .cart-item,
.scroll-reveal .loyalty-stars i,
.scroll-reveal .search-result-item {
    animation-play-state: paused;
}

.scroll-reveal.visible .notif-item,
.scroll-reveal.visible .product-item,
.scroll-reveal.visible .cart-item,
.scroll-reveal.visible .loyalty-stars i,
.scroll-reveal.visible .search-result-item {
    animation-play-state: running;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .notif-stack {
        padding: 8px 10px;
    }

    .notif-item {
        padding: 10px;
    }

    .loyalty-card-demo {
        padding: 15px;
    }
}

/* === REDUCE MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* FIX: Ensure titles are always visible */
h1, h2, h3, .hero-title, .feature-title, .section-title, .comparison-title {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
}


/* === ENSURE ALL TEXT IS READABLE === */

/* Section titles always visible */
.section-title,
.section-subtitle,
.feature-title,
.comparison-title,
.pricing-name,
.portfolio-title,
h1, h2, h3, h4 {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Tech stats section - white text */
.tech-stats-section .section-title,
.tech-stats-section .section-subtitle,
.tech-stats-section .tech-stat-number,
.tech-stats-section .tech-stat-label {
    color: white !important;
}

/* Stat cards text */
.stat-card,
.tech-stat-card {
    color: white;
}

/* Feature sections text */
.feature-description,
.feature-list li {
    opacity: 1 !important;
    color: var(--gray-600);
}

/* Contact section */
.contact-section .section-title,
.contact-section .section-subtitle {
    color: var(--dark) !important;
}

/* Portfolio section */
.portfolio-section .section-title,
.portfolio-section .section-subtitle {
    color: var(--dark) !important;
}

/* Comparison section on white background */
.comparatif-section .section-title,
.comparatif-section .section-subtitle {
    color: var(--dark) !important;
}

/* Pricing sections */
.pricing-section .section-title,
.pricing-section .section-subtitle {
    color: white !important;
}

/* FINAL FIX: Feature titles must be dark on light backgrounds */
.feature-title,
.feature-title span:not(.highlight) {
    color: #0f172a !important;
}

.feature-list li strong {
    color: #0f172a !important;
}
