/* ==========================================================================
   Freshdesk-style compact design — global CSS overrides
   ========================================================================== */

/* Base styles */
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    background-color: #f5f7f9;
    color: #1e293b;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1:focus {
    outline: none;
}

/* ==========================================================================
   MudBlazor Table — compact 36px rows
   ========================================================================== */
.mud-table-row {
    cursor: pointer;
    height: 36px !important;
}

.mud-table-row td {
    padding: 4px 12px !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
}

.mud-table-head th {
    padding: 6px 12px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #64748b !important;
    background-color: #f8fafc !important;
    border-bottom: 1px solid #e5e8eb !important;
}

.mud-table-cell {
    border-bottom: 1px solid #f0f2f5 !important;
}

.mud-table-row:hover {
    background-color: #f5f7f9 !important;
}

.mud-table-container {
    border: 1px solid #e5e8eb !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

/* Pagination compact */
.mud-table-pagination {
    font-size: 12px !important;
    padding: 4px 8px !important;
    min-height: 36px !important;
    border-top: 1px solid #e5e8eb !important;
}

.mud-table-pagination .mud-select {
    font-size: 12px !important;
}

/* ==========================================================================
   MudBlazor Chip — compact sizing
   ========================================================================== */
.mud-chip {
    height: 20px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    padding: 0 8px !important;
    border-radius: 10px !important;
}

.mud-chip .mud-chip-content {
    padding: 0 !important;
}

.mud-chip .mud-icon-root {
    font-size: 14px !important;
}

/* ==========================================================================
   MudBlazor Input controls — compact but with proper label spacing
   ========================================================================== */
.mud-input {
    font-size: 13px !important;
}

.mud-input-label {
    font-size: 12px !important;
}

.mud-input-helper-text {
    font-size: 11px !important;
}

.mud-select-input {
    font-size: 13px !important;
}

/* ==========================================================================
   MudBlazor Buttons — compact
   ========================================================================== */
.mud-button-root {
    font-size: 13px !important;
    text-transform: none !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
}

.mud-button-root.mud-button-size-small {
    font-size: 12px !important;
    padding: 2px 10px !important;
}

.mud-icon-button-size-small {
    padding: 4px !important;
}

/* ==========================================================================
   MudBlazor Cards — subtle borders, no heavy shadows
   ========================================================================== */
.mud-card {
    box-shadow: none !important;
    border: 1px solid #e5e8eb !important;
    border-radius: 4px !important;
}

.mud-card-header {
    padding: 12px 16px !important;
}

.mud-card-content {
    padding: 12px 16px !important;
}

.mud-card-actions {
    padding: 8px 16px !important;
}

/* ==========================================================================
   MudBlazor Dialog — compact
   ========================================================================== */
.mud-dialog .mud-dialog-title {
    font-size: 14px !important;
    font-weight: 600 !important;
    padding: 12px 16px !important;
}

.mud-dialog .mud-dialog-content {
    padding: 8px 16px !important;
    font-size: 13px !important;
}

.mud-dialog .mud-dialog-actions {
    padding: 8px 16px !important;
}

/* ==========================================================================
   MudBlazor Toolbar / AppBar — dense
   ========================================================================== */
.mud-toolbar {
    min-height: 40px !important;
    padding: 0 12px !important;
}

/* ==========================================================================
   MudBlazor Tabs — compact
   ========================================================================== */
.mud-tab {
    font-size: 13px !important;
    text-transform: none !important;
    min-width: auto !important;
    padding: 6px 14px !important;
    font-weight: 500 !important;
}

/* ==========================================================================
   MudBlazor Breadcrumbs — small
   ========================================================================== */
.mud-breadcrumbs li {
    font-size: 12px !important;
}

/* ==========================================================================
   MudBlazor Menu — compact items
   ========================================================================== */
.mud-menu-item {
    font-size: 13px !important;
    min-height: 32px !important;
    padding: 4px 14px !important;
}

/* ==========================================================================
   MudBlazor List — dense
   ========================================================================== */
.mud-list-item {
    padding: 4px 12px !important;
    min-height: 32px !important;
    font-size: 13px !important;
}

.mud-list-item-icon {
    min-width: 32px !important;
}

/* ==========================================================================
   MudBlazor Avatar — Freshdesk-style initial circles
   ========================================================================== */
.mud-avatar-small {
    width: 28px !important;
    height: 28px !important;
    font-size: 11px !important;
}

/* ==========================================================================
   MudBlazor Paper — no heavy elevation
   ========================================================================== */
.mud-paper.mud-elevation-1 {
    box-shadow: none !important;
    border: 1px solid #e5e8eb !important;
}

.mud-paper.mud-elevation-2 {
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    border: 1px solid #e5e8eb !important;
}

/* ==========================================================================
   MudBlazor Snackbar — compact
   ========================================================================== */
.mud-snackbar {
    font-size: 13px !important;
    padding: 8px 14px !important;
}

/* ==========================================================================
   Scrollbar styling — thin, subtle
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c1c7cd;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a7ae;
}

/* ==========================================================================
   Content styling (message body, articles)
   ========================================================================== */
.message-body {
    line-height: 1.5;
    font-size: 13px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-body img {
    max-width: 100%;
    height: auto;
}

.article-body {
    line-height: 1.6;
    font-size: 13px;
}

.article-body h1, .article-body h2, .article-body h3 {
    margin-top: 1.2em;
    margin-bottom: 0.4em;
}

.article-body p {
    margin-bottom: 0.8em;
}

.article-body code {
    background: #f0f2f5;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}

/* ==========================================================================
   Utility classes
   ========================================================================== */
.cursor-pointer {
    cursor: pointer;
}

.cursor-pointer:hover {
    transform: translateY(-1px);
    transition: transform 0.12s ease;
}

/* ==========================================================================
   Blazor error UI
   ========================================================================== */
#blazor-error-ui {
    background: #b32121;
    color: white;
    bottom: 0;
    box-shadow: 0 -4px 8px rgba(0,0,0,0.15);
    display: none;
    left: 0;
    padding: 10px 20px;
    position: fixed;
    width: 100%;
    z-index: 9999;
    font-size: 13px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 16px;
    top: 8px;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 0.8rem;
    color: white;
    border-radius: 4px;
    font-size: 13px;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ==========================================================================
   Form validation
   ========================================================================== */
.valid.modified:not([type=checkbox]) {
    outline: none;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
    font-size: 11px;
}

/* Code blocks in message body and article views */
.message-body pre,
.message-body .ql-syntax,
.message-body .ql-code-block-container,
.article-body pre,
.article-body .ql-syntax,
.article-body .ql-code-block-container {
    position: relative;
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 12px 16px;
    border-radius: 6px;
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
    margin: 8px 0;
}

.message-body .ql-code-block,
.article-body .ql-code-block {
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #e2e8f0;
}

/* Article body typography */
.article-body img {
    max-width: 100% !important;
    height: auto !important;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin: 12px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.article-body h1, .article-body h2, .article-body h3 {
    color: #1e293b;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}
.article-body p { margin-bottom: 0.8em; }
.article-body ol, .article-body ul { padding-left: 1.5em; margin-bottom: 1em; }
.article-body li { margin-bottom: 0.4em; }
.article-body a { color: #2563eb; text-decoration: underline; }

.code-copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: #e2e8f0;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.15s;
    z-index: 1;
}
.code-copy-btn:hover {
    background: rgba(255,255,255,0.25);
}
.code-copy-btn.copied {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.message-body code {
    background-color: #f1f5f9;
    color: #dc2626;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
}
