/* Copilot chat panel styles */

/* Message bubbles */
.copilot-bubble-user,
.copilot-bubble-assistant {
    padding: 0.4em 0.6em;
    border-radius: 4px;
    word-break: break-word;
}

.copilot-bubble-user {
    background-color: #f1f1f1;
    white-space: pre-wrap;
    font-size: 14px;
    font-weight: 400;
}

.copilot-bubble-assistant {
    background-color: white;
    font-size: 14px;
    font-weight: 400;
}

/* Timestamp / meta */
.copilot-meta {
    font-size: 0.7em;
    font-weight: 400;
    color: #6c757d;
    margin-bottom: 2px;
}

/* Scoped markdown inside assistant bubbles */
.copilot-md {
    font-size: 1em;
    line-height: 1.5;
}

.copilot-md p {
    margin: 0 0 0.4em 0;
}

.copilot-md p:last-child {
    margin-bottom: 0;
}

.copilot-md h1,
.copilot-md h2,
.copilot-md h3,
.copilot-md h4,
.copilot-md h5,
.copilot-md h6 {
    margin: 0.6em 0 0.3em 0;
    font-weight: 600;
    line-height: 1.25;
}

.copilot-md h1 { font-size: 1.15em; }
.copilot-md h2 { font-size: 1.1em; }
.copilot-md h3 { font-size: 1.05em; }
.copilot-md h4,
.copilot-md h5,
.copilot-md h6 { font-size: 1em; }

.copilot-md ul,
.copilot-md ol {
    margin: 0.3em 0;
    padding-left: 1.4em;
}

.copilot-md li {
    margin-bottom: 0.15em;
}

.copilot-md blockquote {
    margin: 0.4em 0;
    padding: 0.2em 0.6em;
    border-left: 3px solid #dee2e6;
    color: #6c757d;
}

.copilot-md hr {
    border: none;
    border-top: 1px solid #dee2e6;
    margin: 0.5em 0;
}

.copilot-md a {
    color: #1d1d1d;
    text-decoration: underline;
}

.copilot-md strong {
    font-weight: 600;
}

/* Images */
.copilot-md img,
.copilot-md .copilot-img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0.25em 0;
    display: block;
}

/* Inline code */
.copilot-md code {
    background-color: #e9ecef;
    padding: 0.1em 0.35em;
    border-radius: 3px;
    font-size: 0.88em;
    font-family: Consolas, Monaco, 'Andale Mono', monospace;
}

/* Code blocks - override inline code style inside pre */
.copilot-md pre {
    position: relative;
    margin: 0.5em 0;
    border-radius: 4px;
    overflow-x: auto;
}

.copilot-md pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.85em;
}

/* Code header with language label + copy button */
.copilot-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25em 0.6em;
    background-color: #1d1d1d;
    border-bottom: 1px solid #3a3a3a;
    font-size: 0.75em;
    color: #a0a0a0;
    font-family: Consolas, Monaco, 'Andale Mono', monospace;
    border-radius: 4px 4px 0 0;
}

.copilot-code-header button {
    background: none;
    border: 1px solid #555;
    color: #ccc;
    padding: 0.1em 0.5em;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
    font-family: inherit;
}

.copilot-code-header button:hover {
    background-color: #333;
    color: #fff;
}

/* Tables */
.copilot-md table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.4em 0;
    font-size: 0.92em;
}

.copilot-md th,
.copilot-md td {
    border: 1px solid #dee2e6;
    padding: 0.25em 0.5em;
    text-align: left;
}

.copilot-md th {
    background-color: #f1f1f1;
    font-weight: 600;
}

/* Send button */
.copilot-send-btn {
    padding: 0 0.6em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: stretch;
    border-radius: 0;
    border: 1px solid #1d1d1d;
    background: #1d1d1d;
    color: white;
    cursor: pointer;
}

.copilot-send-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Typing indicator - three bouncing dots */
.copilot-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.4em 0.6em;
}

.copilot-typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #6c757d;
    animation: copilot-bounce 1.2s ease-in-out infinite;
}

.copilot-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.copilot-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes copilot-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

/* ── Panel slide animations ── */

@keyframes copilot-enter-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes copilot-enter-down {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes copilot-exit-down {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(30px); opacity: 0; }
}

.copilot-enter-up {
    animation: copilot-enter-up 0.25s ease forwards;
}

.copilot-enter-down {
    animation: copilot-enter-down 0.25s ease forwards;
}

.copilot-exit-down {
    animation: copilot-exit-down 0.25s ease forwards;
}

@keyframes copilot-enter-left {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes copilot-exit-right {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

.copilot-enter-left {
    animation: copilot-enter-left 0.25s ease forwards;
}

.copilot-exit-right {
    animation: copilot-exit-right 0.25s ease forwards;
}

/* ── Rich Widgets (bar chart, KPI, progress) ── */

.copilot-md .cw-widget {
    margin: 0.5em 0;
    font-weight: 300;
}

.copilot-md .cw-widget-title {
    font-weight: 600;
    font-size: 0.92em;
    margin-bottom: 0.35em;
}

/* Bar chart */
.copilot-md .cw-bar-row {
    display: grid;
    grid-template-columns: 90px 1fr 55px;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.copilot-md .cw-bar-label {
    font-size: 0.82em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1d1d1d;
}

.copilot-md .cw-bar-track {
    height: 14px;
    background: #f1f1f1;
    border-radius: 3px;
    overflow: hidden;
}

.copilot-md .cw-bar-fill {
    height: 100%;
    background: #1d1d1d;
    border-radius: 3px;
    min-width: 2px;
}

.copilot-md .cw-bar-value {
    font-size: 0.8em;
    text-align: right;
    color: #6c757d;
    white-space: nowrap;
}

/* KPI cards */
.copilot-md .cw-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 6px;
}

.copilot-md .cw-kpi-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.45em 0.5em;
    text-align: center;
}

.copilot-md .cw-kpi-label {
    font-size: 0.72em;
    color: #6c757d;
    margin-bottom: 2px;
}

.copilot-md .cw-kpi-value {
    font-size: 1.15em;
    font-weight: 600;
    color: #1d1d1d;
}

.copilot-md .cw-kpi-change {
    font-size: 0.72em;
    margin-top: 2px;
}

.copilot-md .cw-trend-up { color: #2a9d8f; }
.copilot-md .cw-trend-down { color: #be3455; }

/* Progress bars */
.copilot-md .cw-progress-row {
    margin-bottom: 6px;
}

.copilot-md .cw-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.82em;
    margin-bottom: 2px;
}

.copilot-md .cw-progress-label {
    color: #1d1d1d;
}

.copilot-md .cw-progress-value {
    color: #6c757d;
}

.copilot-md .cw-progress-track {
    height: 8px;
    background: #f1f1f1;
    border-radius: 4px;
    overflow: hidden;
}

.copilot-md .cw-progress-fill {
    height: 100%;
    background: #1d1d1d;
    border-radius: 4px;
}

/* Sort button (Blazor widget) */
.cw-sort-btn {
    background: white;
    border: 1px solid #dee2e6;
    color: #1d1d1d;
    font-size: 0.75em;
    font-weight: 300;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1.4;
}

.cw-sort-btn:hover {
    background: #f1f1f1;
    border-color: #adb5bd;
}
