/* ChatBot Styles - Fixed Height */
#chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

#chatbot-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #5777ba, #2B4B9A);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(87, 119, 186, 0.3);
    transition: all 0.3s ease;
}

#chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(87, 119, 186, 0.4);
}

#chatbot-button i {
    font-size: 24px;
    color: white;
}

#chatbot-container {
    position: absolute;
    bottom: 70px; /* Diubah dari 0 ke 70px agar tidak menutupi tombol */
    right: 0;
    width: 450px;
    max-width: 90vw;
    height: 500px;
    max-height: 100vh;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#chatbot-header {
    background: linear-gradient(135deg, #5777ba, #2B4B9A);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#chatbot-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 16px;
}

#chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
}

#chatbot-content {
    display: flex;
    flex-direction: column;
    height: calc(100% - 60px);
    overflow: hidden;
}

#chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    max-height: 250px; /* Diperkecil agar area input lebih besar */
    min-height: 150px;
}

.message {
    margin-bottom: 12px;
    max-width: 85%;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    margin-left: auto;
}

.message p {
    padding: 10px 12px;
    border-radius: 15px;
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}

.bot-message p {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
}

.user-message p {
    background: #5777ba;
    color: white;
    border-bottom-right-radius: 5px;
}

#chatbot-input-area {
    padding: 15px;
    background: white;
    flex-shrink: 0;
    border-top: 1px solid #e9ecef;
    max-height: 250px; /* Ditambahkan batas maksimum */
    overflow-y: auto; /* Bisa discroll jika konten terlalu panjang */
}

.input-step {
    transition: all 0.3s ease;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 5px;
}

.input-group input,
.input-group select,
.input-group textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: #5777ba;
    box-shadow: 0 0 0 3px rgba(87, 119, 186, 0.1);
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
    max-height: 120px;
}

/* PERBAIKAN UTAMA: Button Styling agar terlihat jelas */
.btn-primary {
    background: linear-gradient(135deg, #5777ba, #2B4B9A);
    color: white;
    border: none;
    padding: 14px 20px; /* Padding diperbesar */
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px; /* Font size diperbesar */
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: inherit;
    display: block;
    width: 100%;
    margin-top: 10px; /* Margin atas ditambahkan */
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(87, 119, 186, 0.3);
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 14px 20px; /* Padding diperbesar */
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px; /* Font size diperbesar */
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: inherit;
    display: block;
    width: 100%;
    margin-top: 10px; /* Margin atas ditambahkan */
}

.btn-secondary:hover {
    background: #545b62;
    transform: translateY(-2px);
}

.button-group {
    display: flex;
    gap: 10px; /* Gap diperbesar */
    margin-top: 15px; /* Margin atas diperbesar */
}

.button-group .btn-primary,
.button-group .btn-secondary {
    flex: 1;
    font-size: 13px;
    padding: 12px 15px; /* Padding diperbesar */
    margin-top: 0; /* Reset margin top untuk button group */
}

/* Tagging Options Styling - Compact Version */
.tagging-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0;
}

.tag-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1.5px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    position: relative;
}

.tag-option:hover {
    border-color: #5777ba;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(87, 119, 186, 0.1);
}

.tag-option.selected {
    border-color: #5777ba;
    background: #f8f9ff;
}

.tag-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #5777ba, #2B4B9A);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.tag-icon i {
    font-size: 16px;
    color: white;
}

.tag-content {
    flex: 1;
}

.tag-content h6 {
    margin: 0 0 2px 0;
    font-weight: 600;
    color: #333;
    font-size: 12px;
}

.tag-content p {
    margin: 0;
    color: #6c757d;
    font-size: 10px;
    line-height: 1.3;
}

