/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette from Reference */
    --bg-primary: #0c2542;
    --bg-secondary: #1a3554;
    --bg-editor: #1e293b;
    --bg-card: #1e293b;
    
    /* Section Header Colors - More distinct and vibrant */
    --color-metadata: #7c3aed;     /* Purple - for general info */
    --color-relationships: #ec4899; /* Pink - for vCon relationships */
    --color-parties: #f59e0b;      /* Amber - for people/contacts */
    --color-dialog: #10b981;       /* Emerald - for conversations */
    --color-attachments: #ef4444;  /* Red - for files/attachments */
    --color-analysis: #3b82f6;     /* Blue - for analytics */
    --color-extensions: #8b5cf6;   /* Violet - for custom data */
    
    /* Section Background Colors - Subtle tinted backgrounds */
    --bg-metadata: rgba(124, 58, 237, 0.08);
    --bg-relationships: rgba(236, 72, 153, 0.08);
    --bg-parties: rgba(245, 158, 11, 0.08);
    --bg-dialog: rgba(16, 185, 129, 0.08);
    --bg-attachments: rgba(239, 68, 68, 0.08);
    --bg-analysis: rgba(59, 130, 246, 0.08);
    --bg-extensions: rgba(139, 92, 246, 0.08);
    
    /* Text Colors */
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-highlight: #3b82f6;
    
    /* Status Colors */
    --status-valid: #22c55e;
    --status-error: #ef4444;
    
    /* Validation Status Colors */
    --validation-unknown: #94a3b8;
    --validation-good: #22c55e;
    --validation-warning: #fbbf24;
    --validation-fail: #ef4444;
    
    /* UI Colors */
    --border-color: #334155;
    --button-hover: #2d3748;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) 0;
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-md);
}

.brand-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.brand-tagline {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Remove validation status styles from header */
.validation-status.unknown,
.validation-status.good,
.validation-status.warning,
.validation-status.fail {
    /* Remove these styles */
}

.header-nav {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link img {
    width: 20px;
    height: 20px;
    filter: brightness(0) saturate(100%) invert(64%) sepia(14%) saturate(348%) hue-rotate(188deg) brightness(92%) contrast(89%);
    transition: filter 0.2s ease;
}

.nav-link:hover img {
    filter: brightness(0) saturate(100%) invert(93%) sepia(8%) saturate(1507%) hue-rotate(186deg) brightness(91%) contrast(96%);
}

/* Lock Button */
.lock-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lock-button:hover {
    color: var(--text-primary);
    background-color: var(--button-hover);
}

.lock-button.active {
    color: var(--text-highlight);
    background-color: rgba(59, 130, 246, 0.1);
}

.lock-button svg {
    transition: transform 0.2s ease;
}

.lock-button.active svg {
    transform: scale(1.1);
}

/* Key Input Panel */
.key-panel {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.key-panel.expanded {
    max-height: 400px;
    padding: var(--spacing-lg) 0;
}

.key-panel-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.key-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    align-items: start;
}

.key-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.key-label {
    display: none;
}

/* Removed the key-label styles since they are no longer needed */

.key-textarea {
    background-color: var(--bg-editor);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: var(--spacing-md);
    resize: vertical;
    min-height: 160px;
    max-height: 280px;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.key-textarea:hover {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.15);
}

.key-textarea:focus {
    border-color: var(--text-highlight);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 2px 6px 0 rgba(0, 0, 0, 0.15);
}

.key-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Main Content Layout */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    width: 100%;
}

/* Input Panel */
.input-panel {
    display: flex;
    flex-direction: column;
}

/* Input Tabs */
.input-tabs {
    display: flex;
    gap: var(--spacing-xs);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
}

.input-tab-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.input-tab-button:hover {
    color: var(--text-primary);
}

.input-tab-button.active {
    color: var(--text-primary);
}

.input-tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--text-highlight);
}

