/* ─────────────────────────────────────────────────────────────────────
   Shared ticket UI styles — used by NewTicket.razor AND TicketDetail.razor.
   Lives in wwwroot/css (globally loaded) instead of NewTicket.razor.css
   because Blazor scopes .razor.css per component (b-{hash} attribute),
   so styles defined in NewTicket.razor.css don't reach TicketDetail's DOM.

   Page-specific overrides go into their own *.razor.css (e.g. TicketDetail
   уredefines .tk-status-step to make it clickable button-style via ::deep).
   ───────────────────────────────────────────────────────────────────── */

/* ── Status pipeline (chevron-style) ─────────────────────────────── */
.tk-status-bar {
    display: flex;
    justify-content: flex-start;
    gap: 0;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}
.tk-status-step {
    background: #f4f4f5;
    color: #71717a;
    padding: 0.4rem 1.5rem 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    position: relative;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
    margin-right: -8px;
}
.tk-status-step:first-child {
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%);
}
.tk-status-step.active {
    background: #ecfeff;
    color: #0e7490;
    border: 1px solid #06b6d4;
    font-weight: 600;
}

/* ── Layout: left form + right chatter ─────────────────────────────── */
.tk-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 1100px) {
    .tk-layout { grid-template-columns: 1fr; }
}

/* ── Form pane ───────────────────────────────────────────────────── */
.tk-form-pane {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    padding: 1.5rem 2rem;
}

.tk-title-input {
    width: 100%;
    border: 0;
    border-bottom: 2px solid transparent;
    font-size: 1.75rem;
    font-weight: 700;
    color: #18181b;
    padding: 0.5rem 0 0.75rem;
    margin-bottom: 1.5rem;
    background: transparent;
    outline: none;
    transition: border-color 0.15s;
}
.tk-title-input:focus { border-bottom-color: #4f46e5; }
.tk-title-input::placeholder { color: #a1a1aa; font-weight: 500; }
.tk-title-input:disabled { color: #18181b; opacity: 1; }

.tk-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 2rem;
}
/* Single-column stack: each field on its own row */
.tk-fields--stack {
    grid-template-columns: 1fr;
    gap: 0.85rem 0;
    max-width: 520px;
}
@media (max-width: 720px) {
    .tk-fields { grid-template-columns: 1fr; }
}
.tk-field {
    display: grid;
    grid-template-columns: 160px 1fr;
    align-items: center;
    gap: 0.75rem;
}
.tk-field label {
    font-size: 0.88rem;
    color: #52525b;
    font-weight: 500;
}

/* Read-only "Креирано од" — chip, not editable */
.tk-readonly-value {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    color: #18181b;
    font-size: 0.9rem;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tk-readonly-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #4f46e5;
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.tk-divider {
    border: 0;
    border-top: 1px solid #e4e4e7;
    margin: 1.5rem 0 1rem;
}

.tk-section-label {
    display: block;
    font-size: 0.88rem;
    color: #52525b;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tk-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* ── Tag chip input ─────────────────────────────── */
.tk-tag-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-height: 38px;
    padding: 0.35rem 0.5rem;
    border: 1px solid #d4d4d8;
    border-radius: 4px;
    background: #fff;
    cursor: text;
}
.tk-tag-input:focus-within {
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px #4f46e5;
}
/* Tags promoted to top (Azure DevOps-style) */
.tk-tag-input--top {
    border: 0;
    border-bottom: 1px dashed #e4e4e7;
    border-radius: 0;
    padding: 0.5rem 0 0.85rem;
    margin-bottom: 1.25rem;
    background: transparent;
}
.tk-tag-input--top:focus-within {
    box-shadow: none;
    border-bottom-color: #4f46e5;
}
.tk-tag-prefix {
    font-size: 0.85rem;
    color: #71717a;
    font-weight: 500;
    margin-right: 0.25rem;
}
.tk-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #4f46e5;
    color: #fff;
    padding: 0.18rem 0.5rem 0.18rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    line-height: 1;
}
.tk-tag-x {
    background: rgba(255,255,255,0.25);
    border: 0;
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tk-tag-x:hover { background: rgba(255,255,255,0.45); }
.tk-tag-add {
    border: 0;
    outline: 0;
    background: transparent;
    flex: 1;
    min-width: 140px;
    font-size: 0.85rem;
    padding: 0.15rem 0;
}

/* Autocomplete dropdown под input-от */
.tk-tag-autocomplete-wrap {
    position: relative;
    flex: 1;
    min-width: 140px;
    display: flex;
}
.tk-tag-autocomplete-wrap .tk-tag-add { width: 100%; }
.tk-tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0.25rem 0 0;
    padding: 0.25rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid #d4d4d8;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
}
.tk-tag-suggestions li {
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: #18181b;
}
.tk-tag-suggestions li:hover {
    background: #f4f4f5;
    color: #4f46e5;
}

/* ── Chatter (right side) ─────────────────────────────────────────── */
.tk-chatter {
    background: #fafafa;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    overflow: hidden;
    position: sticky;
    top: 1rem;
}
.tk-chatter-tabs {
    display: flex;
    border-bottom: 1px solid #e4e4e7;
    background: #fff;
}
.tk-tab {
    flex: 1;
    background: none;
    border: 0;
    padding: 0.7rem 0.5rem;
    font-size: 0.78rem;
    color: #71717a;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.tk-tab.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
    background: #fafafa;
}
.tk-tab:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tk-chatter-body {
    padding: 1.5rem;
    min-height: 250px;
}
.tk-chatter-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #a1a1aa;
    padding: 2rem 1rem;
}
.tk-chatter-empty .material-icons {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0.6;
}
.tk-chatter-empty p {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    color: #71717a;
}
.tk-chatter-empty small {
    font-size: 0.78rem;
    color: #a1a1aa;
}

/* Attachment dropzone + pending file list */
.tk-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem 1rem;
    border: 2px dashed #d4d4d8;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s, background 0.15s;
}
.tk-dropzone:hover {
    border-color: #4f46e5;
    background: #fafafa;
}
.tk-dropzone .material-icons {
    font-size: 2rem;
    color: #71717a;
    margin-bottom: 0.4rem;
}
.tk-dropzone span {
    font-size: 0.9rem;
    color: #3f3f46;
}
.tk-dropzone small {
    font-size: 0.75rem;
    color: #a1a1aa;
    margin-top: 0.35rem;
}

