/* ── DevFlow Custom Styles ─────────────────────────────────────── */

/* Form validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #2E7D4F;
}

.invalid {
    outline: 1px solid #C4443C;
}

.validation-message {
    color: #C4443C;
}

/* ── Blazor Error UI ───────────────────────────────────────────── */
#blazor-error-ui {
    color-scheme: light only;
    background: #C4443C;
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2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    content: "An error has occurred."
}

/* ── Utility Classes ───────────────────────────────────────────── */
.border-divider {
    border-color: var(--mud-palette-divider);
}

.fw-600 {
    font-weight: 600;
}

.fw-500 {
    font-weight: 500;
}

.date-shortcuts {
    margin-top: -2px;
}

.date-shortcuts .mud-chip {
    border-radius: 12px;
}

/* ── Page Layout ───────────────────────────────────────────────── */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h4 {
    font-family: 'DM Serif Display', Georgia, serif;
}

/* ── Kanban Board ──────────────────────────────────────────────── */
.kanban-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    overflow: hidden;
}

.kanban-scroll {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    scroll-behavior: smooth;
}

.kanban-scroll::-webkit-scrollbar {
    height: 6px;
}

.kanban-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.kanban-scroll::-webkit-scrollbar-thumb {
    background: var(--mud-palette-lines-default);
    border-radius: 3px;
}

.kanban-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--mud-palette-text-secondary);
}

.kanban-column {
    min-width: 280px;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}

.kanban-column-body {
    flex: 1;
    overflow-y: auto;
    min-height: 80px;
    border-radius: 8px;
    padding: 4px;
    transition: background-color 0.15s ease;
}

.kanban-column-body::-webkit-scrollbar {
    width: 4px;
}

.kanban-column-body::-webkit-scrollbar-thumb {
    background: var(--mud-palette-lines-default);
    border-radius: 2px;
}

/* ── Kanban Card ───────────────────────────────────────────────── */
.kanban-card {
    cursor: grab;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px !important;
    transition: box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.kanban-card:hover {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 2px 8px rgba(45, 49, 66, 0.08);
    transform: translateY(-1px);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card .card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

/* ── Empty State ───────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--mud-palette-text-secondary);
    min-height: 120px;
}

.empty-state .mud-icon-root {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.8125rem;
    line-height: 1.5;
    max-width: 200px;
}

/* ── Dashboard Cards ───────────────────────────────────────────── */
.stat-card {
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    border-color: var(--mud-palette-text-secondary);
    box-shadow: 0 2px 12px rgba(45, 49, 66, 0.06);
}

.stat-value {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 700;
    font-size: 2rem;
    line-height: 1;
    color: var(--mud-palette-text-primary);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    margin-top: 0.25rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Data Grid Wrapper ────────────────────────────────────────── */
.data-grid-wrapper {
    border: 1px solid var(--mud-palette-divider);
    border-radius: var(--mud-default-borderradius);
    overflow: hidden;
}

/* ── Data Grid Refinements ─────────────────────────────────────── */
.mud-table .mud-table-head .mud-table-row .mud-table-cell {
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

/* ── Priority Chip Styling ─────────────────────────────────────── */
.priority-chip {
    font-weight: 600;
    font-size: 0.6875rem;
    letter-spacing: 0.02em;
}

/* ── Dialog Refinement ─────────────────────────────────────────── */
.mud-dialog .mud-dialog-title {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 600;
}

/* ── Section Header ────────────────────────────────────────────── */
.section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

/* ── Timer Chip (AppBar) ──────────────────────────────────────── */
.timer-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem 0.25rem 0.625rem;
    border-radius: 20px;
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.3);
    cursor: pointer;
    margin-right: 0.5rem;
    transition: background 0.15s ease, border-color 0.15s ease;
    animation: timer-pulse 2s ease-in-out infinite;
}

.timer-chip:hover {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
}

.timer-chip .mud-icon-root:first-child {
    color: #4CAF50;
    font-size: 1rem;
}

.timer-ticket {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.timer-elapsed {
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'DM Sans', monospace;
    color: var(--mud-palette-text-secondary);
    min-width: 56px;
}

.timer-stop-btn {
    margin: -4px -4px -4px 0;
}

@keyframes timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* ── Portal Badge ─────────────────────────────────────────────── */
.portal-badge {
    font-size: 0.625rem !important;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    height: 22px !important;
    border-color: var(--mud-palette-primary) !important;
    color: var(--mud-palette-primary) !important;
}

/* ── Portal Project Card ──────────────────────────────────────── */
.portal-project-card {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.portal-project-card:hover {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 4px 16px rgba(45, 49, 66, 0.08);
    transform: translateY(-2px);
}

/* ── Client Visible Comment Chip ──────────────────────────────── */
.visibility-chip-client {
    font-size: 0.5625rem !important;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    height: 18px !important;
}

/* ── Notification Bell ─────────────────────────────────────────── */
.notification-bell-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: 0.25rem;
}

.notification-badge .mud-badge {
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
}

.notification-popover {
    width: 360px;
    max-width: calc(100vw - 2rem);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px !important;
    box-shadow: 0 8px 32px rgba(45, 49, 66, 0.12), 0 2px 8px rgba(45, 49, 66, 0.06);
    overflow: hidden;
}

.notification-panel {
    max-height: 420px;
    display: flex;
    flex-direction: column;
}

.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.notification-panel-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    letter-spacing: 0.01em;
}

.notification-mark-all {
    font-size: 0.6875rem !important;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.notification-list {
    overflow-y: auto;
    flex: 1;
}

.notification-list::-webkit-scrollbar {
    width: 4px;
}

.notification-list::-webkit-scrollbar-thumb {
    background: var(--mud-palette-lines-default);
    border-radius: 2px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    cursor: pointer;
    transition: background 0.12s ease;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--mud-palette-background-gray);
}

.notification-item.unread {
    background: rgba(91, 106, 191, 0.04);
}

.notification-item.unread:hover {
    background: rgba(91, 106, 191, 0.08);
}

.notification-item-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--mud-palette-background);
    border: 1px solid var(--mud-palette-divider);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-item-message {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.4;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-item-time {
    font-size: 0.6875rem;
    color: var(--mud-palette-text-disabled);
    margin-top: 2px;
    font-weight: 500;
}

.notification-item-dot {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    margin-top: 6px;
}

.notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 0.5rem;
    color: var(--mud-palette-text-secondary);
    font-size: 0.8125rem;
}

.notification-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
}

/* ── Audit Log ─────────────────────────────────────────────────── */
.audit-action-chip {
    font-size: 0.6875rem !important;
    font-weight: 600;
    letter-spacing: 0.02em;
    height: 22px !important;
}

.audit-detail-row {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1rem 0.75rem 3rem;
    background: var(--mud-palette-background);
    border-top: 1px solid var(--mud-palette-divider);
}

.audit-detail-block {
    flex: 1;
    min-width: 0;
}

.audit-json {
    font-family: 'DM Sans', monospace;
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-top: 0.375rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Date Picker Header ───────────────────────────────────────── */
.mud-picker-toolbar {
    padding: 0.5rem 1rem;
    min-height: unset;
}

.mud-picker-toolbar .mud-button-date .mud-button-label {
    font-size: 1.1rem;
}

.mud-picker-toolbar .mud-button-year .mud-button-label {
    font-size: 0.75rem;
}

/* ── Misc ──────────────────────────────────────────────────────── */
code {
    color: #EF8354;
    background: rgba(239, 131, 84, 0.08);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.8125rem;
}
