/* SIA Web Chat Styles */

html, body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Prevent double-tap zoom on interactive elements */
button, a, textarea, input {
    touch-action: manipulation;
}

/* Scrollbar */
#chat-container::-webkit-scrollbar {
    width: 6px;
}
#chat-container::-webkit-scrollbar-track {
    background: transparent;
}
#chat-container::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}

/* Message bubbles */
.msg-user {
    max-width: 75%;
    margin-left: auto;
    background: #1e3a5f;
    border-radius: 1rem 1rem 0.25rem 1rem;
    padding: 0.75rem 1rem;
    word-wrap: break-word;
}

.msg-assistant {
    max-width: 85%;
    margin-right: auto;
    background: #1f2937;
    border-radius: 1rem 1rem 1rem 0.25rem;
    padding: 0.75rem 1rem;
    word-wrap: break-word;
    line-height: 1.6;
}

.msg-assistant p {
    margin-bottom: 0.5em;
}
.msg-assistant p:last-child {
    margin-bottom: 0;
}

.msg-assistant pre {
    background: #111827;
    border-radius: 0.5rem;
    padding: 0.75rem;
    overflow-x: auto;
    margin: 0.5em 0;
    font-size: 0.85em;
}

.msg-assistant code:not(pre code) {
    background: #374151;
    padding: 0.1em 0.35em;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

.msg-assistant ul, .msg-assistant ol {
    padding-left: 1.5em;
    margin: 0.5em 0;
}

.msg-assistant table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
}
.msg-assistant th, .msg-assistant td {
    border: 1px solid #374151;
    padding: 0.4em 0.6em;
    text-align: left;
}
.msg-assistant th {
    background: #1f2937;
}

.msg-system {
    max-width: 85%;
    margin: 0 auto;
    text-align: center;
    color: #6b7280;
    font-size: 0.85rem;
    padding: 0.5rem;
}

.msg-warning {
    max-width: 85%;
    margin-right: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: #431407;
    border: 1px solid #c2410c;
    border-radius: 1rem 1rem 1rem 0.25rem;
    padding: 0.75rem 1rem;
    word-wrap: break-word;
    line-height: 1.6;
}

.msg-warning-icon {
    font-size: 1.2rem;
    line-height: 1.4;
    flex-shrink: 0;
    color: #fb923c;
}

.msg-warning-title {
    color: #fed7aa;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.msg-warning-hint {
    color: #9ca3af;
    font-size: 0.8rem;
}

/* Display text panel */
.display-panel {
    max-width: 90%;
    margin: 0.5rem auto;
    border: 1px solid #22d3ee;
    border-radius: 0.5rem;
    overflow: hidden;
}
.display-panel-title {
    background: #164e63;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #22d3ee;
}
.display-panel-content {
    padding: 0.75rem 1rem;
    background: #0f172a;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.display-panel-content.markdown-rendered {
    white-space: normal;
}
.display-panel-content p {
    margin-bottom: 0.5em;
}
.display-panel-content p:last-child {
    margin-bottom: 0;
}
.display-panel-content pre {
    background: #111827;
    border-radius: 0.5rem;
    padding: 0.75rem;
    overflow-x: auto;
    margin: 0.5em 0;
    font-size: 0.85em;
}

/* Spinner animation */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: #22d3ee;
    border-right-color: #22d3ee;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Textarea auto-resize */
#chat-input {
    min-height: 2.25em;
    max-height: 150px;
    transition: height 0.1s ease;
}

@media (max-width: 639px) {
    #chat-input {
        min-height: 2em;
        max-height: 120px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .msg-user {
        max-width: 90%;
    }

    .msg-assistant {
        max-width: 95%;
    }

    .msg-warning {
        max-width: 95%;
    }

    .display-panel {
        max-width: 98%;
    }
}

/* Reports sidebar */
#reports-sidebar {
    min-width: 13rem;
    max-width: 13rem;
}

@media (max-width: 639px) {
    #reports-sidebar {
        min-width: 8rem;
        max-width: 8rem;
        font-size: 0.75rem;
    }
}

.report-item {
    display: flex;
    flex-direction: column;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #1f2937;
    gap: 0.25rem;
}

.report-item-title {
    font-size: 0.72rem;
    color: #e2e8f0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-item-name {
    font-size: 0.7rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-item-actions {
    display: flex;
    gap: 0.25rem;
}

.report-action-btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #1e40af;
    color: #fff;
    transition: background 0.15s;
}
.report-action-btn:hover { background: #1d4ed8; }

.report-action-btn--view {
    background: #065f46;
}
.report-action-btn--view:hover { background: #047857; }

.report-action-btn--danger {
    background: #7f1d1d;
}
.report-action-btn--danger:hover { background: #991b1b; }

.report-delete-all-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    background: #374151;
    color: #d1d5db;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.report-delete-all-btn:hover { background: #4b5563; }
