/* Main container */
.chatbot-config-dashboard {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    background: #0b2640;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #b8bec8;
    border: 3px solid #00bf63;
}

.support-note {
    color: #555E72; /* Matches the darker text color */
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0; /* Optional separator */
}

.support-note p {
    color: #b8bec8; /* Your desired color */
    margin: 0; /* Removes default paragraph margins if needed */
}

/* Headings */
.chatbot-config-dashboard h2 {
    color: #b8bec8;
    margin-bottom: 1.5rem;
}

.chatbot-config-dashboard h3 {
    color: #555E72;
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.chatbot-config-dashboard h6 {
    color: #b8bec8;
}

/* Form elements */
.chatbot-config-form .form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #d3d7de;;
    border-radius: 8px;
}

.tooltip-icon {
  cursor: help;
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: #999; /* Muted color */
}

.tooltip-icon:hover::after {
  content: "Tips: Hold meldingen kort og enkel";
  background: #f8f8f8;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  position: absolute;
  font-size: 0.9em;
  white-space: nowrap;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555E72;
}

.form-group input,
.form-group textarea {
    width: 95%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* Code block container */
/* Updated CSS */
.embed-code-wrapper {
    /*background-color: #f5f5f5;*/
    border-radius: 8px;
    padding: 10px;
    /*margin: 10px auto;*/
    /*box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);*/
}

.code-block {
    background-color: #2d2d2d;
    color: #f8f8f2;
    border-radius: 6px;
    padding: 8px 8px 8px 30px;    
    font-family: 'Courier New', monospace;
    font-size: 14px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    display: flex;
    align-items: center;
    position: relative;
}

.code-block code {
    flex: 1;
    padding-right: 10px;
}

.copy-button {
    background: none;
    color: #aaaaaa;
    padding: 4px 6px;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.copy-button:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.copy-button:active {
    transform: scale(0.95);
}

/* Optional: Add tooltip */
.copy-button::after {
    content: "Kopier";
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 8px;
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
}

.copy-button:hover::after {
    opacity: 1;
}

/* Add line number */
.code-block::before {
    content: "1";
    position: absolute;
    left: 12px;    
    top: 8px;
    color: #6c757d;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
}

.code-block code {
    display: inline-block; /* Changed from block to better handle centering */
    line-height: 1.4; /* Slightly tighter line height */
    padding: 0; /* Remove any default padding */
    margin: 0; /* Remove any default margins */
}

.embed-code {
    margin: 5px;
}


/* Scrollbar styling */
.code-block::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-block::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 4px;
}

.code-block::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 4px;
}

.code-block::-webkit-scrollbar-thumb:hover {
    background: #5e5e5e;
}


/* QA Pairs */
.qa-pair {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.remove-qa-pair {
    background: #fc8181;
    color: white;
    margin-top: 0.5rem;
}

.remove-qa-pair:hover {
    background: #f56565;
}

/* Buttons */
.button {
    padding: 0.75rem 1.5rem;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 5px;
}

.button:hover {
    background: #3182ce;
    transform: translateY(-1px);
    cursor: pointer;
}

/* Loading animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    border: 3px solid rgba(0,0,0,0.1);
    border-left-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}


/* Modal base styling */
#ai-generate-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 2rem;
    border-radius: 8px;
    z-index: 10000;
    max-width: 600px;
    width: 90%;
}

.modal-actions {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

#ai-generate-modal.active {
    opacity: 1;
    pointer-events: auto;
}

#ai-generate-modal.active .modal-content {
    transform: translateY(0);
}

:root {
    --primary: #4f46e5;      /* Indigo */
    --primary-hover: #4338ca;
    --secondary: #0ea5e9;    /* Sky blue */
    --success: #10b981;      /* Emerald */
    --warning: #f59e0b;      /* Amber */
    --danger: #ef4444;       /* Red */
    --light: #f8fafc;        /* Slate 50 */
    --dark: #1e293b;         /* Slate 800 */
    --border: #e2e8f0;       /* Slate 200 */
}

/* Apply the colors */
.button-primary {
    background-color: var(--primary);
}

.button-primary:hover {
    background-color: var(--primary-hover);
}

.add-all-btn {
    background-color: var(--success);
}

.add-all-btn:hover {
    background-color: #0d9488;
}