/* Input Tab Content */
.input-tab-content {
    flex: 1;
    display: flex;
    margin-top: var(--spacing-md);
    /* Ensure no overflow constraints */
}

.input-tab-panel {
    display: none;
    width: 100%;
    flex: 1;
    /* Remove any height constraints to allow natural expansion */
}

.input-tab-panel.active {
    display: flex;
    flex-direction: column;
}

.panel-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.code-editor {
    flex: 1;
    background-color: var(--bg-editor);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    /* Ensure minimum height but allow expansion */
    min-height: 400px;
}

.code-textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    color: var(--text-primary);
    border: none;
    padding: var(--spacing-md);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    /* Allow natural height expansion */
    min-height: 400px;
}

.code-textarea::placeholder {
    color: var(--text-muted);
}

/* Upload Tab Styles */
.upload-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.upload-drop-zone {
    flex: 1;
    width: 100%;
    min-height: 400px;
    padding: var(--spacing-xl);
    background-color: var(--bg-editor);
    border: 2px dashed var(--border-color);
    border-radius: 0;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-drop-zone:hover {
    border-color: var(--text-highlight);
    background-color: rgba(59, 130, 246, 0.05);
}

.upload-drop-zone.drag-over {
    border-color: var(--text-highlight);
    background-color: rgba(59, 130, 246, 0.1);
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.upload-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.upload-feedback {
    position: absolute;
    bottom: var(--spacing-md);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    animation: fade-in 0.3s ease;
    z-index: 10;
}

.upload-feedback-success {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--validation-good);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.upload-feedback-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--validation-fail);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.upload-drop-zone {
    position: relative;
}

/* Examples Tab Styles */
.examples-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-editor);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.examples-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-card);
}

.examples-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.examples-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.examples-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.example-item {
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.example-item:hover {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: var(--text-highlight);
    transform: translateX(2px);
}

.example-item.loading {
    opacity: 0.6;
    cursor: wait;
}

.example-icon {
    color: var(--text-highlight);
    font-size: 1.125rem;
    flex-shrink: 0;
}

.example-content {
    flex: 1;
    min-width: 0;
}

.example-name {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.example-type {
    color: var(--text-secondary);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.example-badge {
    background-color: rgba(59, 130, 246, 0.2);
    color: var(--text-highlight);
    padding: 2px 6px;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    flex-shrink: 0;
}

.examples-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.examples-error {
    padding: var(--spacing-md);
    margin: var(--spacing-sm);
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.375rem;
    color: #f87171;
    font-size: 0.875rem;
}

/* JSON Viewer Styles */
.json-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-editor);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    min-height: 400px;
}

#json-container {
    flex: 1;
    padding: var(--spacing-md);
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

.json-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.json-error {
    color: var(--validation-fail);
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.375rem;
    padding: var(--spacing-md);
    margin: var(--spacing-md);
    font-size: 0.875rem;
}

/* JSON Syntax Highlighting */
.json-key {
    color: #7dd3fc; /* Light blue */
    font-weight: 500;
}

.json-string {
    color: #86efac; /* Light green */
}

.json-number {
    color: #fbbf24; /* Yellow/orange */
}

.json-boolean {
    color: #c084fc; /* Purple */
    font-weight: 500;
}

.json-null {
    color: #94a3b8; /* Gray */
    font-style: italic;
}

.json-punctuation {
    color: var(--text-secondary);
}

/* Collapsible JSON Objects/Arrays */
.json-collapsible {
    display: block;
}

.json-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    margin-right: var(--spacing-xs);
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    min-width: 12px;
    text-align: center;
    transition: color 0.2s ease;
}

.json-toggle:hover {
    color: var(--text-primary);
}

.json-toggle.collapsed {
    color: var(--text-highlight);
}

.json-content {
    margin-left: var(--spacing-md);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: var(--spacing-sm);
    transition: all 0.2s ease;
}

.json-content.collapsed {
    display: none;
}

