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

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 2rem;
    background-color: var(--bg-darker);
    color: var(--text-color);
    height: 64px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 100%;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #3498db;
}

.title {
    font-size: 2rem;
    margin: 0;
    font-weight: 700;
    background: linear-gradient(135deg, #3498db, #013368);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    letter-spacing: -0.5px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    position: relative;
    text-shadow: 0 2px 15px rgba(52, 152, 219, 0.2);
}

.header-right {
    display: flex;
    align-items: center;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.main-content {
    display: flex;
    padding: 0.25rem 1rem 2rem 1rem;
    gap: 1rem;
    min-height: 800px;
    background-color: var(--bg-darker);
}

.editor-panel, .control-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 800px;
    overflow: hidden;
    background: var(--bg-dark);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    padding: 15px;
}

.editor-panel textarea {
    flex: 1;
    margin: 15px 0;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    resize: none;
    background-color: var(--bg-darker);
    color: var(--text-color);
}

.message-section, .output-section {
    background: var(--bg-dark);
    border-radius: 4px;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.message-controls {
    width: 100%;
    padding: 0;
    margin-bottom: 10px;
}

.message-controls select {
    width: 100%;
    padding: 8px 10px;
    margin-top: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-darker);
    color: var(--text-color);
}

.field-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 0;
    padding: 0;
    margin: 0;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field label {
    font-size: 14px;
    color: var(--text-muted);
}

.field input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-darker);
    color: var(--text-color);
}

.output-formats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    height: 100%;
    padding: 0;
}

