* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: #333;
}

.container {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    background: white;
    border-radius: 0;
    box-shadow: none;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    flex-shrink: 0;
}

header h1 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 2em;
}

header p {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 8px;
}

.project-description {
    color: #666;
    font-size: 0.95em;
    margin: 0 auto 8px auto;
    max-width: 800px;
    text-align: left;
}

.project-description h2 {
    color: #667eea;
    font-size: 1.1em;
    margin: 12px 0 6px 0;
}

.project-description h2:first-child {
    margin-top: 0;
}

.project-description p {
    margin: 6px 0;
}

.project-description strong {
    color: #444;
}

.project-description code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 0.9em;
}

.project-meta {
    color: #888;
    font-size: 0.85em;
    margin-top: 8px;
}

.docs-nav {
    margin-top: 12px;
}

.docs-nav-link {
    color: #667eea;
    font-size: 0.9em;
    text-decoration: none;
}

.docs-nav-link:hover {
    text-decoration: underline;
}

.main-content {
    display: flex;
    gap: 20px;
    flex: 1;
}

.left-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.right-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.config-section,
.channels-section,
.subscriptions-section,
.messages-section,
.docs-section {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-shrink: 0;
}

.config-section.compact {
    padding: 12px;
}

.config-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}

.form-group-inline label {
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.form-group-inline input {
    flex: 1;
    padding: 6px 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    min-width: 150px;
}

.form-group-inline input:focus {
    outline: none;
    border-color: #667eea;
}

.button-group-inline {
    display: flex;
    gap: 6px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

.status-indicator-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: white;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9em;
}

.dropdown-section {
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.dropdown-section.messages-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dropdown-section.messages-section.collapsed {
    flex: 0 0 auto;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    cursor: pointer;
    user-select: none;
    border-bottom: 2px solid #e0e0e0;
    transition: background-color 0.2s;
}

.dropdown-header:hover {
    background: #f8f9fa;
}

.dropdown-header h2 {
    margin: 0;
    font-size: 1.1em;
    border: none;
    padding: 0;
    color: #333;
}

.dropdown-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-icon {
    font-size: 0.8em;
    color: #667eea;
    transition: transform 0.3s;
}

.dropdown-section.collapsed .dropdown-icon {
    transform: rotate(-90deg);
}

.dropdown-content {
    padding: 15px;
    max-height: 500px;
    overflow: visible;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.dropdown-section.collapsed .dropdown-content {
    max-height: 0;
    padding: 0 15px;
    overflow: hidden;
}

.dropdown-section.messages-section .dropdown-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 1000px;
    padding: 15px;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

.dropdown-section.messages-section.collapsed .dropdown-content {
    max-height: 0;
    padding: 0 15px;
    overflow: hidden;
    opacity: 0;
}

.messages-list {
    flex: 1;
    overflow: visible;
    min-height: 0;
}

/* Grafana 스타일 로그 뷰어: raw STOMP 프레임 표시 */
.messages-list.log-viewer {
    background: #1e1e1e;
    border-radius: 6px;
    padding: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    overflow-y: auto;
    max-height: 500px;
}

.log-line {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 10px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
    min-height: 0;
}

.log-line:hover {
    background: #2d2d2d;
}

.log-time-direction {
    flex-shrink: 0;
    width: 120px;
    font-size: 11px;
    white-space: nowrap;
}

.log-time-direction.out {
    color: #4ec9b0;
}

.log-time-direction.in {
    color: #ce9178;
}

.log-raw {
    flex: 1;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    color: #d4d4d4;
    white-space: pre;
    overflow-x: auto;
    min-width: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

.docs-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    margin-bottom: 0;
    background: transparent;
}

.asyncapi-docs {
    flex: 1;
    overflow: visible;
    background: white;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.asyncapi-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.doc-section {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 15px;
}

.doc-section:last-child {
    border-bottom: none;
}

.doc-section h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.doc-section pre {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    overflow: visible;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.85em;
    line-height: 1.5;
}

h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 0.85em;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    font-size: 12px;
    padding: 6px 12px;
}

.btn-secondary:hover {
    background: #5a6268;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    font-weight: 600;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.connected {
    background: #27ae60;
    box-shadow: 0 0 8px #27ae60;
}

.status-dot.disconnected {
    background: #e74c3c;
}

#connectionSessionId.session-id {
    font-size: 0.75rem;
    font-family: monospace;
    color: #666;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channels-list,
.subscriptions-list,
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.channel-card,
.subscription-card {
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.channel-card.subscribed {
    background: #f0fdf4;
}

.channel-card-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.channel-card .address {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
    flex: 1;
    word-break: break-all;
}

.channel-card .btn-subscribe {
    background: #27ae60;
    color: white;
    padding: 4px 10px;
    font-size: 0.8em;
    white-space: nowrap;
}

.channel-card .btn-subscribe:hover {
    background: #229954;
}

.channel-card .btn-unsubscribe {
    background: #e74c3c;
    color: white;
    padding: 4px 10px;
    font-size: 0.8em;
    white-space: nowrap;
}

.channel-card .btn-unsubscribe:hover {
    background: #c0392b;
}

.subscription-list {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subscription-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: white;
    border-radius: 4px;
    font-size: 0.85em;
}

.subscription-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}

.subscription-time {
    color: #888;
    font-size: 0.9em;
    white-space: nowrap;
}

.subscription-params {
    color: #667eea;
    font-weight: 500;
    white-space: nowrap;
}

.subscription-destination {
    font-family: 'Courier New', monospace;
    color: #333;
    word-break: break-all;
}

.subscription-card {
}

.subscription-card h3 {
    color: #27ae60;
    margin-bottom: 8px;
}

.subscription-card .btn-unsubscribe {
    background: #e74c3c;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
    margin-top: 8px;
}

.subscription-card .btn-unsubscribe:hover {
    background: #c0392b;
}

.message-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
}

.message-item .message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.message-item .message-channel {
    font-weight: 600;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

.message-item .message-time {
    color: #888;
    font-size: 0.85em;
}

.message-item .message-body {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
    word-break: break-all;
    overflow: visible;
}

.loading,
.empty {
    text-align: center;
    color: #888;
    padding: 20px;
    font-style: italic;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: visible;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.modal-content .form-group {
    margin-bottom: 15px;
}

.modal-content textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    min-height: 200px;
    resize: vertical;
}

.modal-content textarea:focus {
    outline: none;
    border-color: #667eea;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.error {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
}

.success {
    background: #efe;
    color: #3c3;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
}

/* Swagger UI 스타일 태그 */
.swagger-tags {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.swagger-tag {
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: white;
    overflow: hidden;
}

.swagger-tag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
    border-bottom: 1px solid #e0e0e0;
}

.swagger-tag-header:hover {
    background: #f0f0f0;
}

.swagger-tag-name {
    font-weight: 600;
    font-size: 1.05em;
    color: #667eea;
    font-family: 'Courier New', monospace;
    flex: 1;
}

.swagger-tag-toggle {
    color: #667eea;
    font-size: 0.8em;
    transition: transform 0.3s;
    margin-left: 10px;
    display: inline-block;
}

.swagger-tag-content {
    padding: 15px;
    background: white;
}

.message-item {
    margin: 8px 0;
    padding: 6px 0;
    font-size: 0.95em;
    line-height: 1.6;
}

.message-item-with-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.message-item-with-actions .message-direction {
    flex-shrink: 0;
}

.message-item-with-actions .message-name {
    flex: 1;
    min-width: 0;
}

.message-item-with-actions .btn-send-inline {
    flex-shrink: 0;
    background: #667eea;
    color: white;
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
}

.message-item-with-actions .btn-send-inline:hover {
    background: #5568d3;
}

.message-item-with-actions .message-schema {
    flex-basis: 100%;
    margin-left: 0;
}

/* Reply(응답) 블록 */
.message-reply {
    flex-basis: 100%;
    margin-top: 12px;
    margin-left: 0;
    padding: 10px 12px;
    background: #f0f7ff;
    border-left: 3px solid #2196f3;
    border-radius: 0 4px 4px 0;
}

.message-reply .reply-label {
    display: inline-block;
    font-weight: 600;
    color: #1976d2;
    font-size: 0.9em;
    margin-bottom: 4px;
}

.message-reply .reply-channel {
    display: block;
    font-size: 0.85em;
    color: #555;
    margin-bottom: 6px;
}

.message-reply .reply-schema {
    margin-top: 6px;
    margin-left: 0;
}

.message-indent {
    color: #999;
    font-family: monospace;
    margin-right: 4px;
}

.message-direction {
    color: #27ae60;
    font-weight: 600;
    margin-right: 8px;
    background: #e8f5e9;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.message-name {
    color: #333;
    font-weight: 500;
}

.empty-message {
    color: #999;
    font-style: italic;
}

.message-schema {
    margin-top: 0;
    margin-left: 20px;
}

.schema-indent {
    color: #999;
    font-family: monospace;
    margin-right: 4px;
}

.schema-label {
    color: #666;
    font-size: 0.9em;
    font-weight: 500;
}

.schema-container {
    margin: 8px 0 0 24px;
}

.schema-example {
    margin-top: 8px;
}

.schema-example-label {
    color: #667eea;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 6px;
}

.schema-content {
    margin: 0;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.85em;
    overflow: visible;
    border: 1px solid #e0e0e0;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
}

.schema-content.example-json {
    background: #f0f7ff;
    border: 1px solid #b3d9ff;
    color: #0066cc;
}
