/* Journey Storytelling - Optimized Styles */

/* MUCH STRONGER blur for inactive messages */
.blurred-message {
    opacity: 0.45 !important;
    filter: blur(2px) grayscale(30%);
    transform: scale(0.99);
    transition: all 0.4s ease;
    pointer-events: none;
}

/* Active step - MUCH more prominent */
.journey-step {
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    cursor: pointer;
}

.journey-step:hover {
    transform: translateX(4px);
    border-left-color: #10b981;
}

.journey-step:hover::after {
    content: '👆 Click to explore';
    position: absolute;
    right: -140px;
    top: 50%;
    transform: translateY(-50%);
    background: #10b981;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    animation: tooltipBounce 0.6s ease;
}

@keyframes tooltipBounce {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.05); }
}

.journey-step.step-active {
    border-left-color: #10b981 !important;
    border-left-width: 5px;
    transform: translateX(8px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.18);
    background: linear-gradient(to right, rgba(16, 185, 129, 0.1), transparent);
    z-index: 10;
}

.journey-step.step-active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.6);
}

@keyframes pulseActive {
    0%, 100% {
        box-shadow: 0 0 0 3px #10b981, 0 6px 20px rgba(16, 185, 129, 0.5);
        transform: translateY(-50%) scale(1);
    }
    50% {
        box-shadow: 0 0 0 6px #10b981, 0 8px 30px rgba(16, 185, 129, 0.7);
        transform: translateY(-50%) scale(1.1);
    }
}

@keyframes rotate {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Completed steps - collapsed */
.journey-step.step-completed {
    opacity: 0.78;
    transform: translateX(4px);
    border-left-color: #10b981 !important;
    cursor: pointer;
    transition: all 0.4s ease;
}

.journey-step.step-completed:hover {
    opacity: 0.92;
    transform: translateX(8px);
}

.journey-step.step-completed::before {
    content: '✓';
    position: absolute;
    left: -14px;
    top: 18px;
    width: 22px;
    height: 22px;
    background: #10b981;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: bold;
}

.journey-step.step-completed::after {
    content: '';
}

/* Floating progress bar */
#journey-progress-bar {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 100;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 2px solid #10b981;
    min-width: 200px;
    opacity: 0;
    transform: translateX(300px);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#journey-progress-bar.visible {
    opacity: 1;
    transform: translateX(0);
}

.progress-dots {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d1d5db;
    transition: all 0.4s ease;
}

.progress-dot.completed {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.progress-dot.active {
    background: #10b981;
    transform: scale(1.4);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.7);
    animation: dotPulse 1.5s infinite;
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1.4); }
    50% { transform: scale(1.6); }
}

/* Chat message animations */
.chat-message {
    transition: all 0.6s ease;
}

.chat-message-new {
    animation: slideInMessage 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Button interactions */
.btn-glow {
    animation: buttonGlow 1.5s infinite;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
}

@keyframes buttonGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.6); }
    50% { box-shadow: 0 0 30px rgba(16, 185, 129, 0.9), 0 0 40px rgba(16, 185, 129, 0.6); }
}

.btn-clicked {
    animation: buttonClick 0.6s ease;
}

@keyframes buttonClick {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.btn-success {
    background: #10b981 !important;
    color: white !important;
    pointer-events: none;
}

/* Match percentage circle */
.match-percentage-circle {
    position: relative;
    width: 50px;
    height: 50px;
}

/* University card enhancements */
.university-card-enhanced {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.university-card-enhanced:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.2);
}

.university-card-enhanced .apply-btn {
    transition: all 0.3s ease;
}

/* Document item animations */
.document-item {
    transition: all 0.4s ease;
}

.document-item:hover {
    border-color: #60a5fa;
    background: #eff6ff;
    transform: translateX(4px);
}

.document-item.uploading {
    background: #eff6ff;
    border-color: #3b82f6;
    animation: uploadPulse 1.5s infinite;
}

.document-item.uploaded {
    background: #f0fdf4;
    border-color: #10b981;
    animation: uploadSuccess 0.6s ease;
}

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

@keyframes uploadSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Smooth scrolling for chat container */
#chat-messages {
    scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
    width: 8px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #10b981, #059669);
    border-radius: 4px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #059669, #047857);
}

