/* Interactive Demo Styles */
.interactive-demo-section {
    width: 100%;
    padding: 2rem 0;
}

/* Demo Container */
.demo-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 2rem;
    box-sizing: border-box;
}

/* Demo iframe styling */
.demo-iframe {
    width: 100% !important;
    height: 800px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: block;
    background: #0F172A;
}

/* Demo Header */
.demo-header {
    background: #2a2a2a;
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.demo-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1.5rem;
}

/* Scenario Selector */
.scenario-selector {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.scenario-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.scenario-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    transform: translateY(-2px);
}

.scenario-btn.active {
    background: rgba(53, 67, 240, 0.2);
    border-color: #3543F0;
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(53, 67, 240, 0.3);
}

.scenario-icon {
    font-size: 2rem;
}

.scenario-label {
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
}


/* Full Template View */
.template-full-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.template-main-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Chat Demo Overlay */
.chat-demo-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    width: 420px;
    max-width: 90%;
    display: none; /* Hidden by default */
}

.chat-demo-overlay.centered {
    /* Keep centered positioning */
}

.chat-demo-overlay.minimized {
    top: auto;
    bottom: 20px;
    left: 20px;
    transform: none;
    width: 300px;
}

.chat-demo-window {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: fadeInScale 0.5s ease;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.chat-demo-window.minimized {
    height: auto;
}

.chat-demo-window.minimized .chat-demo-messages,
.chat-demo-window.minimized .chat-demo-input {
    display: none;
}

.chat-demo-header {
    background: #2a2a2a;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-demo-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.chat-minimize-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-demo-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    -webkit-overflow-scrolling: touch; /* Enable smooth scrolling on iOS */
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: fadeInUp 0.5s ease;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.message-avatar.ai {
    background: rgba(53, 67, 240, 0.2);
    border: 1px solid #3543F0;
}

.message-avatar.user {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.message-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    max-width: 280px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.chat-message.user .message-content {
    background: rgba(53, 67, 240, 0.2);
}

/* Typing Indicator */
.chat-demo-input {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 50px;
}

.chat-typing-indicator {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

.typing-text {
    font-style: italic;
}

.cursor {
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* AI Typing Dots */
.ai-typing {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Template Navigation */
.template-nav-container {
    position: absolute; /* Changed from fixed to absolute */
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 150;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.template-nav {
    display: flex;
    gap: 0.5rem;
}

.template-nav-btn {
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.template-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.template-nav-btn.active {
    background: rgba(53, 67, 240, 0.2);
    border-color: #3543F0;
    color: white;
}

.nav-icon {
    font-size: 1.25rem;
}

.nav-label {
    display: none;
}

@media (min-width: 768px) {
    .nav-label {
        display: inline;
    }
}

/* Update badge for navigation buttons */
.update-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    animation: pulse 2s ease-in-out infinite;
}

/* Template Preview Cards */
.template-preview {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.template-preview.updating {
    border-color: #3543F0;
    box-shadow: 0 0 30px rgba(53, 67, 240, 0.3);
    animation: pulse 1s ease-in-out infinite;
}

.template-preview-header {
    background: #2a2a2a;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.template-icon {
    font-size: 1.5rem;
}

.template-preview-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.template-preview-content {
    padding: 0;
    min-height: 400px;
    background: #0f0f0f;
    position: relative;
    overflow: hidden;
}

/* Template iframes */
.template-iframe {
    width: 100%;
    height: 400px;
    background: white;
    border: none;
    display: block;
}

/* Update Indicator */
.update-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #3543F0;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.5s ease;
    z-index: 10;
}

.update-count {
    background: white;
    color: #3543F0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.update-indicator.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

/* Empty State */
.preview-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 160px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.875rem;
}

/* Evidence Items */
.evidence-item-mini {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: fadeInLeft 0.5s ease;
}

.evidence-item-mini.threat {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

.evidence-item-icon {
    font-size: 1.25rem;
}

.evidence-item-info {
    flex: 1;
}

.evidence-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.evidence-item-meta {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Timeline Events */
.timeline-event-mini {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    animation: fadeInRight 0.5s ease;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    background: #3543F0;
    border-radius: 50%;
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.timeline-event-info {
    flex: 1;
}

.timeline-event-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.timeline-event-date {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Strategy Items */
.strategy-item-mini {
    background: rgba(53, 67, 240, 0.1);
    border: 1px solid rgba(53, 67, 240, 0.2);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    animation: fadeInUp 0.5s ease;
}

.strategy-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.strategy-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.strategy-checklist li {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.25rem;
    padding-left: 1.25rem;
    position: relative;
}

.strategy-checklist li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10b981;
}

/* Demo Progress */
.demo-progress {
    margin-top: 2rem;
    text-align: center;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: #3543F0;
    width: 0;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Demo Controls */
.demo-controls {
    background: #1a1a1a;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.demo-control-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.demo-control-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* Animations */
@keyframes fadeInScale {
    from {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(53, 67, 240, 0.3);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 50px rgba(53, 67, 240, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(53, 67, 240, 0.3);
    }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    20% {
        opacity: 1;
        transform: translateY(0);
    }
    80% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .demo-iframe {
        height: 700px;
    }
}

@media (max-width: 768px) {
    .demo-iframe {
        height: 600px;
    }
    
    .interactive-demo-section {
        padding: 1rem 0;
    }
    
    /* Mobile chat improvements */
    .chat-demo-window {
        max-height: 500px;
    }
    
    .chat-demo-messages {
        max-height: 300px;
        padding: 1rem;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        /* Ensure scrolling works on mobile */
        touch-action: pan-y;
    }
    
    .chat-demo-overlay {
        width: 95%;
        max-width: 380px;
    }
    
    .chat-demo-overlay.minimized {
        width: 280px;
        bottom: 10px;
        left: 10px;
    }
}