* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 24px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 48px;
}

header h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 18px;
    opacity: 0.95;
    max-width: 700px;
    margin: 0 auto;
}

.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.demo-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.demo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.demo-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.demo-card h2 {
    font-size: 24px;
    color: #1a202c;
    margin-bottom: 12px;
    font-weight: 600;
}

.demo-card p {
    color: #4a5568;
    margin-bottom: 20px;
    flex-grow: 1;
}

.demo-features {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.feature-tag {
    background: #edf2f7;
    color: #2d3748;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
}

.demo-link {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: opacity 0.3s ease;
}

.demo-link:hover {
    opacity: 0.9;
}

footer {
    text-align: center;
    color: white;
    opacity: 0.9;
    font-size: 14px;
}

.demo-page {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    margin-bottom: 24px;
}

.demo-header {
    margin-bottom: 32px;
}

.demo-header h1 {
    color: #1a202c;
    font-size: 36px;
    margin-bottom: 12px;
}

.demo-header p {
    color: #4a5568;
    font-size: 16px;
}

.back-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    margin-bottom: 24px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.back-link:hover {
    opacity: 0.8;
}

.demo-section {
    margin-bottom: 32px;
}

.demo-section h2 {
    color: #2d3748;
    font-size: 24px;
    margin-bottom: 16px;
}

.scenario-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.scenario-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.scenario-btn:hover {
    background: #667eea;
    color: white;
}

.scenario-btn.active {
    background: #667eea;
    color: white;
}

.control-panel {
    background: #f7fafc;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.control-row {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.control-row label {
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

.checkbox-group {
    gap: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #2d3748;
}

.control-row select,
.control-row input[type="number"],
.control-row input[type="text"] {
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e0;
    font-size: 14px;
    background: white;
    color: #2d3748;
}

.control-row input[type="checkbox"] {
    margin-right: 8px;
}

.control-panel h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #2d3748;
    font-size: 18px;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.output-panel {
    background: #1a202c;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.log-entry {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 4px;
}

.log-info {
    color: #63b3ed;
}

.log-success {
    color: #68d391;
}

.log-warning {
    color: #f6ad55;
    background: rgba(246, 173, 85, 0.1);
}

.log-error {
    color: #fc8181;
    background: rgba(252, 129, 129, 0.1);
}

.text-muted {
    color: #718096;
    font-size: 14px;
}

.data-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.data-list li {
    background: white;
    border-radius: 6px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    color: #2d3748;
    line-height: 1.5;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.summary-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(45, 55, 72, 0.08);
}

.summary-card .label {
    font-size: 12px;
    text-transform: uppercase;
    color: #718096;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
    display: block;
}

.summary-card .value {
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
}

input[type="file"] {
    display: none;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.status-safe {
    background: #c6f6d5;
    color: #22543d;
}

.status-vulnerable {
    background: #fed7d7;
    color: #742a2a;
}

.status-protected {
    background: #bee3f8;
    color: #2c5282;
}

.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.mcp-card {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mcp-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.mcp-card.installed {
    border-color: #48bb78;
    background: #f0fff4;
}

.mcp-card.malicious {
    border-color: #f56565;
}

.mcp-card h3 {
    color: #2d3748;
    font-size: 18px;
    margin-bottom: 8px;
}

.mcp-card p {
    color: #718096;
    font-size: 14px;
    margin-bottom: 12px;
}

.mcp-rating {
    color: #f6ad55;
    font-size: 14px;
}

.expand-btn {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.expand-btn:hover {
    background: #f7fafc;
}

.expand-btn.expanded {
    background: #667eea;
    color: white;
}

.expand-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.expand-btn.expanded .expand-icon {
    transform: rotate(90deg);
}

.cv-preview {
    margin-top: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

.cv-content {
    background: white;
    padding: 24px;
    color: #2d3748;
    line-height: 1.8;
    max-height: 600px;
    overflow-y: auto;
}

.cv-content h1 {
    color: #1a202c;
    font-size: 28px;
    margin-bottom: 8px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 8px;
}

.cv-content h2 {
    color: #2d3748;
    font-size: 18px;
    margin-top: 20px;
    margin-bottom: 12px;
    font-weight: 600;
}

.cv-content h3 {
    color: #4a5568;
    font-size: 16px;
    margin-top: 12px;
    margin-bottom: 4px;
    font-weight: 600;
}

.cv-content p {
    color: #4a5568;
    margin-bottom: 8px;
}

.cv-content ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.cv-content li {
    margin-bottom: 4px;
}

.cv-content strong {
    color: #1a202c;
    font-weight: 600;
}

.cv-content em {
    color: #718096;
}

.phase-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.phase-btn {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    background: white;
    color: #2d3748;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.phase-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.phase-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.diagram-container {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    height: 100%;
}

/* Wrapper to keep a fixed aspect ratio and center the iframe */
.diagram-container .iframe-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* Use aspect-ratio to preserve nice proportions; adjust 16/9 if needed */
    aspect-ratio: 16 / 9;
    max-width: 100%;
}

/* Make the iframe fill the wrapper while respecting the wrapper aspect ratio */
.diagram-container .iframe-wrapper iframe {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border: none;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    display: block; /* avoid inline spacing issues */
    background: #fff;
    object-fit: contain; /* helps keep content visible if the iframe supports it */
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.diagram-with-legend {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    margin-top: 16px;
    align-items: start;
    height: 600px;
}

.diagram-container {
    grid-column: 1;
}

.diagram-legend {
    grid-column: 2;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    max-height: 650px;
    
    /*overflow-y: auto;*/
}

.legend-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #cbd5e0;
    cursor: default;
    transition: all 0.2s ease;
    position: relative;
}

.legend-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.legend-item:hover {
    background: #edf2f7;
}

.legend-number-safe {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: #CDCDCD;
    color: black;
    border-radius: 50%;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    border: #000000 1px solid;
}

.legend-number-malicious {
    background: #F8CECC;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    color: black;
    border-radius: 50%;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    border: #000000 1px solid;
}

.legend-number-protected {
    background: #DAE8FC;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    color: black;
    border-radius: 50%;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    border: #000000 1px solid;
}

.legend-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-title {
    font-weight: 600;
    color: #2d3748;
    font-size: 13px;
    line-height: 1.4;
}

.legend-description {
    color: #718096;
    font-size: 12px;
    line-height: 1.4;
}

.tooltip-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: #cbd5e0;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 14px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    /* position: relative; */
}

.tooltip-icon:hover {
    background: #a0aec0;
}

.tooltip {
    display: none;
    position: absolute;
    background: #2d3748;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    /* max-width: 200px; */
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    line-height: 1.4;
    word-wrap: break-word;
    white-space: normal;
    /* top: -8px; */
    /* right: -8px; */
    transform: translate(-90%, 10%);
    width: 400px;
    text-align: left;
}

.legend-item:hover .tooltip {
    display: block;
}

.malicious-cv {
    border: red 2px solid;
    padding: 18px;
    border-radius: 8px;
}

@media (max-width: 1024px) {
    .diagram-with-legend {
        grid-template-columns: 1fr;
        height: auto;
    }

    .diagram-container {
        grid-column: 1;
    }

    .diagram-legend {
        grid-column: 1;
        max-height: auto;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 32px;
    }

    .demo-page {
        padding: 24px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Base styling for all log items */
#incidentList li {
  list-style: none;
  margin: 0.4rem 0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.4;
  font-family: system-ui, sans-serif;
  border-left: 4px solid;
  display: block;
  background: rgba(255, 255, 255, 0.04);
  color: #000000;
}

/* INFO */
#incidentList li.log-info {
  border-color: #4aa3ff;
  background: rgba(74, 163, 255, 0.1);
  color: #000000;
}

/* WARNING */
#incidentList li.log-warning {
  border-color: #ffb84a;
  background: rgba(255, 184, 74, 0.12);
  color: #000000;
}

/* ERROR / CRITICAL */
#incidentList li.log-error {
  border-color: #ff5c5c;
  background: rgba(255, 92, 92, 0.14);
  color: #000000;
}

/* Placeholder text */
.text-muted {
  opacity: 0.6;
  font-style: italic;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-top: 3px solid transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.row {
    display: flex;
    gap: 8px;
}