:root {
    --bg-color: #343a40;
    --text-color: #fff;
    --sidebar-bg: #495057;
    --menu-item-bg: #3b3e42;
    --conversation-item-bg: #6c757d;
    --conversation-item-hover-text-color: #495057;
    --user-message-bg: #6c757d;
    --bot-message-bg: #495057;
    --pre-background-color: #343a40;
}

body.dark-theme {
    --bg-color: #343a40;
    --text-color: #fff;
    --sidebar-bg: #495057;
    --menu-item-bg: #3b3e42;
    --conversation-item-bg: #6c757d;
    --conversation-item-hover-text-color: #495057;
    --user-message-bg: #6c757d;
    --bot-message-bg: #495057;
    --pre-background-color: #343a40;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 0.98rem;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container-fluid {
    flex: 1 0 auto;
}

@media (min-width: 576px) {
    .col-sm-1_5 {
        flex: 0 0 auto;
        width: 12%;
    }
}
.navbar {
    --bs-navbar-padding-y: 1px; 
    border-bottom: 1px solid #ddd;
}
.navbar-brand {
    margin-right: 50px;
}

#loader {
    display: none;
}
.sidebar {
    min-height: 95vh;
    overflow-y: auto;
    background-color: var(--sidebar-bg);
    border-right: 1px solid #ddd;
}
.spacer {
    width: 100%;
    min-height: 12px;
    margin: 0 auto;
}

.menu-item {
    padding: 6px 16px;
    cursor: pointer;
    background-color: var(--menu-item-bg);
}

.menu-item:hover {
    background-color: #e9ecef;
    color: var(--conversation-item-hover-text-color)
}

.menu-active {
    color: var(--conversation-item-hover-text-color);
    background-color: #e9ecef;
}

.conversation-item {
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    background-color: var(--conversation-item-bg);
}

.conversation-item:hover {
    background-color: #e9ecef;
    color: var(--conversation-item-hover-text-color)
}

.conversation-active {
    color: var(--conversation-item-hover-text-color);
    background-color: #e9ecef;
}

.conversation-body {
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 4px 4px;
    border-bottom: 1px solid #aaa;
    box-sizing: border-box;
}
.input-group {
    position: fixed;
    bottom: 4px;
    width: calc(100% - 400px);
    padding: 2px 10px;
}

.settings-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
}
.user-message {
    background-color: var(--user-message-bg);
    padding: 6px 8px;
    margin-top: 0px;
    margin-bottom: 10px;
    margin-left: 40px;
    margin-right: 20px;
    border-radius: 6px;
    text-align: left;
}
.user-message p {
    padding: 8px 10px;    
    margin-bottom: -2px;
    margin-top: 2px;
}
.bot-message {
    background-color: var(--bot-message-bg);
    padding: 8px 10px;
    margin-top: 10px;
    margin-bottom: 8px;
    margin-left: 0px;
    margin-right: 20px;
    border-radius: 6px;
    text-align: left;
}        
.think-message {
    background-color: var(--think-message-bg);
    padding: 23px 10px 0px 10px;
    margin-top: 20px;
    margin-bottom: 8px;
    margin-left: 0px;
    margin-right: 20px;
    border-radius: 6px;
    text-align: left;
    max-height: 500px;
    overflow-y: auto;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    font-size: 90%;
}

.think-message::before {
    content: "deep think";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 2px 25px;
    border-radius: 3px;
}

.think-message.is-expanded {
    max-height: 1000px;
    opacity: 1;
}

.think-message:not(.is-expanded)::before {
    background-color: rgba(255, 255, 255, 0.7);
}
pre {
  border: 1px solid #030; 
  padding: 10px; 
  background-color: var(--pre-background-color)
}

code {
  background-color: var(--pre-background-color);
  color: var(--text-color)
}


.bot-message table {
    width: 100%;
    border-collapse: collapse;
}

.bot-message table,
.bot-message th,
.bot-message td {
    border: 1px solid #1f3b24;
}

.bot-message th,
.bot-message td {
    padding: 8px;
    text-align: left;
}

.bot-message th {
    background-color: #94aa94;
}

.loading-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 10px 20px 8px 0;
    background-color: #5a6268;
    border: 1px solid #6c757d;
    border-radius: 8px;
    color: #fff;
    font-size: 0.94rem;
    font-weight: 500;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ---- result container ---- */

.result-container {
    display: flex;
    gap: 16px;
    margin: 10px 20px 20px 0;
    align-items: flex-start;
}

