/* ===== Modern Design System ===== */
:root {
    --color-primary: #6366f1;
    --color-primary-hover: #4f46e5;
    --color-primary-light: #eef2ff;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-text: #0f172a;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.1);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a, .btn-link {
    color: var(--color-primary);
}

/* ===== Buttons ===== */
.btn-primary {
    color: #fff;
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    border-radius: var(--radius-sm);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
    border-radius: var(--radius-sm);
}

.btn-outline-primary:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all var(--transition);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn-sm {
    border-radius: 0.375rem;
}

/* ===== Form Controls ===== */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--color-border);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-group-text {
    border-color: var(--color-border);
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

h1:focus { outline: none; }

.valid.modified:not([type=checkbox]) { outline: 1px solid #22c55e; }
.invalid { outline: 1px solid #ef4444; }
.validation-message { color: #ef4444; }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after { content: "An error has occurred." }

.darker-border-checkbox.form-check-input { border-color: #929292; }

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder { color: var(--bs-secondary-color); text-align: end; }

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder { text-align: start; }

/* ===== Cards ===== */
.card {
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    transition: box-shadow var(--transition);
}

.card-header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border-light);
    padding: 0.875rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* ===== Stat Cards ===== */
.stat-card {
    transition: transform var(--transition), box-shadow var(--transition);
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

/* ===== Tables ===== */
.table {
    --bs-table-hover-bg: rgba(99, 102, 241, 0.03);
}

.table th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--color-border-light);
    padding: 0.75rem 1rem;
}

.table td {
    vertical-align: middle;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text);
    font-size: 0.875rem;
}

.table tbody tr {
    transition: background var(--transition);
}

/* ===== Modern Badges ===== */
.badge-modern {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3em 0.75em;
    border-radius: var(--radius-pill);
    letter-spacing: 0.02em;
    line-height: 1.5;
}

/* Status badges - soft tones */
.badge-active { background: #dcfce7; color: #166534; }
.badge-onhold { background: #fef3c7; color: #92400e; }
.badge-completed { background: #dbeafe; color: #1e40af; }
.badge-archived { background: #f1f5f9; color: #475569; }
.badge-pending { background: #f1f5f9; color: #475569; }
.badge-inprogress { background: #e0e7ff; color: #3730a3; }
.badge-review { background: #fef3c7; color: #92400e; }
.badge-done { background: #dcfce7; color: #166534; }

/* Priority badges - soft tones */
.badge-critical { background: #fee2e2; color: #991b1b; }
.badge-high { background: #ffedd5; color: #9a3412; }
.badge-medium { background: #e0e7ff; color: #3730a3; }
.badge-low { background: #dcfce7; color: #166534; }

/* ===== Page Header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    margin-bottom: 0;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--color-text);
}

/* ===== Loading & Empty States ===== */
.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 3rem;
}

.spinner-border {
    color: var(--color-primary) !important;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ===== Task Cards ===== */
.task-card {
    border-left: 3px solid transparent;
    transition: all var(--transition);
    border-radius: 0;
}

.task-card:hover {
    box-shadow: var(--shadow-md);
    background: rgba(99, 102, 241, 0.02);
}

.task-card.priority-critical { border-left-color: #ef4444; }
.task-card.priority-high { border-left-color: #f97316; }
.task-card.priority-medium { border-left-color: #6366f1; }
.task-card.priority-low { border-left-color: #22c55e; }

/* ===== Comments & Attachments ===== */
.comment-item {
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--color-border-light);
}

.comment-item:last-child { border-bottom: none; }

.attachment-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    margin-bottom: 0.5rem;
    transition: background var(--transition);
}

.attachment-item:hover { background: var(--color-border-light); }

.attachment-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 0.375rem;
    border: 1px solid var(--color-border);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.attachment-preview-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.attachment-preview-link:hover { text-decoration: underline; }

.comment-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.comment-attachment-img {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    color: inherit;
    padding: 0.25rem;
    border-radius: 0.375rem;
    background: var(--color-bg);
    transition: background var(--transition);
}

.comment-attachment-img:hover { background: var(--color-border-light); }

.comment-attachment-file {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--color-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background: var(--color-primary-light);
    font-size: 0.8rem;
    transition: background var(--transition);
}

.comment-attachment-file:hover { background: #ddd6fe; }

.selected-files .badge {
    font-weight: 500;
    font-size: 0.75rem;
}

/* ===== Kanban Board ===== */
.kanban-board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    min-height: 400px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}

.kanban-column {
    flex: 1;
    min-width: 240px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    transition: background var(--transition), box-shadow var(--transition);
    scroll-snap-align: start;
    border: 2px solid transparent;
}

.kanban-column.drag-over {
    background: var(--color-primary-light);
    border-color: rgba(99, 102, 241, 0.3);
}

.kanban-column-header {
    padding: 0.65rem 0.85rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
}

.kanban-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15em 0.5em;
    border-radius: var(--radius-pill);
    min-width: 1.4em;
    text-align: center;
}

.kanban-header-pending { background: #64748b; }
.kanban-header-inprogress { background: var(--color-primary); }
.kanban-header-review { background: #d97706; }
.kanban-header-done { background: #16a34a; }

.kanban-column-body {
    flex: 1;
    padding: 0.5rem;
    overflow-y: auto;
    max-height: 520px;
}

.kanban-column-body::-webkit-scrollbar { width: 4px; }
.kanban-column-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.kanban-empty {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    padding: 2.5rem 0.5rem;
}

.kanban-empty i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.4rem;
    opacity: 0.5;
}

.kanban-card {
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid transparent;
    cursor: grab;
    transition: box-shadow var(--transition), opacity var(--transition), transform var(--transition);
    position: relative;
}

.kanban-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.35; transform: scale(0.95); }

.kanban-card.priority-critical { border-left-color: #ef4444; }
.kanban-card.priority-high { border-left-color: #f97316; }
.kanban-card.priority-medium { border-left-color: var(--color-primary); }
.kanban-card.priority-low { border-left-color: #22c55e; }

.kanban-card-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    line-height: 1.3;
    color: var(--color-text);
}

.kanban-card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: var(--color-text-secondary);
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.35rem;
}

.kanban-avatars { display: flex; align-items: center; }

.kanban-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    color: #475569;
    font-size: 0.65rem;
    font-weight: 700;
    margin-right: -4px;
    border: 2px solid #fff;
    text-transform: uppercase;
}

.kanban-avatar-more { background: var(--color-primary-light); color: var(--color-primary); }

.kanban-mobile-actions { display: none; }

/* ===== Task Detail Page ===== */
.task-detail-banner {
    background: #ecfeff;
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    border: 1px solid #cffafe;
}

.task-detail-title {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--color-text);
    margin-bottom: 0;
    line-height: 1.3;
}

.task-section {
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
}

.task-section-title {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

.task-description {
    color: #334155;
    line-height: 1.7;
    white-space: pre-wrap;
}

.task-property {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border-light);
}

.task-property:last-child { border-bottom: none; padding-bottom: 0; }
.task-property:first-of-type { padding-top: 0; }

.task-property-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    min-width: 70px;
}

.task-property-value {
    font-size: 0.875rem;
    color: #334155;
}

.task-property .form-select { max-width: 160px; }

/* ===== Assignees ===== */
.assignee-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.assignee-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.assignee-item:hover { background: var(--color-bg); }
.assignee-item:hover .assignee-remove { opacity: 1; }

.assignee-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.assignee-name { font-weight: 500; font-size: 0.85rem; color: var(--color-text); line-height: 1.2; }
.assignee-email { font-size: 0.7rem; color: var(--color-text-muted); }
.assignee-remove { opacity: 0; transition: opacity var(--transition); padding: 0.15rem 0.35rem; }

.user-select-btn {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    transition: all var(--transition);
}

.user-select-btn:hover {
    background: var(--color-primary-light);
    border-color: rgba(99, 102, 241, 0.3);
}

/* ===== Modal Enhancements ===== */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hover);
}

.modal-header {
    border-bottom: 1px solid var(--color-border-light);
}

.modal-footer {
    border-top: 1px solid var(--color-border-light);
}

/* ===== Breadcrumbs ===== */
.breadcrumb {
    font-size: 0.8rem;
}

.breadcrumb-item a {
    color: var(--color-primary);
    text-decoration: none;
}

.breadcrumb-item a:hover { text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 576px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    .page-header h2 { font-size: 1.25rem; }
    .stat-card .stat-value { font-size: 1.25rem; }
}

@media (max-width: 768px) {
    .kanban-board {
        flex-direction: column;
        min-height: auto;
        overflow-x: visible;
    }

    .kanban-column { min-width: 100%; }
    .kanban-column-body { max-height: none; }
    .kanban-card { cursor: pointer; }

    .kanban-mobile-actions {
        display: flex;
        gap: 0.35rem;
        flex-wrap: wrap;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--color-border-light);
    }

    .kanban-move-btn {
        font-size: 0.65rem;
        padding: 0.2rem 0.45rem;
        border: none;
        border-radius: 0.25rem;
        color: #fff;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 0.1rem;
        opacity: 0.85;
        transition: opacity var(--transition);
    }

    .kanban-move-btn:hover,
    .kanban-move-btn:active { opacity: 1; }

    .assignee-remove { opacity: 1; }

    .task-detail-banner { padding: 1rem; border-radius: var(--radius-sm); }
    .task-detail-title { font-size: 1.25rem; }

    .task-property {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .task-property .form-select { max-width: 100%; }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .kanban-column { min-width: 200px; }
}