.json-summary {
    color: var(--text-muted);
    font-style: italic;
    margin-left: var(--spacing-xs);
}

.json-line {
    position: relative;
    margin-bottom: 2px;
}

.json-line:hover {
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 2px;
}

/* Encrypted Tab Styles */
.encrypted-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.encrypted-textarea {
    background-color: rgba(239, 68, 68, 0.05);
}

.decryption-hint {
    padding: var(--spacing-md);
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 0.375rem;
}

.decryption-hint p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.decryption-hint svg {
    margin: 0 var(--spacing-xs);
}

/* Output Panel */
.output-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}


/* Tabs */
.tabs {
    display: flex;
    gap: var(--spacing-xs);
    border-bottom: 1px solid var(--border-color);
}

.tab-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--text-primary);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--text-highlight);
}

/* Tab Content */
.tab-content {
    flex: 1;
    /* Remove overflow-y: auto; to prevent internal scrolling */
}

.tab-panel {
    display: none;
    /* Remove height: 100%; to allow natural content expansion */
}

.tab-panel.active {
    display: block;
}

/* Inspector Styles */
#inspector {
    padding: var(--spacing-md) 0;
    /* Remove any height constraints */
}

.inspector-section {
    margin-bottom: var(--spacing-md);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    transition: opacity 0.2s ease;
    position: relative;
    font-weight: 500;
}

.section-header:hover {
    opacity: 0.9;
}

.section-metadata {
    background-color: var(--color-metadata);
    color: white;
}

.section-relationships {
    background-color: var(--color-relationships);
    color: white;
}

.section-parties {
    background-color: var(--color-parties);
    color: white;
}

.section-dialog {
    background-color: var(--color-dialog);
    color: white;
}

.section-attachments {
    background-color: var(--color-attachments);
    color: white;
}

.section-analysis {
    background-color: var(--color-analysis);
    color: white;
}

.section-extensions {
    background-color: var(--color-extensions);
    color: white;
}

/* Panel Toggle Button (Eye Icon) */
.panel-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-header:hover .panel-toggle {
    opacity: 0.7;
}

.panel-toggle:hover {
    opacity: 1 !important;
    background-color: rgba(255, 255, 255, 0.1);
}

.panel-toggle.collapsed {
    opacity: 0.5;
}

.panel-toggle.collapsed svg {
    transform: scale(0.8);
    opacity: 0.6;
}

/* Content placeholders */
.content-placeholder {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.content-placeholder p {
    margin-bottom: var(--spacing-sm);
}

.content-placeholder .highlight {
    color: var(--text-primary);
    font-weight: 500;
}

.content-placeholder code {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.813rem;
}

/* Remove old collapse button styles */
.collapse-button {
    display: none;
}

.section-icon {
    font-size: 1.25rem;
}

.section-title {
    font-size: 0.875rem;
    font-weight: 500;
    flex: 1;
}

/* Section Content */
.section-content {
    padding: var(--spacing-md);
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    max-height: 1000px;
    opacity: 1;
}

.section-content.collapsed {
    max-height: 0;
    padding: 0;
    opacity: 0;
}

/* Section-specific content styling with tinted backgrounds */
.section-metadata .section-content {
    background-color: var(--bg-metadata);
    border-left: 3px solid var(--color-metadata);
}

.section-relationships .section-content {
    background-color: var(--bg-relationships);
    border-left: 3px solid var(--color-relationships);
}

.section-parties .section-content {
    background-color: var(--bg-parties);
    border-left: 3px solid var(--color-parties);
}

.section-dialog .section-content {
    background-color: var(--bg-dialog);
    border-left: 3px solid var(--color-dialog);
}

.section-attachments .section-content {
    background-color: var(--bg-attachments);
    border-left: 3px solid var(--color-attachments);
}

.section-analysis .section-content {
    background-color: var(--bg-analysis);
    border-left: 3px solid var(--color-analysis);
}

.section-extensions .section-content {
    background-color: var(--bg-extensions);
    border-left: 3px solid var(--color-extensions);
}

/* Party Items */
.party-item,
.dialog-item,
.attachment-item,
.relationship-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    margin-bottom: var(--spacing-sm);
    overflow: hidden;
}

