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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.connection-selector {
    display: flex;
    gap: 8px;
}

.connection-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.connection-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.connection-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
    font-weight: 600;
}

.start-button {
    background: white;
    color: #667eea;
    border: none;
    border-radius: 8px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.start-button:active {
    transform: translateY(0);
}

.start-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff6b6b;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: #51cf66;
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
    background: #f8f9fa;
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.welcome-message {
    text-align: center;
    color: #666;
    padding: 40px 20px;
}

.welcome-message p {
    margin: 10px 0;
    font-size: 16px;
}

.message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-in;
}

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

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.message.streaming .message-content {
    position: relative;
}

.message.streaming .message-content::after {
    content: '▊';
    color: #667eea;
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.message-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
    padding: 0 4px;
}

.message.typing .message-content {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 12px 20px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.input-container {
    padding: 20px 30px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.3s;
}

#messageInput:focus {
    border-color: #667eea;
}

.send-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.controls {
    padding: 10px 30px 20px;
    background: white;
    display: flex;
    justify-content: center;
}

.clear-button {
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.clear-button:hover {
    background: #ff5252;
}

.generate-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-right: 10px;
}

.generate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.generate-button:active {
    transform: translateY(0);
}

.question-content {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-left: 4px solid #4caf50;
    font-weight: 500;
}

/* Formulář */
.form-container {
    padding: 20px 30px;
    background: #f8f9fa;
    max-height: calc(90vh - 200px);
    overflow-y: auto;
}

.form-header {
    margin-bottom: 20px;
    text-align: center;
}

.form-header h2 {
    color: #333;
    margin-bottom: 8px;
    font-size: 20px;
}

.form-header p {
    color: #666;
    font-size: 14px;
}

.esg-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-question {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-question:focus-within {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.form-question label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.form-question textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color 0.3s;
}

.form-question textarea:focus {
    border-color: #667eea;
}

.form-actions {
    padding: 20px 0;
    display: flex;
    justify-content: center;
}

.submit-form-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.submit-form-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.submit-form-button:active {
    transform: translateY(0);
}

.submit-form-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.error-message {
    background: #ffe0e0;
    color: #d32f2f;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #d32f2f;
}

/* Indikátor čekání */
.waiting-indicator {
    margin: 20px 0;
    padding: 16px;
    background: #f0f0f0;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.waiting-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #666;
}

.waiting-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Split View */
.split-view {
    display: flex;
    gap: 20px;
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    max-height: 400px;
    overflow: hidden;
}

.split-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    min-width: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.panel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.panel-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.copy-button {
    background: transparent;
    border: none;
    color: #667eea;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.copy-button:hover {
    background: #e8eaf6;
}

.download-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.download-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.download-button:active {
    transform: translateY(0);
}

.download-button svg {
    width: 14px;
    height: 14px;
}

.json-viewer {
    flex: 1;
    padding: 16px;
    margin: 0;
    overflow: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: #1e1e1e;
    color: #d4d4d4;
}

.parsed-viewer {
    flex: 1;
    padding: 20px;
    overflow: auto;
    font-size: 14px;
    line-height: 1.6;
    background: #fafafa;
}

/* Rich Content Styles */
.rich-content {
    width: 100%;
}

.rich-object,
.rich-array {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rich-item {
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    transition: all 0.2s;
}

.rich-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.rich-item-header {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    padding: 10px 14px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.rich-item-content {
    padding: 14px;
}

.rich-key {
    color: #667eea;
    font-weight: 600;
    text-transform: capitalize;
}

.rich-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
}

.rich-value {
    margin: 0;
    word-break: break-word;
}

.rich-string {
    color: #2d8659;
    font-weight: 500;
}

.rich-number {
    color: #0066cc;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.rich-boolean {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
}

.rich-boolean-true {
    background: #d4edda;
    color: #155724;
}

.rich-boolean-false {
    background: #f8d7da;
    color: #721c24;
}

.rich-null {
    color: #999;
    font-style: italic;
    font-family: 'Courier New', monospace;
}

.rich-link {
    color: #667eea;
    text-decoration: none;
    word-break: break-all;
    border-bottom: 1px dotted #667eea;
    transition: all 0.2s;
}

.rich-link:hover {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

.rich-text-block {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    white-space: pre-wrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 8px 0;
}

.rich-other {
    color: #666;
    font-family: 'Courier New', monospace;
}

.rich-truncated {
    color: #999;
    font-style: italic;
    padding: 8px;
    text-align: center;
}

/* Nested items */
.rich-item .rich-item {
    margin-top: 8px;
    border-color: #e8e8e8;
}

.rich-item .rich-item-header {
    background: #fafafa;
    font-size: 12px;
}

.json-error {
    padding: 16px;
    background: #ffe0e0;
    border-radius: 8px;
    border-left: 4px solid #d32f2f;
}

.json-error strong {
    color: #d32f2f;
    display: block;
    margin-bottom: 8px;
}

.json-error p {
    margin: 4px 0;
    color: #666;
}

.json-hint {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .container {
        height: 100vh;
        border-radius: 0;
    }
    
    header {
        padding: 15px 20px;
    }
    
    header h1 {
        font-size: 20px;
    }
    
    .chat-container {
        padding: 15px 20px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .input-container {
        padding: 15px 20px;
    }
    
    .split-view {
        flex-direction: column;
        padding: 15px 20px;
        max-height: none;
    }
    
    .split-panel {
        min-height: 200px;
    }
}
