/* Custom styles for the Chatbot */

body {
    background-color: #f8f9fa;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark mode styles */
body.dark-mode {
    background-color: #212529;
    color: #f8f9fa;
}

body.dark-mode .navbar {
    background-color: #343a40 !important;
}

body.dark-mode .card {
    background-color: #343a40;
    border-color: #495057;
    color: #f8f9fa;
}

/* Dark mode for modals */
body.dark-mode .modal-content {
    background-color: #343a40;
    color: #f8f9fa;
    border-color: #495057;
}
body.dark-mode .modal-header,
body.dark-mode .modal-body,
body.dark-mode .modal-footer {
    border-color: #495057;
}
body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%);
}

/* Dark mode for accordions */
body.dark-mode .accordion-item {
    background-color: #343a40;
    border-color: #495057;
}
body.dark-mode .accordion-button {
    background-color: #343a40;
    color: #f8f9fa;
}
body.dark-mode .accordion-button:not(.collapsed) {
    background-color: #3b4147;
    color: #f8f9fa;
}
body.dark-mode .accordion-button::after {
    filter: invert(1) grayscale(100%);
}
body.dark-mode .accordion-body {
    background-color: #343a40;
    color: #f8f9fa;
}

/* Dark mode for lists */
body.dark-mode .list-group-item {
    background-color: #343a40;
    color: #f8f9fa;
    border-color: #495057;
}

/* Dark mode for tables */
body.dark-mode table,
body.dark-mode .table,
body.dark-mode .table-bordered {
    color: #f8f9fa;
}
body.dark-mode .table thead,
body.dark-mode .table-light,
body.dark-mode .table thead th {
    background-color: #2b3035 !important;
    color: #f8f9fa !important;
}
body.dark-mode .table-bordered > :not(caption) > * > * {
    border-color: #495057;
}

/* Dark mode for alerts */
body.dark-mode .alert {
    background-color: #343a40;
    color: #f8f9fa;
    border-color: #495057;
}

/* Inputs/selects */
body.dark-mode .form-control::placeholder {
    color: #adb5bd;
}

body.dark-mode .chat-item {
    background-color: #343a40;
}

body.dark-mode .chat-item:hover {
    background-color: #495057;
}

body.dark-mode .user-message {
    background-color: #1a3a5f;
    border-left-color: #0d6efd;
}

body.dark-mode .ai-message {
    background-color: #3a2a4d;
    border-left-color: #6f42c1;
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #343a40;
    border-color: #495057;
    color: #f8f9fa;
}

body.dark-mode .chat-history::-webkit-scrollbar-track {
    background: #343a40;
}

body.dark-mode .chat-history::-webkit-scrollbar-thumb {
    background: #adb5bd;
}

/* Muted text adjustment */
body.dark-mode .text-muted {
    color: #adb5bd !important;
}

.jumbotron {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Dark mode jumbotron */
body.dark-mode .jumbotron {
    background: linear-gradient(135deg, #2b3035 0%, #343a40 100%);
    color: #f8f9fa;
}

.chat-item {
    background-color: #f8f9fa;
    transition: background-color 0.3s ease;
}

.chat-item:hover {
    background-color: #e9ecef;
}

.user-message {
    background-color: #e3f2fd;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    border-left: 4px solid #2196f3;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.user-message:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.ai-message {
    background-color: #f3e5f5;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    border-left: 4px solid #9c27b0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.ai-message:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Middle box styling (grey color) */
.middle-box {
    background-color: #e9ecef;
    border-left-color: #6c757d;
    border-radius: 0 !important; /* Sharp edges - overrides the inherited border-radius */
    border: 2px solid #6c757d; /* Add a solid border all around */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important; /* Different shadow than other messages */
}


body.dark-mode .middle-box {
    background-color: #495057;
    border-left-color: #adb5bd;
}

/* Message separator styling */
.message-separator {
    border: 0;
    height: 1px;
    background-color: #9c27b0;
    margin: 15px 0;
    width: 100%;
}

body.dark-mode .message-separator {
    background-color: #6f42c1;
}


.message-header {
    margin-bottom: 8px;
}

.message-content {
    line-height: 1.6;
    white-space: pre-wrap;
}

.navbar-brand {
    font-weight: bold;
}

.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid rgba(0, 0, 0, 0.125);
}

.btn {
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #2196f3, #0d6efd);
    border: none;
}

.btn-success {
    background: linear-gradient(135deg, #4caf50, #198754);
    border: none;
}

.btn-warning {
    background: linear-gradient(135deg, #ff9800, #fd7e14);
    border: none;
    color: white;
}

.btn i {
    font-size: 1rem;
}

.form-control, .form-select {
    border-radius: 10px;
    padding: 10px 15px;
    transition: all 0.3s ease;
    border: 1px solid #ced4da;
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
    border-color: #86b7fe;
}

/* Input group styling */
.input-group {
    margin-top: 15px;
    gap: 8px;
    flex-wrap: nowrap;
}

/* Button spacing */
.d-flex.justify-content-end.gap-2 {
    margin-bottom: 15px;
}

/* Card styling */
.card {
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark-mode .card-header {
    background: linear-gradient(135deg, #343a40, #212529);
}

.chat-history {
    scrollbar-width: thin;
    scrollbar-color: #6c757d #f8f9fa;
}

.chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat-history::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.chat-history::-webkit-scrollbar-thumb {
    background: #6c757d;
    border-radius: 3px;
}

.conversation {
    max-height: 500px;
    overflow-y: auto;
}

/* Full-height chat window with auto scrollbars */
.chat-messages {
    height: calc(80vh - 200px);
    overflow-y: auto;
}

/* Target the chat messages container directly */
.card-body .flex-grow-1.mb-3 {
    height: calc(80vh - 200px) !important;
    max-height: none !important;
    overflow-y: auto;
}

/* Emoji picker styles */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.emoji-btn:hover {
    background-color: #f0f0f0;
}

body.dark-mode .emoji-btn:hover {
    background-color: #495057;
}

/* Help button tooltip */
.tooltip {
    font-size: 0.875rem;
}

/* Font size buttons */
.btn-group .btn {
    padding: 0.375rem 0.5rem;
}

/* Report issue button */
#report-issue-btn {
    background: linear-gradient(135deg, #dc3545, #c82333);
    border: none;
}

/* Responsive adjustments for buttons row */
@media (max-width: 768px) {
    .d-flex.justify-content-between.mt-3 {
        flex-direction: column;
        gap: 10px;
    }

    .d-flex.justify-content-between.mt-3 > div {
        width: 100%;
        justify-content: center;
    }
}
