html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

body {
  /* margin-bottom: 60px; */ /* Removed to allow chat to be centered for now if not docked */
  display: flex;
  justify-content: center; /* Center chat for standalone page view */
  align-items: center;    /* Center chat for standalone page view */
  min-height: 100vh;      /* Full viewport height */
  background-color: #f0f2f5; /* A slightly different light grey background */
  margin: 0; /* Ensure no default margins */
}

/* Chat Popup Styles */
.chat-popup {
    width: 760px; /* Adjusted width (2x) */
    max-width: 100%; /* Allow responsiveness */
    height: 900px; /* Adjusted height (1.5x) */
    max-height: 90vh; /* Max height relative to viewport */
    background-color: #ffffff;
    border-radius: 10px; /* Slightly more pronounced radius */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background-color: #004A99; /* Official SSF Blue - primary */
    color: white;
    padding: 12px 18px;
    font-size: 1.1em;
    font-weight: 600;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    text-align: center;
}

/* Message Area Styles */
.chat-messages {
    flex-grow: 1;
    padding: 12px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Space between messages */
    background-color: #f7f9fc; /* Softer background for messages */
}

.message {
    padding: 10px 15px;
    border-radius: 20px; /* Pill-shaped bubbles */
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.45;
    font-size: 0.9em;
}

.bot-message {
    background-color: #e1f0ff; /* Lighter, softer blue for bot */
    color: #1c3d5a; /* Darker text for better contrast */
    align-self: flex-start;
    border-bottom-left-radius: 5px; /* Bubble tail effect */
}

.bot-message .message-content strong {
    font-weight: 600; /* Bolder important text */
}

.bot-message .citation {
    display: inline-block;
    background-color: #007bff; /* Bootstrap primary blue for citations */
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    margin: 0 2px;
    cursor: pointer;
    font-weight: bold;
}
.bot-message .citation:hover {
    background-color: #0056b3;
}

.bot-message .source-links {
    margin-top: 10px;
    font-size: 0.85em;
    border-top: 1px solid #d1e0ec; 
    padding-top: 8px;
}

.bot-message .source-links p {
    margin-bottom: 5px;
    font-weight: 600; /* Bolder "Källor:" */
    color: #004A99;
}

.bot-message .source-links ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.bot-message .source-links ul li {
    margin-bottom: 4px;
}

.bot-message .source-links ul li a {
    color: #0056a0; /* Consistent link color */
    text-decoration: none;
}
.bot-message .source-links ul li a:hover {
    text-decoration: underline;
    color: #003d73;
}

.user-message {
    background-color: #20c997; /* A vibrant, friendly green for user */
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px; /* Bubble tail effect */
}

/* Input Area Styles */
.chat-input-container {
    display: flex;
    padding: 12px 15px;
    border-top: 1px solid #dde1e6;
    background-color: #f0f2f5; /* Consistent with body background */
}

.chat-input {
    flex-grow: 1;
    border: 1px solid #ced4da;
    border-radius: 20px;
    padding: 10px 18px;
    margin-right: 10px;
    font-size: 0.95em;
}

.chat-input:focus {
    outline: none;
    border-color: #004A99; /* SSF Blue focus */
    box-shadow: 0 0 0 0.15rem rgba(0, 74, 153, 0.25);
}

.send-button {
    background-color: #004A99; /* SSF Blue */
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
}

.send-button:hover {
    background-color: #003366; /* Darker shade for hover */
}

/* Feedback buttons styles */
.feedback-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 74, 153, 0.1);
    justify-content: flex-end;
}

.feedback-btn {
    background: none;
    border: 1px solid rgba(0, 74, 153, 0.3);
    border-radius: 15px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease-in-out;
    min-width: 35px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-btn:hover {
    background-color: rgba(0, 74, 153, 0.1);
    border-color: rgba(0, 74, 153, 0.5);
    transform: scale(1.1);
}

.feedback-btn.clicked {
    background-color: rgba(0, 74, 153, 0.2);
    border-color: #004A99;
    font-size: 12px;
    font-weight: 500;
    color: #004A99;
    cursor: default;
    transform: none;
}

.feedback-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.feedback-btn:disabled:hover {
    background: none;
    border-color: rgba(0, 74, 153, 0.3);
    transform: none;
}

/* Responsive adjustments (example) */
@media (max-width: 480px) {
    .chat-popup {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }
    .chat-header, .chat-input-container {
        border-radius: 0; /* Remove radius on full screen */
    }
    
    .feedback-buttons {
        gap: 6px;
    }
    
    .feedback-btn {
        min-width: 30px;
        height: 28px;
        font-size: 14px;
    }
}

.footer {
  /* position: absolute; */ /* Commented out to prevent interference with centered chat */
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
}