* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.container {
    display: flex;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    gap: 2rem;
}

.sidebar {
    flex: 1;
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    height: fit-content;
    max-height: 80vh;
    overflow-y: auto;
}

.sidebar h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    border-bottom: 2px solid #6a11cb;
    padding-bottom: 0.5rem;
}

.functions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
}

.function-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid #6a11cb;
    transition: all 0.3s ease;
    cursor: pointer;
}

.function-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background: #e3f2fd;
}

.function-card.added {
    background: #e8f5e8;
    border-left-color: #27ae60;
}

.function-name {
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #2c3e50;
    font-size: 0.9rem;
}

.function-desc {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
}

.selected-functions {
    min-height: 100px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.selected-function-item {
    background: #e8f5e8;
    border: 1px solid #27ae60;
    border-radius: 6px;
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.function-config {
    flex: 1;
    margin-right: 1rem;
}

.function-config textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8rem;
    resize: vertical;
    min-height: 40px;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-content {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.bot-configuration, .preview-section {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.config-section {
    margin-bottom: 2rem;
}

.config-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.input-group input, .input-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.input-group textarea {
    min-height: 100px;
    resize: vertical;
}

.command-item, .button-item, .message-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    align-items: center;
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 5px;
}

.command-item input, .button-item input, .message-item input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.command-buttons, .message-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.button-attach, .buttons-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-width: 150px;
}

.buttons-select {
    height: 80px;
    min-width: 200px;
}

.add-btn-to-message {
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
}

.remove-command, .remove-button, .remove-message {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #2980b9;
}

.bot-preview {
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
}

.chat-container {
    height: 400px;
    background: #f0f2f5;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.chat-message {
    max-width: 80%;
    margin-bottom: 1rem;
    padding: 0.8rem;
    border-radius: 10px;
    position: relative;
}

.bot-message {
    align-self: flex-start;
    background: white;
    border-bottom-left-radius: 0;
}

.user-message {
    align-self: flex-end;
    background: #6a11cb;
    color: white;
    border-bottom-right-radius: 0;
}

.keyboard-preview {
    margin-top: 0.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.keyboard-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.keyboard-button {
    flex: 1;
    padding: 0.7rem;
    background: #e9ecef;
    border: none;
    border-radius: 5px;
    text-align: center;
    cursor: pointer;
    font-size: 0.9rem;
}

.get-code-section {
    text-align: center;
    margin: 2rem 0;
}

.btn-primary {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(106, 17, 203, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(106, 17, 203, 0.4);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
}

.close:hover {
    color: #34495e;
}

.code-output {
    margin-top: 1rem;
    background: #2d3748;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.9rem;
}

.action-buttons {
    display: none;
    margin-top: 1rem;
    gap: 1rem;
    justify-content: center;
}

.btn-download, .btn-copy {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-download {
    background: #27ae60;
    color: white;
}

.btn-download:hover {
    background: #219653;
    transform: translateY(-2px);
}

.btn-copy {
    background: #3498db;
    color: white;
}

.btn-copy:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-copy.copied {
    background: #2ecc71;
}

.success-message {
    color: #27ae60;
    text-align: center;
    margin-top: 0.5rem;
    font-weight: 600;
    display: none;
}

footer {
    background: #2c3e50;
    color: white;
    padding: 2rem 1rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-content p {
    flex: 1;
    text-align: left;
    margin-right: 2rem;
}

.btn-channel {
    background: #3498db;
    color: white;
    padding: 0.7rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    transition: background 0.3s;
}

.btn-channel:hover {
    background: #2980b9;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .footer-content p {
        text-align: center;
        margin-right: 0;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .command-item, .button-item, .message-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .command-buttons, .message-buttons {
        justify-content: space-between;
    }
}
