/* Template Demo Styles */
.template-demo-section {
    background: #1a1a1a;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Iframe Template Display */
.template-iframe-container {
    position: relative;
    width: 100%;
    height: 700px;
    background: #0f0f0f;
    overflow: hidden;
}

.template-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.template-iframe.loaded {
    opacity: 1;
}

/* Loading Overlay */
.iframe-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #3543F0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Template Tabs */
.template-tabs-container {
    background: #2a2a2a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
}

.template-tabs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.template-tabs {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    flex: 1;
}

.template-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.template-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.template-tab.active {
    color: #ffffff;
    background: rgba(53, 67, 240, 0.2);
    border-color: #3543F0;
    box-shadow: 0 0 20px rgba(53, 67, 240, 0.3);
}

.tab-emoji {
    font-size: 1.2rem;
}

/* Connected Mode Button */
.connected-mode-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(53, 67, 240, 0.1);
    border: 2px solid rgba(53, 67, 240, 0.3);
    color: #3543F0;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
    white-space: nowrap;
}

.connected-mode-btn:hover {
    background: rgba(53, 67, 240, 0.2);
    border-color: #3543F0;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(53, 67, 240, 0.3);
}

.connected-mode-btn.active {
    background: #3543F0;
    color: white;
    border-color: #3543F0;
    box-shadow: 0 0 30px rgba(53, 67, 240, 0.5);
}

.connected-mode-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.connected-mode-btn.active svg {
    transform: rotate(180deg);
}

/* Demo Header */
.demo-header {
    background: #2a2a2a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 2rem;
    text-align: center;
}

.demo-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.demo-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Demo Container */
.demo-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: 700px;
    background: #0f0f0f;
}

/* Chaos Panel */
.chaos-panel {
    background: #0a0e27;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.chaos-panel-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #ef4444;
    text-align: center;
    margin-bottom: 1rem;
}

/* Draggable Files */
.chaos-files {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.draggable-file {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1rem;
    cursor: move;
    transition: all 0.3s ease;
    opacity: 1;
    transform: scale(1);
}

.draggable-file:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.draggable-file.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.draggable-file.added {
    opacity: 0.3;
    pointer-events: none;
    transform: scale(0.9);
}

.file-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-emoji {
    font-size: 2rem;
}

.file-info {
    flex: 1;
}

.file-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.file-details {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Add Evidence Button */
.add-evidence-btn {
    background: #3543F0;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: auto;
}

.add-evidence-btn:hover {
    background: #2936d3;
    transform: translateY(-2px);
}

.add-evidence-btn:active {
    transform: translateY(0);
}

/* Templates Display */
.templates-display {
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    overflow-y: auto;
}

/* Template Preview */
.template-preview {
    background: #1a1a1a;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: fit-content;
}

.template-preview.updating {
    border-color: #3543F0;
    box-shadow: 0 0 30px rgba(53, 67, 240, 0.3);
    animation: pulse 1s ease;
}

.template-header {
    background: #2a2a2a;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.template-icon {
    font-size: 1.5rem;
}

.template-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #ffffff;
}

.template-content {
    padding: 1.5rem;
    min-height: 200px;
}

/* Evidence Hub Template */
.evidence-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.evidence-item {
    background: rgba(53, 67, 240, 0.1);
    border: 1px solid rgba(53, 67, 240, 0.2);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.5s ease forwards;
}

.evidence-item .item-icon {
    font-size: 1.25rem;
}

.evidence-item .item-text {
    flex: 1;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
}

.evidence-item .item-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Timeline Template */
.timeline-container {
    position: relative;
    padding-left: 2rem;
}

.timeline-line {
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.timeline-events {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.timeline-event {
    position: relative;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInLeft 0.5s ease forwards;
}

.timeline-dot {
    position: absolute;
    left: -1.5rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    background: #3543F0;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(53, 67, 240, 0.5);
}

.timeline-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
}

.timeline-date {
    font-size: 0.75rem;
    color: #3543F0;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.timeline-title {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(255, 255, 255, 0.4);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-text {
    font-size: 0.875rem;
}

/* Success Animation */
.success-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 50%;
    animation: successPulse 1s ease;
    pointer-events: none;
}

/* Animations */
@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes successPulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* Stats Display */
.demo-stats {
    background: #1a1a1a;
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #3543F0;
}

.stat-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Template Demo Overlay */
.template-demo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.template-demo-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.template-demo-overlay.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

/* Demo Info Panel */
.demo-info-panel {
    background: #1a1a1a;
    border: 2px solid #3543F0;
    border-radius: 24px;
    padding: 2rem;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(53, 67, 240, 0.4);
    position: relative;
    animation: slideUp 0.4s ease;
}

.demo-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    transform: rotate(90deg);
}