.tk-pending-list {
    list-style: none;
    padding: 0;
    margin: 0.85rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.tk-pending-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
}
/* Coloured chip окoлу material-icons за инстант recognition по тип на документ. */
.tk-pending-icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tk-pending-icon .material-icons {
    font-size: 1.3rem;
}
.tk-icon-pdf       { background: #fee2e2; } .tk-icon-pdf .material-icons       { color: #dc2626; }
.tk-icon-word      { background: #dbeafe; } .tk-icon-word .material-icons      { color: #2563eb; }
.tk-icon-excel     { background: #dcfce7; } .tk-icon-excel .material-icons     { color: #16a34a; }
.tk-icon-image     { background: #f3e8ff; } .tk-icon-image .material-icons     { color: #9333ea; }
.tk-icon-ppt       { background: #ffedd5; } .tk-icon-ppt .material-icons       { color: #ea580c; }
.tk-icon-archive   { background: #e5e7eb; } .tk-icon-archive .material-icons   { color: #4b5563; }
.tk-icon-other     { background: #f4f4f5; } .tk-icon-other .material-icons     { color: #71717a; }

.tk-pending-info {
    flex: 1;
    min-width: 0;
}
/* Долгите имиња се wrap-аат во до 2 линии и завршуваат со „..." (line clamp). */
.tk-pending-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    font-size: 0.85rem;
    color: #18181b;
    background: none;
    border: 0;
    padding: 0;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
}
.tk-pending-name:hover { text-decoration: underline; color: #4f46e5; }

/* „Прикажи уште" / „Прикажи постари" copche за lazy-loading. */
.tk-show-more {
    margin-top: 0.55rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.4rem 0.85rem;
    color: #4b5563;
    font-size: 0.82rem;
    cursor: pointer;
    width: 100%;
}
.tk-show-more:hover { background: #e5e7eb; color: #111827; }
.tk-pending-size {
    font-size: 0.72rem;
    color: #a1a1aa;
}
.tk-pending-x {
    background: transparent;
    border: 0;
    cursor: pointer;
    color: #a1a1aa;
    font-size: 1.2rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}
.tk-pending-x:hover {
    background: #fef2f2;
    color: #dc2626;
}

.tk-chatter-hint {
    font-size: 0.78rem;
    color: #a1a1aa;
    text-align: center;
    margin-top: 0.85rem;
    padding: 0.5rem;
}

/* ── Description block (read-only fallback for non-staff) ─────────── */
.tk-description-readonly {
    background: #fafafa;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    padding: 1rem;
    min-height: 100px;
    font-size: 0.92rem;
    line-height: 1.5;
}
.tk-description-wrap { /* placeholder if needed in future */ }

/* ── TicketDetail-specific: number + priority badge ───────────────── */
.tk-number-line {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}
.tk-num {
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
    color: #71717a;
    background: #f4f4f5;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
}

/* TicketDetail-specific: clickable status pipeline (overrides static chevron) */
.tk-status-step {
    /* Re-declare to enable button styling — TicketDetail uses <button>, NewTicket <div> */
    border: 0;
    font-family: inherit;
    cursor: pointer;
}
.tk-status-step:disabled { cursor: default; }
.tk-status-step.past {
    background: #ecfdf5;
    color: #047857;
}
.tk-status-step small {
    display: block;
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.05rem;
}

/* Compose box for messages / notes */
.tk-compose {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}
.tk-compose-text {
    width: 100%;
    border: 1px solid #d4d4d8;
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    font-family: inherit;
    font-size: 0.92rem;
    resize: vertical;
    min-height: 80px;
}
.tk-compose-text:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

/* Activity feed */
.tk-feed {
    margin-top: 1rem;
    border-top: 1px solid #e4e4e7;
    padding-top: 1rem;
}
.tk-feed-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.65rem;
}
.tk-feed-item {
    padding: 0.6rem 0.75rem;
    border-left: 3px solid #4f46e5;
    background: #fff;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.88rem;
}
.tk-feed-item.internal {
    background: #fffbeb;
    border-left-color: #f59e0b;
}
.tk-feed-item.history {
    background: #fafafa;
    border-left-color: #a1a1aa;
    font-size: 0.82rem;
    color: #52525b;
}
.tk-feed-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    font-size: 0.78rem;
}
.tk-feed-author { font-weight: 600; color: #18181b; }
.tk-feed-time { color: #a1a1aa; }
.tk-feed-body { color: #3f3f46; }
.tk-feed-body strong { color: #18181b; }

/* Banner за Cancelled тикети — место pipeline-от (terminal state, нема progress). */
.tk-cancelled-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    margin-bottom: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid #dc2626;
    border-radius: 6px;
    color: #7f1d1d;
    font-size: 0.92rem;
}
.tk-cancelled-banner .material-icons {
    color: #dc2626;
    font-size: 1.25rem;
}

/* ─────────────────────────────────────────────────────────────────────
   Attachment preview dialog (AttachmentPreviewDialog.razor)
   ───────────────────────────────────────────────────────────────────── */
.ntf-attach-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    backdrop-filter: blur(4px);
}
.ntf-attach-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 1100px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.ntf-attach-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}
.ntf-attach-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ntf-attach-title .material-icons {
    color: #4f46e5;
}
.ntf-attach-actions {
    display: flex;
    gap: 0.5rem;
}
.ntf-attach-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #4b5563;
    cursor: pointer;
    text-decoration: none;
}
.ntf-attach-btn:hover { background: #e5e7eb; color: #111827; }
.ntf-attach-body {
    flex: 1;
    overflow: auto;
    background: #f3f4f6;
    display: flex;
    flex-direction: column;
}
.ntf-attach-image {
    max-width: 100%;
    max-height: 100%;
    margin: auto;
    display: block;
    object-fit: contain;
}
.ntf-attach-iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
}
.ntf-attach-jspreview {
    padding: 1rem;
    background: #fff;
    flex: 1;
    overflow: auto;
}
.ntf-attach-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
}
.ntf-attach-loading .spin {
    animation: ntf-spin 1.2s linear infinite;
}
@keyframes ntf-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.ntf-attach-fallback {
    margin: auto;
    text-align: center;
    color: #6b7280;
    padding: 2rem;
}
.ntf-attach-fallback .material-icons { color: #9ca3af; margin-bottom: 0.5rem; }
.ntf-attach-fallback p { margin: 0 0 1rem 0; }

/* Excel: tab strip + sheet content */
.ntf-preview-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.25rem;
    flex-wrap: wrap;
}
.ntf-preview-tab {
    padding: 0.35rem 0.75rem;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 0.85rem;
}
.ntf-preview-tab.active {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}
.ntf-preview-sheet table {
    border-collapse: collapse;
    font-size: 0.85rem;
}
.ntf-preview-sheet td, .ntf-preview-sheet th {
    border: 1px solid #e5e7eb;
    padding: 0.3rem 0.5rem;
    vertical-align: top;
}
.ntf-preview-sheet th {
    background: #f3f4f6;
    font-weight: 600;
}

/* Word: rendered HTML container */
.ntf-preview-doc {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    color: #1f2937;
}
.ntf-preview-doc img { max-width: 100%; height: auto; }
.ntf-preview-doc table { border-collapse: collapse; margin: 1rem 0; }
.ntf-preview-doc td, .ntf-preview-doc th {
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.6rem;
}
