/* RESET CSS CƠ BẢN */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  border: none;
  background: none;
  outline: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}



body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f0f0f0;
}

button.primary {
    padding: 12px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 17px;
    cursor: pointer;
    transition: background 0.2s;
}

button.primary:hover {
    background: linear-gradient(45deg, #5b6ce0, #6b4399);
}

button.secondary {
    padding: 12px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 17px;
    cursor: pointer;
    transition: background 0.2s;
}

button.secondary:hover {
    background: #d5d5d5;
}

.container {
    text-align: center;
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 100%;
    margin: auto;
}

#timer,
#latency {
    margin-top: 1rem;
    font-weight: bold;
}

#logArea {
    width: 100%;
    height: 100px;
    margin-top: 1rem;
    padding: 0.5rem;
    border: 1px solid #ccc;
    overflow-y: auto;
    text-align: left;
    font-family: monospace;
    font-size: 0.9rem;
}

#conversationLog {
    width: 100%;
    height: 300px;
    border: 1px solid #ccc;
    overflow-y: auto;
    margin-top: 1rem;
    padding: 0.5rem;
    font-family: Arial, sans-serif;
}

#conversationLog .user-message-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

#conversationLog .user-message-row span {
    align-self: center;
    cursor: pointer;
    display: inline;
}

#conversationLog .user-message-row span.report-btn-invisible {
    display: none;
}

#conversationLog p.user-message {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 15px;
    line-height: 1.4;
    border-bottom-right-radius: 0;
}



.user-message {
    color: blue;
}

.ai-message {
    color: green;
}

.ai-message >p {
    margin: 0;
}

#latencyMetrics {
    margin-top: 10px;
    font-size: 0.9em;
    font-family: monospace;
}

#latencyMetrics table {
    width: 100%;
    border-collapse: collapse;
}

#latencyMetrics th,
#latencyMetrics td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

#latencyMetrics th {
    background-color: #f2f2f2;
    font-weight: bold;
}

#recordButton {
    margin-top: 10%;
}

.prompt-section {
    margin-top: 2rem;
    text-align: left;
}

.prompt-section h3 {
    margin-bottom: 0.5rem;
    color: #333;
}

.prompt-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.prompt-box {
    flex: 1;
}

.prompt-textarea {
    width: 100%;
    height: 150px;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    resize: vertical;
}

.prompt-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.prompt-buttons button {
    width: auto;
    margin: 0;
    padding: 0.3rem 0.8rem;
    font-size: 0.9rem;
}

button {
    font-size: 1rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

button {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#conversationLog {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: -webkit-fill-available;
}

#conversationLog >p {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 15px;
    line-height: 1.4;
}

#conversationLog p.ai-message {
    align-self: flex-start;
    background: #e6f0ff;
    color: #003366;
    border-bottom-left-radius: 0;
    text-align: left;
    word-wrap: break-word;;
}

#conversationLog p.user-message {
    align-self: flex-end;
    background: #d1ffd6;
    color: #004d1a;
    border-bottom-right-radius: 0;
    text-align: left;
    position: relative;
}

div.button-group {
    display: flex;
    gap: 8px;
}

.button-group button {
  flex: 1 1 0;
  width: 100%;
}

div.conversation-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

#conversationLog p.user-message.typing {
    background: #eaffec;
    color: #26734d;
    font-style: italic;
    opacity: 0.8;
}

.markdown-inside-code {
  border: 1px solid #ddd;
  padding: 0.75em;
  background: #f9f9f9;
  border-radius: 4px;
}

#img-bot {
    width: 35%;
    height: calc(100vh - 100px);
}

#img-bot img {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    transition: opacity 0.3s ease-in-out;
    border-radius: 8px;
}

#conversationLog {
    width: 64%;
    height: calc(100vh - 100px);
    max-height: 726px;
}

.container {
    padding: 2rem 1rem;
    height: 100vh;
    max-width: 1200px;
}

#status-wrapper {
    margin: 0.5rem;
    width: 100%;
    text-align: center;
    display: flex;
    font-weight: bold;
    justify-content: flex-end;
}

#status {
    width: 64%;
    margin-right: 0.75rem;
}

.fade-out {
    display: none;
}

.fade-in {
    display: block;
    opacity: 1;
    transition: opacity 0.5s ease-in;
}

.chat-main {
    height: 100%;
    display: flex;
}

/* Report Popup Styling - Harmonized with regionForm */
.report-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(51, 51, 51, 0.35); /* semi-transparent overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.report-popup-content {
    background: #fff;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.13);
    min-width: 340px;
    max-width: 420px;
    width: 100%;
    text-align: left;
    font-family: Arial, sans-serif;
}

.report-popup-content h3 {
    margin-top: 0;
    margin-bottom: 1.2rem;
    font-size: 1.3rem;
    color: #333;
    text-align: center;
}

.report-popup-content .report-text {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #444;
    background: #f7f7f7;
    padding: 0.7rem 1rem;
    border-radius: 6px;
}

.report-popup-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.report-popup-form label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: bold;
    color: #333;
}

.report-correction, .report-note {
    width: 100%;
    min-height: 80px;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.95rem;
    resize: vertical;
    background: #fafafa;
}

.report-popup-content .button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.report-error-msg {
    color: #ff5858;
    text-align: center;
}

.red {
    color: #ff5858;
}

.font-sm {
    font-size: 0.9rem;
}