/* ===================================================================
   NPC Chat Enhanced Layout - Context Panels + Disposition Slider
   =================================================================== */

.npc-chat-card {
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 1.5rem;
    background: #0b0b0d;
    color: #e9f5ef;
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.25);
}

.npc-chat-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.npc-chat-status .badge {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
}

.npc-chat-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 320px;
    gap: 1.25rem;
}

.npc-chat-context-panel {
    background: #0f1417;
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.35s ease, opacity 0.35s ease;
    min-height: 100%;
}

.npc-chat-context-panel.hidden {
    opacity: 0;
    pointer-events: none;
}

.npc-chat-context-panel--left.hidden {
    transform: translateX(-30px);
}

.npc-chat-context-panel--right.hidden {
    transform: translateX(30px);
}

.npc-chat-context-header {
    padding: 0.8rem 1rem;
    font-weight: 700;
    color: #00ff95;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    background: linear-gradient(135deg, rgba(0, 20, 12, 0.85), rgba(0, 0, 0, 0.65));
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
}

.npc-chat-context-body {
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-y: auto;
    max-height: 640px;
}

.npc-context-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.npc-context-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    color: #94a3b8;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.npc-context-tabs .nav-link.active {
    color: #0b0b0d;
    background: #00ff95;
    border-radius: 0;
    border-bottom-color: #00ff95;
}

.npc-context-tabs__content {
    padding: 0.85rem;
}

.npc-prompt-panel {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 255, 136, 0.25);
    border-radius: 10px;
    padding: 0.9rem;
}

.npc-prompt-panel__title {
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.78rem;
    color: #8dffee;
}

.npc-prompt-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.5rem;
    row-gap: 0.35rem;
    font-size: 0.85rem;
    color: #cbd5f5;
}

.npc-prompt-meta dt {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 0;
}

.npc-prompt-preview {
    background: rgba(0, 0, 0, 0.45);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 0.75rem;
    min-height: 120px;
    white-space: pre-wrap;
    font-size: 0.88rem;
    border-left: 3px solid rgba(0, 255, 136, 0.4);
}

.npc-profile-tabs .nav-tabs .nav-link {
    color: #a5b4fc;
    border: none;
    border-bottom: 2px solid transparent;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.npc-profile-tabs .nav-tabs .nav-link.active {
    color: #0b0b0d;
    background: #00ff95;
    border-bottom-color: #00ff95;
}

.npc-history-table td,
.npc-history-table th {
    vertical-align: middle;
}

.npc-history-placeholder {
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.88rem;
}

.npc-convo-table-wrapper {
    max-height: 580px;
    overflow-y: auto;
}

.npc-convo-table th,
.npc-convo-table td {
    vertical-align: middle;
    font-size: 0.82rem;
}

#npcConversationPlaceholder {
    padding: 0.5rem;
}

.room-context-image,
.npc-chat-npc-image {
    width: 100%;
    border-radius: 8px;
    border: 2px solid rgba(0, 255, 136, 0.35);
    margin-bottom: 0.85rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

.npc-chat-npc-image--placeholder {
    object-fit: cover;
    filter: grayscale(0.35);
}

.room-context-title {
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: #8dffee;
}

.room-context-description {
    background: rgba(0, 255, 136, 0.08);
    border-left: 3px solid rgba(0, 255, 136, 0.6);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}

.area-context-section,
.lore-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.lore-entry {
    margin-bottom: 0.85rem;
    padding: 0.65rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid rgba(0, 180, 255, 0.45);
}

.npc-chat-description {
    background: rgba(0, 0, 0, 0.35);
    border-left: 2px solid rgba(0, 255, 136, 0.45);
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.npc-chat-profile dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #a0aec0;
    letter-spacing: 0.08em;
}

.npc-chat-profile dd {
    margin-bottom: 0.4rem;
    color: #f1fff5;
}

.npc-chat-center {
    display: flex;
    flex-direction: column;
}

.npc-disposition-container {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 10px;
    padding: 1rem;
}

.npc-disposition-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.npc-disposition-title {
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #00ff95;
}

.npc-disposition-value {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-weight: 700;
    min-width: 70px;
    text-align: center;
    color: #0b0b0d;
}

.npc-disposition-value.hostile { background: #f94144; color: #fff; }
.npc-disposition-value.unfriendly { background: #f3722c; color: #fff; }
.npc-disposition-value.neutral { background: #adb5bd; color: #000; }
.npc-disposition-value.friendly { background: #43aa8b; color: #fff; }
.npc-disposition-value.allied { background: #4cc9f0; color: #0b0b0d; }

.npc-disposition-track {
    position: relative;
    height: 24px;
    border-radius: 999px;
    background: linear-gradient(90deg, #f94144, #f3722c, #adb5bd, #43aa8b, #4cc9f0);
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

.npc-disposition-fill {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    width: 50%;
    transition: width 0.45s ease;
}

.npc-disposition-marker {
    position: absolute;
    top: 50%;
    width: 6px;
    height: 36px;
    background: #f1f5f9;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.65);
    transition: left 0.45s ease;
}

.npc-disposition-marker.pulsing {
    animation: dispositionPulse 0.8s ease;
}

@keyframes dispositionPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
}

.npc-disposition-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: rgba(255, 255, 255, 0.6);
}

.npc-chat-toggle-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.npc-chat-toggle-btn {
    flex: 1;
    min-width: 160px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 136, 0.35);
    color: #00ff95;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.npc-chat-toggle-btn:hover {
    background: rgba(0, 255, 136, 0.15);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.35);
}

.npc-chat-loading {
    text-align: center;
    color: #8dffee;
    font-style: italic;
    padding: 1rem 0;
}

/* Trigger word styling */
.trigger-word {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: rgba(0, 255, 136, 0.7);
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease, color 0.2s ease;
    font-weight: 600;
}

.trigger-word:hover {
    background: rgba(0, 255, 136, 0.3);
    color: #0f0;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.trigger-word::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: 120%;
    transform: translateX(-50%);
    background: #020202;
    border: 1px solid rgba(0, 255, 136, 0.5);
    color: #e5ffef;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    font-size: 0.75rem;
    z-index: 12;
}

.trigger-word:hover::after {
    opacity: 1;
}

.trigger-word[data-type="location"] { text-decoration-color: #4cc9f0; }
.trigger-word[data-type="lore"] { text-decoration-color: #f72585; }
.trigger-word[data-type="item"] { text-decoration-color: #ffd166; }
.trigger-word[data-type="faction"] { text-decoration-color: #b5179e; }

/* Responsive adjustments */
@media (max-width: 1200px) {
    .npc-chat-layout {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }

    .npc-chat-context-panel--right {
        grid-column: span 2;
        order: 3;
    }
}

@media (max-width: 992px) {
    .npc-chat-layout {
        grid-template-columns: 1fr;
    }

    .npc-chat-context-panel {
        max-height: 320px;
    }
}
