/* ============================================
 * NARRATIVE — AI SITE ANALYZER
 * ============================================ */

/* --- Layout: 2-Panel Split --- */
.nsa-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary);
}

/* --- Left Panel: Map / Image --- */
.nsa-left-panel {
    width: 45%;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    position: relative;
}

.nsa-left-panel .nsa-map-container {
    flex: 1;
    position: relative;
    min-height: 0;
}

.nsa-left-panel .nsa-map-container #nsa-map {
    width: 100%;
    height: 100%;
}

.nsa-map-overlay-toolbar {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    display: flex;
    gap: 6px;
    align-items: center;
}

.nsa-map-overlay-toolbar .nsa-map-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.nsa-map-overlay-toolbar .nsa-map-btn:hover {
    background: var(--bg-tertiary);
}

.nsa-map-overlay-toolbar .nsa-map-btn.active {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    color: #A78BFA;
}

/* Site image preview when received from Site Boundary */
.nsa-site-preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    position: relative;
    min-height: 0;
}

.nsa-site-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.nsa-site-info-bar {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

/* --- Right Panel: Analysis Results + Toolbar --- */
.nsa-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* --- Header --- */
.nsa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.nsa-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nsa-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 16px;
}

.nsa-back-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nsa-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.nsa-analyze-btn {
    padding: 7px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #8B5CF6, #6D28D9);
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nsa-analyze-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.nsa-analyze-btn:disabled {
    opacity: 0.6;
    transform: none;
    cursor: not-allowed;
}

/* --- Analysis Depth Toggle --- */
.nsa-depth-btn {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.nsa-depth-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nsa-depth-btn.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
    color: #A78BFA;
}

/* --- Generation Toolbar --- */
.nsa-gen-toolbar {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
    background: var(--bg-secondary);
}

.nsa-gen-toolbar label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nsa-gen-toolbar select,
.nsa-gen-toolbar input[type="text"] {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 11px;
    font-family: inherit;
    min-width: 0;
}

.nsa-gen-toolbar select:focus {
    outline: none;
    border-color: #8B5CF6;
}

.nsa-gen-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nsa-gen-separator {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    flex-shrink: 0;
}

.nsa-gen-btn {
    padding: 5px 14px;
    border: none;
    border-radius: 6px;
    background: #22C55E;
    color: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.nsa-gen-btn:hover {
    background: #16A34A;
}

.nsa-gen-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nsa-select-all-btn {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.nsa-select-all-btn:hover {
    background: var(--bg-tertiary);
}

/* --- Progress --- */
.nsa-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: rgba(139, 92, 246, 0.08);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.nsa-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.nsa-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8B5CF6, #A78BFA);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0;
}

.nsa-progress-text {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* --- Results List --- */
.nsa-results-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.nsa-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.nsa-empty-icon {
    font-size: 40px;
    margin-bottom: 14px;
    opacity: 0.6;
}

.nsa-empty-state h4 {
    margin: 0 0 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.nsa-empty-state p {
    margin: 0;
    font-size: 12px;
    max-width: 320px;
    line-height: 1.5;
}

/* --- Analysis Point Card --- */
.nsa-point-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    margin-bottom: 10px;
    transition: all 0.15s;
}

.nsa-point-card:hover {
    border-color: rgba(139, 92, 246, 0.3);
}

.nsa-point-card.generating {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.1);
}

/* Checkbox column */
.nsa-point-check {
    flex-shrink: 0;
    padding-top: 2px;
}

.nsa-point-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #8B5CF6;
    cursor: pointer;
}

/* Text column */
.nsa-point-content {
    flex: 1;
    min-width: 0;
}

.nsa-point-number {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #8B5CF6;
    background: rgba(139, 92, 246, 0.12);
    padding: 1px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.nsa-point-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    line-height: 1.3;
}

.nsa-point-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}

.nsa-point-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

.nsa-point-action-btn {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nsa-point-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nsa-point-action-btn.send-pres:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60A5FA;
}

/* Image column */
.nsa-point-image {
    flex-shrink: 0;
    width: 200px;
    min-height: 140px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.nsa-point-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nsa-img-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.nsa-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nsa-img-regen-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.75);
    color: #A78BFA;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}

.nsa-img-wrapper:hover .nsa-img-regen-btn {
    opacity: 1;
}

.nsa-img-regen-btn:hover {
    background: rgba(139, 92, 246, 0.6);
    color: #fff;
}

/* Text overlay toggle */
.nsa-text-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.nsa-text-toggle:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

.nsa-text-toggle input[type="checkbox"] {
    width: 12px;
    height: 12px;
    margin: 0;
    accent-color: #8B5CF6;
    cursor: pointer;
}

.nsa-point-image .nsa-img-placeholder {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.5;
    text-align: center;
    padding: 10px;
}

.nsa-point-image .nsa-img-generating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #A78BFA;
    font-size: 11px;
}

/* Spinner */
.nsa-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8B5CF6;
    border-radius: 50%;
    animation: nsa-spin 0.8s linear infinite;
}

@keyframes nsa-spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Send to Analyze button in Site Boundary --- */
.sb-send-analyze-btn {
    padding: 6px 12px;
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 6px;
    background: rgba(139, 92, 246, 0.1);
    color: #A78BFA;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sb-send-analyze-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.6);
}

.sb-send-analyze-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
 * Generate Options Button
 * ============================================ */

.nsa-options-btn {
    background: linear-gradient(135deg, #D97706, #B45309) !important;
    border-color: transparent !important;
    color: #fff !important;
}

.nsa-options-btn:hover {
    opacity: 0.9;
}

.nsa-options-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* MD Loaded Badge */
.nsa-md-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.12);
    color: #22C55E;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid rgba(34, 197, 94, 0.25);
    animation: nsa-badge-in 0.3s ease;
    white-space: nowrap;
}

@keyframes nsa-badge-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Design Categories Bar */
.nsa-categories-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.nsa-categories-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 4px;
    white-space: nowrap;
}

.nsa-cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 10px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.nsa-cat-chip input[type="checkbox"] {
    display: none;
}

.nsa-cat-chip:hover {
    border-color: rgba(217, 119, 6, 0.5);
    background: rgba(217, 119, 6, 0.04);
}

.nsa-cat-chip.active {
    border-color: rgba(217, 119, 6, 0.5);
    background: rgba(217, 119, 6, 0.1);
    color: #D97706;
    font-weight: 600;
}