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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

.library-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 10px;
    margin-top: 15px;
    font-size: 0.9rem;
}

.content {
    padding: 30px;
}

.section {
    margin-bottom: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    border-left: 4px solid #4facfe;
    transition: all 0.3s ease;
}

.section:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section h3 {
    color: #444;
    margin: 15px 0 10px 0;
    font-size: 1.1rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #dc3545;
    transition: all 0.3s ease;
}

.status-indicator.connected {
    background: #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5);
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

input[type="text"], input[type="number"], select, textarea {
    flex: 1;
    min-width: 150px;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
    transform: translateY(-1px);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.message {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.topics-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.topic-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
}

.topic-remove {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.messages-console {
    background: #1a1a1a;
    color: #00ff00;
    padding: 20px;
    border-radius: 10px;
    height: 350px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    border: 2px solid #333;
}

.message-item {
    margin-bottom: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #333;
    animation: fadeIn 0.3s ease;
}

.message-timestamp {
    color: #888;
    font-size: 12px;
}

.message-topic {
    color: #4facfe;
    font-weight: bold;
}

.message-content {
    color: #00ff00;
    margin-top: 3px;
    white-space: pre-wrap;
}

.send-section {
    background: #e8f5e8;
    border-left-color: #28a745;
}

/* Styles pour les messages */
.message-item {
    margin-bottom: 15px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #fafafa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-weight: bold;
}

.message-timestamp {
    color: #666;
    font-size: 0.9em;
}

.message-topic {
    color: #2196F3;
    font-weight: bold;
}

.json-badge {
    background-color: #4CAF50;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: normal;
}

/* Styles pour le contenu JSON formaté */
.json-content {
    font-family: 'Courier New', Monaco, monospace;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
}

.json-formatted {
    line-height: 1.6;
    font-size: 14px;
}

/* Styles pour les différents types de données JSON */
.json-key {
    color: #d73a49;
    font-weight: bold;
}

.json-string {
    color: #032f62;
}

.json-number {
    color: #005cc5;
}

.json-boolean {
    color: #d73a49;
    font-weight: bold;
}

.json-null {
    color: #6a737d;
    font-style: italic;
}

.json-bracket {
    color: #24292e;
    font-weight: bold;
}

.json-colon {
    color: #24292e;
    margin: 0 4px;
}

.json-comma {
    color: #24292e;
}

/* Styles pour le JSON brut (replié par défaut) */
.raw-json {
    margin-top: 10px;
    border-top: 1px solid #ddd;
    padding-top: 10px;
}

.raw-json summary {
    cursor: pointer;
    color: #666;
    font-size: 0.9em;
    padding: 5px 0;
}

.raw-json summary:hover {
    color: #333;
}

.raw-json pre {
    background-color: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    padding: 10px;
    margin-top: 5px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.4;
}

/* Styles pour le contenu texte normal */
.text-content {
    font-family: 'Courier New', Monaco, monospace;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Styles pour les headers */
.message-headers {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.headers-content {
    background-color: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    padding: 8px;
    margin-top: 5px;
    font-size: 12px;
    overflow-x: auto;
}

/* Filtre et recherche */
.filter-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.history-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
    cursor: pointer;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 15px;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .content {
        padding: 20px;
    }

    .input-group, .input-row {
        flex-direction: column;
    }

    input[type="text"], input[type="number"] {
        min-width: auto;
    }
}