.add-pair-btn {
    background-color: var(--secondary);
}

.remove-qa-pair {
    background-color: var(--danger);
}

.form-section {
    border-left: 3px solid var(--primary);
}

.ai-generation-section button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    font-weight: 600;
}

/* Modal styling */
.modal-content {
    border-top: 4px solid var(--primary);
}

/* Save status styling */
#save-status.success {
    background-color: var(--success);
}

#save-status.error {
    background-color: var(--danger);
}


.modal-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    padding: 25px;
    position: relative; /* For positioning close button */
    max-height: 80vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Button styling */
.cancel-ai-generate {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    color: #333;
    border: none;
    font-size: 16px;
    cursor: pointer;
}

.generated-pairs-list {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
}


.generated-pair {
    padding: 1rem;
    border-bottom: 1px solid #edf2f7;
}


/* Footer area for bottom actions */
.modal-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
    margin-top: auto;
    text-align: right;
}

/* Status messages */
#save-status {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}

#save-status.success {
    background: #48bb78;
}

#save-status.error {
    background: #f56565;
}

#ai-input-text {
    width: 100%;
    min-height: 150px;
    margin: 10px 0;
}

#generation-status {
    margin: 15px 0;
}


.unanswered-questions-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #fff8f0;
    border-radius: 8px;
    border-left: 4px solid #f6ad55;
}

.unanswered-questions-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.unanswered-questions-list li {
    padding: 1rem;
    margin: 0.5rem 0;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column; /* 👈 This stacks elements vertically */
    gap: 0.5rem;
}

.question-text {
    flex: 1 1 60%;
    min-width: 300px;
    color: #393939;
}

.question-date {
    color: #718096;
    font-size: 0.9em;
}

.mark-resolved {
    background-color: #f6ad55;
}

.question-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.question-email {
    font-size: 0.85rem;
    color: #4a5568; /* soft gray */
    font-weight: normal; /* less bold */
}

.question-email strong {
    font-weight: 500;
    margin-right: 0.25rem;
    color: #718096; /* even softer gray */
}

.loading { color: #666; font-style: italic; }
.success { color: #22863a; font-weight: bold; }
.error { color: #cb2431; font-weight: bold; }

/* --- Chat History Styles --- */

.chat-sessions-list-container {
    margin-bottom: 2rem;
    max-height: 300px; /* Limit height and make scrollable */
    overflow-y: auto;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    padding: 0.5rem;
    background-color: #fff; /* White background for the list */
}

.chat-sessions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chat-session-item {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex; /* Use flexbox for alignment */
    justify-content: space-between; /* Space out elements */
    align-items: center;
    color: #333; /* Darker text for readability */
}

.chat-session-item:last-child {
    border-bottom: none;
}

.chat-session-item:hover {
    background-color: #f0f4f8; /* Light hover effect */
}

.chat-session-item.selected {
    background-color: #ddebf8; /* Highlight selected item */
    font-weight: 500;
}

.chat-session-item .session-time {
    font-size: 0.9em;
    color: #555;
}

.chat-session-item .session-id {
    font-size: 0.8em;
    color: #777;
    font-family: monospace;
}

.chat-session-item .unresolved-indicator {
    color: #f59e0b; /* Amber color for warning */
    font-weight: bold;
    margin-left: 0.5rem;
    font-size: 1.1em;
}

#chat-history-detail-container {
    margin-top: 1.5rem;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    background-color: #fff; /* White background for message area */
    color: #333; /* Darker text */
}

#chat-history-detail-container h4 {
     margin: 0;
     padding: 1rem 1.5rem;
     border-bottom: 1px solid var(--border, #e2e8f0);
     background-color: #f8fafc; /* Slightly different header background */
     border-radius: 6px 6px 0 0;
     color: #555E72;
}

.chat-history-messages {
    padding: 1rem 1.5rem;
    max-height: 500px; /* Limit height */
    overflow-y: auto;
    min-height: 100px; /* Ensure it has some height */
}

.chat-history-placeholder {
    color: #777;
    text-align: center;
    padding: 30px;
}

/* --- Individual Chat Message Styles --- */
.chat-message {
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    max-width: 85%;
    clear: both; /* Ensure messages don't overlap weirdly */
    word-wrap: break-word; /* Break long words */
}

.chat-message.message-user {
    background-color: #e1f5fe; /* Light blue for user */
    margin-left: auto; /* Align user messages to the right */
    border-bottom-right-radius: 0; /* Chat bubble effect */
    text-align: right;
}

.chat-message.message-bot {
    background-color: #f1f1f1; /* Light grey for bot */
    margin-right: auto; /* Align bot messages to the left */
    border-bottom-left-radius: 0; /* Chat bubble effect */
    text-align: left;
}

.chat-message .message-sender {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 0.2rem;
}

.chat-message .message-content {
    font-size: 1rem;
    line-height: 1.4;
}

.chat-message .message-timestamp {
    font-size: 0.75em;
    color: #999;
    margin-top: 0.4rem;
}

/* --- Basic Modal Styles --- */
.chat-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 10000; /* High z-index */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Darker overlay */
    padding-top: 50px;
}

.chat-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 20px 25px 30px 25px; /* More padding bottom */
    border: 1px solid #888;
    width: 90%;
    max-width: 700px; /* Wider modal for chat */
    border-radius: 8px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    color: #333; /* Ensure text is readable */
}