.demo-info-panel h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Demo Features */
.demo-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.demo-feature {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.demo-feature:hover {
    background: rgba(53, 67, 240, 0.1);
    transform: translateX(10px);
}

.feature-icon {
    font-size: 1.5rem;
}

.feature-text {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    flex: 1;
}

/* Demo Action */
.demo-action {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.demo-action p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.demo-try-btn {
    background: #3543F0;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.demo-try-btn:hover {
    background: #2936d3;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(53, 67, 240, 0.3);
}

/* Hotspot Indicators */
.demo-hotspots {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.hotspot {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid #3543F0;
    border-radius: 50%;
    background: rgba(53, 67, 240, 0.2);
    animation: pulse 2s ease-in-out infinite;
    cursor: pointer;
    pointer-events: all;
}

.hotspot::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 0.5rem;
}

.hotspot:hover::before {
    opacity: 1;
}

.hotspot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: #3543F0;
    border-radius: 50%;
}

/* Connected Navigation Overlay */
.connected-nav-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: rgba(7, 13, 90, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(53, 67, 240, 0.3);
    animation: slideDown 0.3s ease;
}

.connected-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    gap: 2rem;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(53, 67, 240, 0.8);
}

.nav-pills-connected {
    display: flex;
    gap: 0.5rem;
    background: rgba(15, 18, 60, 0.8);
    border: 1px solid rgba(53, 67, 240, 0.3);
    border-radius: 14px;
    padding: 0.5rem;
}

.nav-pill-connected {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 10px;
    min-width: 70px;
}

.nav-pill-connected span:first-child {
    font-size: 1.25rem;
}

.nav-pill-connected:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.nav-pill-connected[data-active="true"] {
    background: #3543F0;
    color: white;
    box-shadow: 0 4px 12px rgba(53, 67, 240, 0.3);
}

.connected-demo-info {
    background: rgba(53, 67, 240, 0.2);
    padding: 0.5rem 1rem;
    text-align: center;
    border-top: 1px solid rgba(53, 67, 240, 0.3);
}

.connected-demo-info p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Template iframe transitions */
.template-iframe {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .demo-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .chaos-panel {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        max-height: 300px;
    }
    
    .templates-display {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .demo-stats {
        gap: 1.5rem;
        flex-wrap: wrap;
    }
    
    .stat-item {
        min-width: 100px;
    }
    
    .template-tabs-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .connected-mode-btn {
        width: 100%;
        justify-content: center;
    }
    
    .connected-nav-header {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }
    
    .nav-pills-connected {
        width: 100%;
        justify-content: space-between;
        padding: 0.25rem;
        gap: 0.25rem;
    }
    
    .nav-pill-connected {
        min-width: auto;
        flex: 1;
        padding: 0.4rem 0.5rem;
        font-size: 0.65rem;
    }
    
    .nav-pill-connected span:first-child {
        font-size: 1rem;
    }
    
    .demo-info-panel {
        max-width: 90%;
        padding: 1.5rem;
    }
}