/* Profile card progress animation */
.profile-progress {
    transition: width 2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Typing indicator enhancement */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--light-blue);
    border-radius: 1rem;
    margin: 0.5rem 0;
    animation: typingBounce 0.6s ease;
}

@keyframes typingBounce {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-blue);
    margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing {
    0%, 80%, 100% { 
        transform: scale(0); 
        opacity: 0.5; 
    }
    40% { 
        transform: scale(1.2); 
        opacity: 1; 
    }
}

/* Mobile responsive adjustments */
@media (max-width: 1024px) {
    .journey-step.step-active {
        transform: scale(1.05) translateX(4px);
    }
    
    .blurred-message {
        opacity: 0.2 !important;
        filter: blur(4px) grayscale(50%);
    }
    
    .journey-step:hover::after {
        display: none;
    }
    
    #journey-progress-bar {
        top: 60px;
        right: 10px;
        padding: 0.75rem 1rem;
        min-width: 150px;
    }
}

/* Mobile Floating Navigation */
#mobile-floating-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 12px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 90vw;
}

#mobile-floating-nav.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.mobile-nav-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.mobile-nav-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mobile-nav-dot {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
    /* Increase touch target for mobile */
    min-width: 44px;
    min-height: 44px;
}

.mobile-nav-dot:hover {
    transform: scale(1.1);
    background: #d1d5db;
}

.mobile-nav-dot.active {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    animation: mobileNavPulse 2s infinite;
}

.mobile-nav-dot.completed {
    background: #10b981;
    border-color: #10b981;
}

.mobile-nav-dot.completed::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.mobile-nav-number {
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
}

.mobile-nav-dot.active .mobile-nav-number,
.mobile-nav-dot.completed .mobile-nav-number {
    color: white;
}

.mobile-nav-label {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
}

@keyframes mobileNavPulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.6);
        transform: scale(1.05);
    }
}

@media (max-width: 768px) {
    .journey-step {
        margin-bottom: 1rem;
    }
    
    .journey-step.step-active::before {
        left: -10px;
        width: 20px;
        height: 20px;
    }
    
    .journey-step.step-completed::before {
        left: -10px;
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    #journey-progress-bar {
        position: relative;
        top: 0;
        right: 0;
        margin: 1rem auto;
        max-width: 300px;
    }
    
    /* Show mobile nav only on mobile */
    #mobile-floating-nav {
        display: block;
    }
}

@media (min-width: 769px) {
    /* Hide mobile nav on desktop */
    #mobile-floating-nav {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* FIXED: Static chat window (like WhatsApp) - no scrolling on outer container */
    #story-chat {
        position: static !important;
        height: 600px !important;  /* Fixed height like WhatsApp screenshot */
        max-height: 600px !important;
        overflow: hidden !important;  /* No scrolling on the window itself */
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* FIXED: Only messages scroll inside the static window */
    #chat-messages {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex: 1 !important;  /* Take available space */
        min-height: 0 !important;  /* Allow flex shrinking */
        overflow-y: auto !important;  /* Only messages scroll */
        overflow-x: hidden !important;
        padding-right: 8px !important;
    }
    
    .chat-bubble {
        max-width: 85% !important;
    }
    
    .chat-bubble.ai {
        margin-left: 2rem !important;
    }
    
    .chat-message {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Progress bar animations */
.step-progress-1, .step-progress-2, .step-progress-3, 
.step-progress-4, .step-progress-5 {
    transition: width 2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Success message */
#journey-success {
    transition: all 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Mobile: Show success message immediately */
@media (max-width: 768px) {
    #journey-success {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Flight/accommodation booking animations */
.booking-card {
    transition: all 0.4s ease;
}

.booking-card.booking-active {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.2);
}

.booking-card.booking-confirmed {
    border-color: #10b981;
    background: #f0fdf4;
    animation: confirmPulse 0.6s ease;
}

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

/* Checklist item animation */
.checklist-item.checking {
    animation: checkBounce 0.6s ease;
}

@keyframes checkBounce {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Card entrance animations */
.card-entrance {
    animation: cardEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(30px) rotateX(-10deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0deg);
    }
}