.chat-modal-content h4 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #555E72;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.8rem;
}


.chat-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.chat-modal-close:hover,
.chat-modal-close:focus {
    color: #333;
    text-decoration: none;
}

#chat-modal-messages {
    max-height: 60vh; /* Limit height inside modal */
    overflow-y: auto;
    padding-right: 10px; /* Space for scrollbar */
}

/* Specific styling for messages inside modal if needed */
#chat-modal-messages .chat-message {
    max-width: 90%; /* Slightly wider messages in modal */
}

/* Unanswered question list item flag */
.unanswered-questions-list li {
    position: relative; /* Needed if using absolute positioning for indicators */
}

/* Style the view chat button */
.view-chat-button {
    background-color: #60a5fa; /* Blue color */
    color: white;
}
.view-chat-button:hover {
    background-color: #3b82f6;
}

/* --- Q&A Scrollable Section Styles --- */

.qa-scroll-container {
    max-height: 60vh; /* Adjust height as needed - e.g., 60% of viewport height */
    min-height: 200px; /* Ensure it has some minimum height */
    overflow-y: auto;  /* Enable vertical scrollbar only when needed */
    border: 1px solid var(--border, #e2e8f0); /* Match existing style */
    border-radius: 6px; /* Match existing style */
    padding: 1rem;     /* Add padding inside the scroll area */
    margin-bottom: 1.5rem; /* Space below the scroll area */
    background-color: #ffffff; /* Optional: White background */
}

/* Style for the empty message inside scroll container */
.qa-empty-message {
    color: #777;
    text-align: center;
    padding: 2rem 1rem;
    font-style: italic;
}

/* Ensure individual QA pairs have appropriate margin */
.qa-scroll-container .qa-pair {
    margin-bottom: 1rem; /* Adjust spacing inside scroll area */
    padding: 1rem;
    background: #f8fafd; /* Slightly different background for pairs */
    border: 1px solid #eef2f7;
    border-radius: 4px;
}
.qa-scroll-container .qa-pair:last-child {
    margin-bottom: 0;
}


/* Action footer below the scroll area */
.qa-actions-footer {
    display: flex; /* Arrange buttons horizontally */
    flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
    gap: 0.8rem;   /* Space between buttons */
    align-items: center; /* Vertically align items if they wrap */
    padding-top: 1rem; /* Space above the buttons */
    border-top: 1px solid var(--border, #e2e8f0); /* Optional separator line */
    margin-top: 1rem; /* Ensure space even if scroll container content is short */
}

/* Target AI section specifically within the footer if needed */
.qa-actions-footer .ai-generation-section {
    margin-left: auto; /* Optional: Push AI button to the right */
}

/* Optional: Custom Scrollbar Styling (Webkit browsers like Chrome, Safari, Edge) */
.qa-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.qa-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.qa-scroll-container::-webkit-scrollbar-thumb {
    background: #b8bec8; /* Match your theme's gray */
    border-radius: 4px;
}

.qa-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #9fa6b2; /* Darker on hover */
}

/* Style for modal close button (if you use the class) */
.modal-close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #aaa;
    cursor: pointer;
    padding: 0;
}
.modal-close-button:hover {
    color: #333;
}