/*
 * Concerns Module Overlay (#78)
 * Scoped under .cnc-shell so it never bleeds into other pages.
 * Cross-module relationships highlighted: Reporter (Owner), Property,
 * Assignee (User). All deep-link to their respective modules.
 *
 * Inherits the shared .data-toolbar (#76) and module_guide (#70) overlays.
 */

.cnc-shell {
    --cnc-radius: 14px;
    --cnc-pill-radius: 999px;
    --cnc-brand: var(--brand-green, #2f7d4d);
    --cnc-brand-soft: rgba(47, 125, 77, 0.10);
    --cnc-brand-strong: rgba(47, 125, 77, 0.85);
    --cnc-divider: 1px dashed var(--border-soft, #d6dee2);
    --cnc-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.06);
}

[data-theme="dark"] .cnc-shell {
    --cnc-brand-soft: rgba(120, 200, 150, 0.16);
    --cnc-brand-strong: rgba(120, 200, 150, 0.9);
}

/* Page header ---------------------------------------------------------- */
.cnc-shell .cnc-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 0 0.85rem;
    margin-bottom: 1rem;
    border-bottom: var(--cnc-divider);
}

.cnc-shell .cnc-page-header h1 {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.cnc-shell .cnc-page-header h1 i {
    color: var(--cnc-brand);
}

.cnc-shell .add-concern-btn {
    background: var(--cnc-brand);
    border-color: var(--cnc-brand);
    border-radius: var(--cnc-pill-radius);
    padding: 7px 18px;
    font-weight: 500;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cnc-shell .add-concern-btn:hover,
.cnc-shell .add-concern-btn:focus-visible {
    background: var(--cnc-brand);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(47, 125, 77, 0.25);
}

/* Summary chips -------------------------------------------------------- */
.cnc-shell .cnc-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.cnc-shell .cnc-chip {
    flex: 1 1 140px;
    min-width: 140px;
    background: var(--surface, #fff);
    border: 1px solid var(--border-soft, #e5e9ec);
    border-radius: var(--cnc-radius);
    padding: 0.85rem 1rem;
    box-shadow: var(--cnc-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cnc-shell .cnc-chip:hover {
    transform: translateY(-1px);
    border-color: var(--cnc-brand);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.cnc-shell .cnc-chip[aria-pressed="true"] {
    border-color: var(--cnc-brand);
    background: var(--cnc-brand-soft);
}

.cnc-shell .cnc-chip-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #6b7280);
}

.cnc-shell .cnc-chip-count {
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
    line-height: 1.1;
}

.cnc-shell .cnc-chip-icon {
    align-self: flex-end;
    margin-top: -1.5rem;
    color: var(--cnc-brand);
    opacity: 0.6;
    font-size: 1.15rem;
}

/* Table polish --------------------------------------------------------- */
.cnc-shell .cnc-table-wrap {
    background: var(--surface, #fff);
    border: 1px solid var(--border-soft, #e5e9ec);
    border-radius: var(--cnc-radius);
    overflow: hidden;
    box-shadow: var(--cnc-shadow);
}

.cnc-shell .cnc-table {
    margin: 0;
    font-size: 0.92rem;
}

.cnc-shell .cnc-table thead th {
    background: var(--surface-sunk, #f6f8f9);
    color: var(--text-muted, #6b7280);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    border-bottom: 1px solid var(--border-soft, #e5e9ec);
    padding: 0.7rem 0.9rem;
    position: sticky;
    top: 0;
    z-index: 2;
}

.cnc-shell .cnc-table tbody td {
    padding: 0.7rem 0.9rem;
    vertical-align: middle;
    border-color: var(--border-soft, #eef1f3);
}

.cnc-shell .cnc-table tbody tr {
    cursor: pointer;
    transition: background 0.12s ease;
}

.cnc-shell .cnc-table tbody tr:hover {
    background: var(--cnc-brand-soft);
}

.cnc-shell .cnc-ticket {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--cnc-brand);
    font-weight: 600;
}

/* Cross-module deep-link pills ---------------------------------------- */
.cnc-shell .cnc-link-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 2px 9px;
    border-radius: var(--cnc-pill-radius);
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--cnc-brand-soft);
    color: var(--cnc-brand-strong);
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cnc-shell .cnc-link-pill:hover {
    background: var(--cnc-brand);
    color: #fff;
    border-color: var(--cnc-brand);
}

.cnc-shell .cnc-link-pill i {
    font-size: 0.75rem;
    opacity: 0.8;
}

.cnc-shell .cnc-link-pill.is-empty {
    background: transparent;
    color: var(--text-muted, #9aa3ad);
    border: 1px dashed var(--border-soft, #d6dee2);
    cursor: default;
}

.cnc-shell .cnc-link-pill.is-empty:hover {
    background: transparent;
    color: var(--text-muted, #9aa3ad);
}

/* Status / priority badges -------------------------------------------- */
.cnc-shell .cnc-status,
.cnc-shell .cnc-priority {
    display: inline-block;
    padding: 2px 9px;
    border-radius: var(--cnc-pill-radius);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cnc-shell .cnc-status-open        { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.cnc-shell .cnc-status-in_progress { background: rgba(234, 179, 8, 0.15);  color: #a16207; }
.cnc-shell .cnc-status-resolved    { background: rgba(34, 197, 94, 0.15);  color: #15803d; }
.cnc-shell .cnc-status-closed      { background: rgba(100, 116, 139, 0.18); color: #475569; }
.cnc-shell .cnc-status-escalated   { background: rgba(239, 68, 68, 0.15);  color: #b91c1c; }

.cnc-shell .cnc-priority-low      { background: rgba(100, 116, 139, 0.15); color: #475569; }
.cnc-shell .cnc-priority-normal   { background: rgba(59, 130, 246, 0.12);  color: #1d4ed8; }
.cnc-shell .cnc-priority-high     { background: rgba(234, 88, 12, 0.15);   color: #c2410c; }
.cnc-shell .cnc-priority-urgent   { background: rgba(239, 68, 68, 0.18);   color: #b91c1c; }

/* Detail modal --------------------------------------------------------- */
#concern-detail-modal .modal-content {
    border: 0;
    border-radius: var(--cnc-radius);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

#concern-detail-modal .modal-header {
    border-bottom: var(--cnc-divider);
    padding: 0.95rem 1.25rem;
}

#concern-detail-modal .modal-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#concern-detail-modal .cnc-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
}

#concern-detail-modal .cnc-detail-section {
    border-top: var(--cnc-divider);
    padding-top: 0.85rem;
    margin-top: 0.85rem;
}

#concern-detail-modal .cnc-comment {
    background: var(--surface-sunk, #f6f8f9);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.55rem;
}

#concern-detail-modal .cnc-comment.is-system {
    background: transparent;
    color: var(--text-muted, #6b7280);
    font-style: italic;
    font-size: 0.85rem;
    padding: 0.25rem 0.85rem;
    border-left: 3px solid var(--border-soft, #e5e9ec);
    border-radius: 0;
}

#concern-detail-modal .cnc-comment-meta {
    font-size: 0.72rem;
    color: var(--text-muted, #6b7280);
    margin-bottom: 0.2rem;
}

/* Form modal polish (reuses #concern-form-modal) ---------------------- */
#concern-form-modal .modal-content {
    border: 0;
    border-radius: var(--cnc-radius);
}

#concern-form-modal .modal-footer .btn-primary {
    background: var(--cnc-brand);
    border-color: var(--cnc-brand);
    border-radius: var(--cnc-pill-radius);
    padding: 6px 18px;
}

/* Empty state ---------------------------------------------------------- */
.cnc-shell .cnc-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted, #6b7280);
}

.cnc-shell .cnc-empty i {
    font-size: 2.5rem;
    color: var(--cnc-brand);
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

/* Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .cnc-shell .add-concern-btn,
    .cnc-shell .cnc-chip,
    .cnc-shell .cnc-link-pill,
    .cnc-shell .cnc-table tbody tr {
        transition: none;
    }
    .cnc-shell .add-concern-btn:hover,
    .cnc-shell .cnc-chip:hover {
        transform: none;
    }
}

/* Print ---------------------------------------------------------------- */
@media print {
    .cnc-shell .add-concern-btn,
    .cnc-shell .cnc-summary,
    .cnc-shell .data-toolbar { display: none !important; }
    .cnc-shell .cnc-table tbody tr { cursor: default; }
}