.party-header,
.dialog-header,
.attachment-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.party-index,
.dialog-index,
.attachment-index {
    background-color: rgba(255, 255, 255, 0.1);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.party-identifier,
.dialog-type,
.attachment-type {
    flex: 1;
    font-size: 0.875rem;
}

.dialog-badge,
.attachment-badge {
    background-color: rgba(255, 255, 255, 0.1);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.badge-text {
    background-color: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

/* Details */
.party-details,
.dialog-details,
.attachment-details {
    padding: var(--spacing-md);
}

.detail-row {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
}

.detail-key {
    color: var(--text-secondary);
    min-width: 100px;
}

.detail-value {
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.detail-note,
.attachment-note {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm);
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Timeline and Raw Tabs */
.timeline-container,
.raw-container {
    padding: var(--spacing-lg);
    /* Remove height: 100%; to allow natural expansion */
    min-height: 400px;
}

.timeline-placeholder {
    color: var(--text-muted);
    text-align: center;
}

.raw-content {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* vCon Data Display Styles */
.vcon-metadata {
    padding: var(--spacing-md);
    font-size: 0.875rem;
}

.metadata-item {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.metadata-label {
    color: var(--text-secondary);
    min-width: 100px;
    font-weight: 500;
}

.metadata-value {
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    word-break: break-all;
}

.metadata-value.uuid {
    font-size: 0.8rem;
}

.party-item,
.dialog-item,
.attachment-item,
.analysis-item {
    margin-bottom: var(--spacing-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
    overflow: hidden;
}

.party-header,
.dialog-header,
.attachment-header,
.analysis-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.party-index,
.dialog-index,
.attachment-index,
.analysis-index {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.party-name {
    font-weight: 600;
    color: var(--text-primary);
}

.party-identifiers,
.dialog-details,
.attachment-details,
.analysis-details {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.85rem;
}

.identifier {
    display: flex;
    gap: var(--spacing-xs);
    padding: 2px 0;
}

.id-type {
    color: var(--text-secondary);
    min-width: 60px;
}

.id-value {
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-item {
    display: flex;
    gap: var(--spacing-sm);
    padding: 2px 0;
}

.detail-label {
    color: var(--text-secondary);
    min-width: 80px;
}

.detail-value {
    color: var(--text-primary);
}

.dialog-type {
    padding: 2px 8px;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.dialog-type.recording {
    background-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.dialog-type.text {
    background-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.dialog-type.transfer {
    background-color: rgba(168, 85, 247, 0.2);
    color: #a78bfa;
}

.dialog-type.incomplete {
    background-color: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.dialog-media {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.attachment-filename {
    font-weight: 500;
    color: var(--text-primary);
}

.analysis-type {
    padding: 2px 8px;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    background-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.extension-item {
    padding: var(--spacing-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.extension-key {
    color: var(--text-secondary);
    font-weight: 500;
}

.extension-value {
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    display: block;
    margin-top: var(--spacing-xs);
}

.empty-message,
.empty-timeline {
    color: var(--text-muted);
    text-align: center;
    padding: var(--spacing-lg);
    font-style: italic;
}

/* Timeline Styles */
.timeline-event {
    padding: var(--spacing-md);
    border-left: 2px solid rgba(255, 255, 255, 0.2);
    margin-left: var(--spacing-md);
    position: relative;
    margin-bottom: var(--spacing-md);
}

.timeline-event::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 20px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-color);
}

.timeline-event.system::before {
    background-color: #60a5fa;
}

.timeline-event.dialog_start::before,
.timeline-event.dialog_end::before {
    background-color: #f87171;
}

.timeline-event.attachment::before {
    background-color: #a78bfa;
}

.event-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.event-description {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.event-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.event-details .detail {
    margin-right: var(--spacing-sm);
}

/* Redacted and Appended Info */
.redacted-info,
.appended-info {
    background-color: rgba(251, 191, 36, 0.1);
    padding: var(--spacing-xs);
    border-radius: 0.25rem;
    margin-top: var(--spacing-xs);
}

/* Relationship Styles */
.relationship-info {
    margin-bottom: var(--spacing-sm);
}

.relationship-type {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-xs);
}

.relationship-badge {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-standard {
    background-color: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

.badge-redacted {
    background-color: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.badge-appended {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.badge-group {
    background-color: rgba(147, 51, 234, 0.2);
    color: #9333ea;
}

.relationship-details {
    margin-top: var(--spacing-sm);
}

.relationship-item {
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: var(--bg-card);
}

.relationship-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.relationship-title {
    font-weight: 600;
    color: var(--text-primary);
}

.relationship-link {
    color: var(--color-relationships);
    text-decoration: none;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--color-relationships);
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.relationship-link:hover {
    background-color: var(--color-relationships);
    color: white;
}

.uuid-display {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    background-color: rgba(255, 255, 255, 0.05);
    padding: var(--spacing-xs);
    border-radius: 0.25rem;
    word-break: break-all;
}

.party-validation {
    padding: var(--spacing-xs) var(--spacing-md);
    background-color: rgba(34, 197, 94, 0.1);
    font-size: 0.8rem;
}

.validation-label {
    color: var(--text-secondary);
}

.validation-value {
    color: #4ade80;
    font-weight: 500;
}

/* Footer */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-md) 0;
    margin-top: auto;
}

.footer-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.footer-text {
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.footer-heart {
    color: #ef4444;
}

.footer-link img {
    filter: invert(35%) sepia(98%) saturate(7462%) hue-rotate(353deg) brightness(102%) contrast(93%);
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-link:hover {
    color: var(--text-primary);
}

/* Validation Tab Styles */
.validation-container {
    padding: var(--spacing-lg);
    min-height: 400px;
}

.validation-header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.validation-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

#validation-status-icon {
    font-size: 1.5rem;
}

.validation-summary {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.validation-details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.validation-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: var(--spacing-md);
}

.validation-section-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.validation-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    line-height: 1.5;
}

.validation-item-icon {
    font-size: 1rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.validation-item-text {
    color: var(--text-secondary);
}

/* Validation tab icon colors */
#validation-tab-icon,
#validation-status-icon {
    transition: all 0.2s ease;
}

.validation-unknown #validation-tab-icon,
.validation-unknown #validation-status-icon {
    filter: grayscale(1);
}

.validation-good #validation-tab-icon,
.validation-good #validation-status-icon {
    /* Green checkmark styling handled by emoji */
}

.validation-warning #validation-tab-icon,
.validation-warning #validation-status-icon {
    /* Warning emoji styling */
}

.validation-fail #validation-tab-icon,
.validation-fail #validation-status-icon {
    /* Error emoji styling */
}

/* Responsive Design */
@media (max-width: 1200px) {
    .header-container,
    .key-panel-container {
        padding: 0 var(--spacing-md);
    }
    
    .main-content {
        padding: var(--spacing-md);
        gap: var(--spacing-md);
    }
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .input-panel {
        min-height: 300px;
        order: 1;
    }
    
    .output-panel {
        order: 2;
    }
    
    .key-inputs {
        grid-template-columns: 1fr;
    }
    
    .key-panel.expanded {
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: var(--spacing-sm) 0;
    }
    
    .header-container {
        padding: 0 var(--spacing-md);
    }
    
    .header-nav {
        gap: var(--spacing-md);
    }
    
    .nav-link {
        font-size: 0.8rem;
    }
    
    .brand-title {
        font-size: 1.25rem;
    }
    
    .main-content {
        padding: var(--spacing-sm);
        gap: var(--spacing-md);
    }
    
    /* Better tab handling on tablets */
    .tabs {
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }
    
    .input-tabs {
        flex-wrap: wrap;
    }
    
    .tab-button,
    .input-tab-button {
        min-width: 0;
        padding: var(--spacing-sm);
        font-size: 0.8rem;
    }
    
    /* Improve touch targets */
    .lock-button,
    .panel-toggle {
        min-width: 44px;
        min-height: 44px;
        padding: var(--spacing-sm);
    }
    
    .section-header {
        padding: var(--spacing-md);
    }
    
    .section-content {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    /* Make code areas more mobile-friendly */
    .code-textarea,
    .key-textarea {
        font-size: 0.8rem;
        padding: var(--spacing-sm);
        min-height: 300px;
    }
    
    .key-panel.expanded {
        max-height: 600px;
    }
    
    .key-textarea {
        min-height: 120px;
        max-height: 200px;
    }
}

@media (max-width: 640px) {
    .header-container {
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
    }
    
    .header-brand {
        justify-content: center;
    }
    
    .footer-container {
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
        padding: 0 var(--spacing-md);
    }
    
    .main-content {
        padding: var(--spacing-xs);
    }
    
    /* Stack tabs vertically on very small screens */
    .tabs,
    .input-tabs {
        flex-direction: column;
        border-bottom: none;
        border-right: 1px solid var(--border-color);
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }
    
    .tab-button,
    .input-tab-button {
        width: 100%;
        text-align: left;
        padding: var(--spacing-md);
        border-bottom: 1px solid var(--border-color);
    }
    
    .tab-button.active::after,
    .input-tab-button.active::after {
        bottom: 0;
        right: -1px;
        left: auto;
        width: 3px;
        height: 100%;
        background-color: var(--text-highlight);
    }
    
    /* Detail rows stack vertically */
    .detail-row {
        flex-direction: column;
        gap: var(--spacing-xs);
        margin-bottom: var(--spacing-md);
    }
    
    .detail-key {
        min-width: auto;
        font-weight: 600;
        color: var(--text-primary);
    }
    
    .detail-value {
        padding-left: var(--spacing-sm);
        font-size: 0.8rem;
        word-break: break-word;
    }
    
    /* Party/dialog items more compact */
    .party-header,
    .dialog-header,
    .attachment-header {
        flex-wrap: wrap;
        padding: var(--spacing-sm);
        gap: var(--spacing-xs);
    }
    
    .party-details,
    .dialog-details,
    .attachment-details {
        padding: var(--spacing-sm);
    }
    
    /* Validation container adjustments */
    .validation-container {
        padding: var(--spacing-md);
    }
    
    .validation-title {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
        font-size: 1.1rem;
    }
    
    /* Upload zone responsive */
    .upload-container {
        padding: var(--spacing-sm);
    }
    
    .upload-drop-zone {
        padding: var(--spacing-lg);
        max-width: none;
    }
    
    /* Examples list improvements */
    .examples-container {
        min-height: 300px;
    }
    
    .example-item {
        padding: var(--spacing-sm);
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .example-content {
        width: 100%;
    }
    
    /* Better spacing in sections */
    .inspector-section {
        margin-bottom: var(--spacing-sm);
    }
    
    .content-placeholder {
        font-size: 0.8rem;
    }
    
    .uuid-display {
        font-size: 0.75rem;
        word-break: break-all;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .brand-title {
        font-size: 1.1rem;
    }
    
    .header-nav {
        gap: var(--spacing-sm);
    }
    
    .nav-link {
        font-size: 0.75rem;
    }
    
    .main-content {
        padding: var(--spacing-xs);
    }
    
    .code-textarea,
    .key-textarea {
        font-size: 0.75rem;
        line-height: 1.4;
        min-height: 250px;
    }
    
    .key-textarea {
        min-height: 100px;
        max-height: 150px;
    }
    
    .section-title {
        font-size: 0.8rem;
    }
    
    .footer-container {
        font-size: 0.7rem;
    }
    
    /* Compact party displays */
    .party-index,
    .dialog-index,
    .attachment-index {
        padding: var(--spacing-xs);
        font-size: 0.7rem;
    }
    
    .party-identifier,
    .dialog-type,
    .attachment-type {
        font-size: 0.8rem;
    }
    
    /* More compact validation */
    .validation-section {
        padding: var(--spacing-sm);
    }
    
    .validation-section-title {
        font-size: 0.8rem;
    }
    
    .validation-item {
        font-size: 0.8rem;
    }
}

/* Landscape orientation improvements for phones */
@media (max-width: 768px) and (orientation: landscape) {
    .key-panel.expanded {
        max-height: 300px;
    }
    
    .key-textarea {
        max-height: 100px;
    }
    
    .code-textarea {
        min-height: 200px;
    }
    
    .validation-container,
    .timeline-container {
        min-height: 250px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .section-header:hover .panel-toggle {
        opacity: 0.8;
    }
    
    .panel-toggle {
        opacity: 0.6;
    }
    
    .example-item:hover {
        transform: none;
    }
}

/* Icon Styling */
.icon-lock,
.icon-eye,
.icon-document,
.icon-error,
.icon-unlocked,
.icon-locked,
.icon-signed,
.icon-shield,
.icon-pending {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.icon-inline {
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.25rem;
}

/* Validation Icon Colors */
.icon-validation-unknown {
    filter: brightness(0) saturate(100%) invert(56%) sepia(6%) saturate(622%) hue-rotate(176deg) brightness(94%) contrast(90%);
}

.icon-validation-good {
    filter: brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(86deg) brightness(118%) contrast(119%);
}

.icon-validation-warning {
    filter: brightness(0) saturate(100%) invert(72%) sepia(98%) saturate(1866%) hue-rotate(1deg) brightness(106%) contrast(104%);
}

.icon-validation-fail {
    filter: brightness(0) saturate(100%) invert(37%) sepia(93%) saturate(7471%) hue-rotate(356deg) brightness(91%) contrast(135%);
}

/* Security Panel Icon Styling */
.security-indicator img {
    vertical-align: middle;
}

/* Validation Tab Icon */
#validation-tab-icon img {
    vertical-align: middle;
    margin-left: 0.25rem;
}

/* Validation Status Icon */
#validation-status-icon img {
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Panel Toggle Eye Icon */
.panel-toggle img {
    transition: opacity 0.2s;
}

.panel-toggle.collapsed img {
    opacity: 0.5;
}

/* Lock Button Icon */
.lock-button img {
    transition: filter 0.2s;
}

.lock-button.active img {
    filter: brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(86deg) brightness(118%) contrast(119%);
}

/* Example Icon */
.example-icon img {
    vertical-align: middle;
    opacity: 0.7;
}

/* Hash Status Inline Icons */
.hash-status-inline img {
    display: inline-block;
    vertical-align: middle;
}

/* Clipboard Copy Functionality */
.detail-row {
    position: relative;
}

.detail-value {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.clipboard-icon {
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.2s ease;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem;
    flex-shrink: 0;
}

.detail-row:hover .clipboard-icon,
.identifier:hover .clipboard-icon {
    opacity: 0.7;
}

.clipboard-icon:hover {
    opacity: 1 !important;
}

.clipboard-icon img {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

.clipboard-icon.copied {
    /* Remove background for more subtle feedback */
}

.clipboard-icon.copied img {
    filter: brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(86deg) brightness(118%) contrast(119%);
}

.clipboard-icon.copy-failed {
    /* Remove background for more subtle feedback */
}

.clipboard-icon.copy-failed img {
    filter: brightness(0) saturate(100%) invert(37%) sepia(93%) saturate(7471%) hue-rotate(356deg) brightness(91%) contrast(135%);
}