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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background-color: #113811;
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header h1 {
    margin-bottom: 0.5rem;
    color: #8eff8e;
}

.header p {
    opacity: 0.8;
    font-size: 0.9rem;
}

.controls {
    background-color: #2a2a2a;
    padding: 1rem;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.name-settings {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.message-id-settings {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.name-settings label,
.message-id-settings label {
    font-weight: 500;
    color: #e0e0e0;
}

.name-settings input[type="text"],
.message-id-settings input[type="text"] {
    padding: 0.25rem 0.5rem;
    border: 1px solid #555;
    border-radius: 3px;
    font-size: 0.9rem;
    background-color: #333;
    color: #e0e0e0;
}

.name-settings input[type="text"] {
    width: 80px;
}

.message-id-settings input[type="text"] {
    width: 200px;
}

.name-settings input[type="text"]:focus,
.message-id-settings input[type="text"]:focus {
    outline: none;
    border-color: #8eff8e;
}

.swap-btn,
.clear-btn {
    background-color: #006700;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.3s;
    margin: 0 0.25rem;
}

.swap-btn:hover,
.clear-btn:hover {
    background-color: #113811;
    opacity: 0.8;
}

.swap-btn:active,
.clear-btn:active {
    transform: scale(0.95);
}

.convert-btn {
    background-color: #006700;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.convert-btn:hover {
    background-color: #113811;
    opacity: 0.8;
}

.convert-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
}

.main-container {
    flex: 1;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    min-height: 0;
}

.panel {
    flex: 1;
    background-color: #2a2a2a;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    background-color: #113811;
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 500;
}

.panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.json-input {
    flex: 1;
    border: none;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    background-color: #1e1e1e;
    color: #e0e0e0;
    line-height: 1.4;
}

.markdown-output {
    flex: 1;
    padding: 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-y: auto;
    background-color: #1e1e1e;
    color: #e0e0e0;
}

.markdown-output h1 {
    color: #8eff8e;
    border-bottom: 2px solid #113811;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.markdown-output h2 {
    color: #e0e0e0;
    margin: 1.5rem 0 0.5rem 0;
}

.markdown-output p {
    margin-bottom: 1rem;
}

.markdown-output strong {
    color: #8eff8e;
    font-weight: 600;
}

.error-message {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: #8b2635;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    max-width: 300px;
    text-align: left;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

.success-message {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: #113811;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    max-width: 300px;
    text-align: left;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

.error-message.fade-out,
.success-message.fade-out {
    animation: slideOut 0.3s ease-out forwards;
}

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

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

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: #006700;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.copy-btn:hover {
    opacity: 1;
}

.output-panel {
    position: relative;
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .controls {
        flex-direction: column;
        gap: 0.5rem;
    }
}