.format-box {
    background: var(--bg-light);
    border-radius: 4px;
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.format-box pre {
    margin: 10px 0 0;
    padding: 10px;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    flex: 1;
    min-height: 0;
    color: var(--text-color);
}

.parse-button, 
.serialize-button,
.deserialize-button {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.parse-button:hover,
.serialize-button:hover {
    background: #45a049;
}

.deserialize-button {
    background-color: #ff4444;
}

.deserialize-button:hover {
    background-color: #ff0000;
}

.header-button {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    padding: 0.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    background-color: var(--bg-darker);
}

.header-button:hover {
    background-color: var(--bg-darkest);
}

h3, h4 {
    margin-bottom: 10px;
}

h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 18px;
}

h4 {
    margin: 0;
    color: var(--text-muted);
    font-size: 16px;
}

.nested-message {
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 2px solid #3498db;
}

.field-input {
    width: 100%;
}

.error-message {
    color: var(--error-color);
    background-color: rgba(220, 53, 69, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 1px solid rgba(220, 53, 69, 0.2);
    margin: 0.5rem 0;
    font-size: 14px;
}

.proto-tabs {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.proto-tab {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    margin-right: 4px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    color: var(--text-muted);
}

.proto-tab.active {
    background-color: var(--bg-light);
    border-bottom: 2px solid var(--primary-color);
    color: var(--text-color);
}

.tab-name {
    margin-right: 8px;
    font-family: monospace;
}

.tab-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    padding: 0 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-close:hover {
    color: #e74c3c;
}

.new-tab {
    display: flex;
    align-items: center;
    padding: 4px;
    margin-left: 4px;
}

.new-tab input {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-right: 4px;
    font-family: monospace;
    width: 150px;
    background-color: var(--bg-darker);
    color: var(--text-color);
}

.add-tab {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
}

.add-tab:hover {
    background-color: #2980b9;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    background-color: var(--bg-dark);
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 16px;
}

.about-section {
    padding: 20px;
    background-color: var(--bg-dark);
    border-top: 1px solid var(--border-color);
    width: 100%;
}

.about-section h3 {
    color: var(--text-color);
    margin-bottom: 8px;
    font-size: 16px;
}

.about-section p {
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 8px;
    font-size: 14px;
}

.about-section ul {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 12px;
}

.about-section ul li {
    color: var(--text-muted);
    padding: 2px 0;
    position: relative;
    padding-left: 16px;
    font-size: 14px;
}

.about-section ul li:before {
    content: "•";
    color: #3498db;
    font-weight: bold;
    position: absolute;
    left: 8px;
}

.about-section ol {
    padding-left: 24px;
    margin-bottom: 12px;
}

.about-section ol li {
    color: var(--text-muted);
    padding: 2px 0;
    font-size: 14px;
}

.version-info {
    color: var(--text-muted);
    font-size: 0.9em;
    text-align: right;
    margin-top: 8px;
    margin-bottom: 0;
    font-family: monospace;
}

:root {
    --spacing-unit: 1rem;
    --border-radius: 4px;
    --transition-speed: 0.2s;
    --font-mono: monospace;

    --primary-color: #3498db;
    --primary-color-dark: #2980b9;
    --success-color: #2ecc71;
    --warning-color: #f1c40f;
    --error-color: #e74c3c;
}

:root {
    --bg-darkest: #ffffff;
    --bg-darker: #f8f9fa;
    --bg-dark: #f0f0f0;
    --bg-light: #ffffff;
    
    --text-color: #333333;
    --text-muted: #666666;
    
    --border-color: #dddddd;

    --editor-bg: #ffffff;
    --editor-gutter: #f8f8f8;
    --editor-text: #333333;
}

[data-theme="dark"] {
    --bg-darkest: #1e1e1e;
    --bg-darker: #2a2a2a;
    --bg-dark: #333333;
    --bg-light: #3d3d3d;

    --text-color: #ffffff;
    --text-muted: #b0b0b0;
    
    --border-color: #484848;

    --editor-bg: #282c34;
    --editor-gutter: #282c34;
    --editor-text: #abb2bf;
}

.parse-button {
    background-color: var(--primary-color);
    color: white;
}

.parse-button:hover {
    background-color: var(--primary-color-dark);
}

.add-tab {
    background-color: var(--primary-color);
    color: white;
}

.add-tab:hover {
    background-color: var(--primary-color-dark);
}

.json-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.json-input, .encoded-input {
    width: 100%;
    font-family: monospace;
    resize: none;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    line-height: 1.5;
    transition: border-color var(--transition-speed) ease-in-out;
    background-color: var(--bg-darker);
    color: var(--text-color);
}

.json-input {
    height: 514px;
}

.encoded-input {
    height: 60px;
}

.json-input:focus, .encoded-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.encoded-field {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
    width: 100%;
    padding: 0;
}

.encoded-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.encoded-header h3 {
    margin: 0;
}

.format-selector {
    display: flex;
    align-items: center;
}

.toggle-container {
    display: flex;
    background: var(--bg-darker);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.toggle-button {
    border: none;
    padding: 4px 12px;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s;
}

.toggle-button:hover {
    background: var(--bg-light);
}

.toggle-button.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.action-buttons {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    justify-content: center;
}

.serialize-button {
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.deserialize-button {
    padding: 8px 16px;
    font-size: 14px;
    background-color: #ff4444;
    color: white;
    border: none;
    cursor: pointer;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Notification Styles */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    animation: slide-in 0.3s ease-out;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    margin-left: 16px;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.notification-close:hover {
    opacity: 1;
}

@keyframes slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.code-mirror-wrapper {
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.cm-editor {
    height: 100%;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    background-color: var(--editor-bg) !important;
    color: var(--editor-text) !important;
}

.cm-editor .cm-scroller {
    overflow: auto;
    padding: 4px;
}

.cm-editor .cm-content {
    white-space: pre-wrap;
}

.cm-editor .cm-line {
    padding: 0 4px;
}

.cm-editor .cm-gutters {
    background-color: var(--editor-gutter) !important;
    color: var(--text-muted) !important;
    border: none !important;
}

.cm-editor .cm-activeLineGutter {
    background-color: var(--bg-dark) !important;
}

.cm-editor .cm-activeLine {
    background-color: rgba(0, 0, 0, 0.04) !important;
}

[data-theme="dark"] .cm-editor .cm-activeLine {
    background-color: #2c313a !important;
}

.cm-editor .cm-selectionBackground {
    background-color: rgba(52, 152, 219, 0.2) !important;
}

.cm-editor .cm-cursor {
    border-left-color: var(--primary-color) !important;
    border-left-width: 2px !important;
}

.logo-image {
    width: 48px !important;
    height: 48px !important;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(52, 152, 219, 0.3));
    transition: transform 0.2s ease;
}

.logo-image:hover {
    transform: scale(1.05);
}

[data-theme="dark"] .cm-editor {
    background-color: var(--editor-bg) !important;
    color: var(--editor-text) !important;
    caret-color: white !important;
}

[data-theme="dark"] .cm-editor .cm-content {
    caret-color: white !important;
}

[data-theme="dark"] .cm-editor .cm-cursor, 
[data-theme="dark"] .cm-editor .cm-dropCursor {
    border-left-color: white !important;
}

.cm-editor .cm-gutters {
    background-color: var(--editor-gutter) !important;
    color: var(--text-muted) !important;
    border: none !important;
}

.cm-editor .cm-line.default-text {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .cm-editor .cm-line.default-text {
    color: #676e95 !important;
}

.cm-content .cm-comment {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .cm-content .cm-comment {
    color: #676e95 !important;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    padding: 0.5rem;
    cursor: pointer;
    margin-right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    background-color: var(--bg-darker);
}

.theme-toggle:hover {
    background-color: var(--bg-darkest);
}

.proto-editor {
    flex: 1;
    overflow: hidden;
    margin-top: 0;
}