.result-image {
    flex: 0 0 280px;
}

.result-image img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #5a6268;
    display: block;
}

.result-data {
    flex: 1;
    min-width: 0;
    background: #4a5058;
    border-radius: 8px;
    padding: 12px 14px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* badges */
.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-carnet        { background: #0d6efd; color: #fff; }
.badge-licencia      { background: #198754; color: #fff; }
.badge-ruat          { background: #fd7e14; color: #000; }
.badge-desconocido   { background: #dc3545; color: #fff; }

.btn-view-toggle {
    background: transparent;
    border: 1px solid #777;
    color: #ccc;
    padding: 2px 12px;
    border-radius: 4px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-view-toggle:hover {
    background: #5a6268;
    color: #fff;
    border-color: #999;
}

/* result table */
.result-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.result-table th {
    text-align: right;
    color: #adb5bd;
    font-weight: 400;
    padding: 3px 10px 3px 0;
    white-space: nowrap;
    vertical-align: top;
    width: 1%;
    line-height: 1.55;
}

.result-table td {
    color: #fff;
    padding: 3px 0 3px 10px;
    line-height: 1.55;
}

.result-table tr:nth-child(even) td,
.result-table tr:nth-child(even) th {
    background: rgba(255, 255, 255, 0.04);
}

.result-table .no-data {
    text-align: left;
    color: #adb5bd;
    font-style: italic;
    padding: 6px 0;
}

/* json view */
.result-json {
    background: #1e1e2e;
    border-radius: 6px;
    padding: 1px;
}

.result-json pre {
    margin: 0;
    padding: 10px 14px;
    border: 0;
    background: #1e1e2e;
    overflow-x: auto;
    max-height: 450px;
    overflow-y: auto;
}

.result-json code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.83rem;
    color: #cdd6f4;
    background: transparent;
    line-height: 1.5;
}

/* container loading */
.con-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    color: #ccc;
    font-size: 0.94rem;
}

/* responsive: stack on small screens */
@media (max-width: 768px) {
    .result-container {
        flex-direction: column;
    }

    .result-image {
        flex: none;
        max-width: 260px;
    }
}

/* ---- footer ---- */

.app-footer {
    flex-shrink: 0;
    text-align: center;
    padding: 10px 0;
    font-size: 0.82rem;
    color: #6c757d;
    border-top: 1px solid #495057;
}

/* ---- help page ---- */

.help-content {
    max-width: 860px;
    padding: 24px 12px 40px;
}

.help-content h1 {
    font-size: 1.6rem;
    margin-bottom: 20px;
    color: #e9ecef;
}

.help-content h2 {
    font-size: 1.18rem;
    margin-top: 28px;
    margin-bottom: 8px;
    color: #ced4da;
    border-bottom: 1px solid #4a5058;
    padding-bottom: 6px;
}

.help-content h3 {
    font-size: 1.02rem;
    margin-top: 18px;
    margin-bottom: 6px;
    color: #adb5bd;
}

.help-section {
    margin-bottom: 30px;
}

.help-section p {
    margin: 6px 0 10px;
    color: #adb5bd;
    line-height: 1.55;
}

.help-section ul {
    color: #adb5bd;
    line-height: 1.6;
    padding-left: 20px;
}

.help-section ul li {
    margin-bottom: 6px;
}

.help-note {
    font-size: 0.88rem;
    color: #868e96 !important;
}

.help-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 14px;
    font-size: 0.89rem;
}

.help-table th,
.help-table td {
    padding: 6px 12px;
    border: 1px solid #4a5058;
    text-align: left;
    vertical-align: top;
}

.help-table th {
    background: #3b3e42;
    color: #ced4da;
    font-weight: 500;
    white-space: nowrap;
}

.help-table td {
    color: #dee2e6;
}

.help-pre {
    background: #1e1e2e;
    border: 1px solid #4a5058;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 8px 0 14px;
    overflow-x: auto;
}

.help-pre code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.83rem;
    color: #cdd6f4;
    background: transparent;
    line-height: 1.5;
}

.help-pre-inline {
    display: inline;
    background: #1e1e2e;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.81rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.help-pre-inline code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.81rem;
    color: #cdd6f4;
    background: transparent;
}

.method-post {
    display: inline-block;
    background: #198754;
    color: #fff;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status-ok {
    display: inline-block;
    background: #198754;
    color: #fff;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-left: 6px;
}

.status-err {
    display: inline-block;
    background: #dc3545;
    color: #fff;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}