.tag-check {
    width: 18px;
    height: 18px;
    border: 1.5px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.tag-option.selected .tag-check {
    background: #28a745;
    border-color: #28a745;
}

.tag-check i {
    font-size: 10px;
    color: white;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tag-option.selected .tag-check i {
    opacity: 1;
}

/* FAQ List Styling - Compact */
.faq-list {
    max-height: 180px;
    overflow-y: auto;
    margin: 10px 0;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: white;
}

.faq-item {
    padding: 8px 10px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item:hover {
    background: #f8f9ff;
}

.faq-item.active {
    background: #f8f9ff;
    border-left: 2px solid #5777ba;
}

.faq-item-icon {
    width: 20px;
    height: 20px;
    background: #e9ecef;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.faq-item-icon i {
    font-size: 12px;
    color: #6c757d;
}

.faq-item:hover .faq-item-icon {
    background: #5777ba;
}

.faq-item:hover .faq-item-icon i {
    color: white;
}

.faq-question {
    flex: 1;
    font-size: 11px;
    line-height: 1.3;
    color: #333;
    font-weight: 500;
}

.faq-item:hover .faq-question {
    color: #5777ba;
}

/* Question Type Badge - Compact */
.question-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #5777ba, #2B4B9A);
    color: white;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 8px;
}

.question-type-badge i {
    font-size: 12px;
}

/* Question Tips - Compact */
.question-tips {
    margin: 6px 0;
    padding: 6px 8px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    font-size: 10px;
    color: #856404;
    line-height: 1.3;
}

.question-tips i {
    margin-right: 4px;
}

/* FAQ Answer Styling - Compact */
.faq-answer-header {
    background: #f8f9ff;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    border-left: 3px solid #5777ba;
}

.faq-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #5777ba;
    color: white;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 600;
    margin-bottom: 6px;
}

.faq-badge i {
    font-size: 10px;
}

#faq-question-text {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.faq-answer-content {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    font-size: 11px;
    line-height: 1.4;
    color: #333;
    max-height: 150px;
    overflow-y: auto;
}

/* Success Animation - Compact */
.success-animation {
    text-align: center;
    margin-bottom: 12px;
}

.success-animation i {
    font-size: 36px;
    color: #28a745;
    animation: bounceIn 0.6s ease;
}

.end-message {
    text-align: center;
    color: #28a745;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 12px;
}

/* Input Group - Compact */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    color: #333;
    font-size: 12px;
    margin-bottom: 4px;
}

.input-group input,
.input-group select,
.input-group textarea {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: #5777ba;
    box-shadow: 0 0 0 2px rgba(87, 119, 186, 0.1);
}

.input-group textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 80px;
    font-size: 11px;
}

/* Adjust chatbot content area for compact design */
#chatbot-input-area {
    padding: 12px;
}

/* CSS untuk HTML answers di chat */
.html-answer .html-content {
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    background: white;
    padding: 12px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.html-answer .html-content p {
    margin-bottom: 8px;
    line-height: 1.4;
}

.html-answer .html-content ol,
.html-answer .html-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.html-answer .html-content li {
    margin-bottom: 4px;
    padding-left: 8px;
}

.html-answer .html-content strong,
.html-answer .html-content b {
    font-weight: 600;
    color: #2c3e50;
}

.html-answer .html-content br {
    content: "";
    display: block;
    margin-bottom: 4px;
}

/* Memastikan konten HTML tidak melebihi lebar chat */
.html-answer .html-content {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Styling untuk o:p tags yang umum di HTML dari Word */
.html-answer .html-content o\:p {
    display: block;
    margin-bottom: 4px;
}

/* CSS untuk tabel di chat message */
.html-answer .html-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 11px;
}

.html-answer .html-content th {
    background-color: #f8f9fa;
    font-weight: 600;
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    text-align: left;
}

.html-answer .html-content td {
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    background-color: white;
}

.html-answer .html-content tr:nth-child(even) td {
    background-color: #f8f9fa;
}

/* Untuk tabel dalam format teks (dengan |) */
.table-text {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.3;
    background-color: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    margin: 4px 0;
}

.table-header {
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 4px;
    margin-bottom: 4px;
}

.table-row {
    padding: 2px 0;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .tag-option {
        padding: 8px 10px;
    }
    
    .tag-icon {
        width: 28px;
        height: 28px;
        margin-right: 8px;
    }
    
    .tag-icon i {
        font-size: 14px;
    }
    
    .tag-content h6 {
        font-size: 11px;
    }
    
    .tag-content p {
        font-size: 9px;
    }
    
    .faq-question {
        font-size: 10px;
    }
    
    .faq-answer-content {
        font-size: 10px;
        padding: 10px;
        max-height: 120px;
    }
    
    .html-answer .html-content {
        font-size: 12px;
        padding: 10px;
    }
}

@media (max-width: 375px) {
    .tagging-options {
        gap: 6px;
    }
    
    .tag-option {
        padding: 6px 8px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 6px;
    }
    
    .button-group .btn-primary,
    .button-group .btn-secondary {
        font-size: 10px;
        padding: 5px 10px;
    }
}

@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}